Core: Append single character to stream as character, not as a string

This commit is contained in:
Spp-
2011-07-29 14:18:28 +02:00
parent 06b46ba203
commit e47b96af3e
70 changed files with 432 additions and 424 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::strin
// Append port to IP address.
std::ostringstream ss;
ss << address << ":" << port;
ss << address << ':' << port;
realm.address = ss.str();
realm.gamebuild = build;
}
+5 -5
View File
@@ -95,9 +95,9 @@ namespace VMAP
{
std::stringstream tilefilename;
tilefilename.fill('0');
tilefilename << std::setw(3) << mapID << "_";
//tilefilename << std::setw(2) << tileX << "_" << std::setw(2) << tileY << ".vmtile";
tilefilename << std::setw(2) << tileY << "_" << std::setw(2) << tileX << ".vmtile";
tilefilename << std::setw(3) << mapID << '_';
//tilefilename << std::setw(2) << tileX << '_' << std::setw(2) << tileY << ".vmtile";
tilefilename << std::setw(2) << tileY << '_' << std::setw(2) << tileX << ".vmtile";
return tilefilename.str();
}
@@ -129,7 +129,7 @@ namespace VMAP
{
if (iBasePath.length() > 0 && (iBasePath[iBasePath.length()-1] != '/' || iBasePath[iBasePath.length()-1] != '\\'))
{
iBasePath.append("/");
iBasePath.push_back('/');
}
}
@@ -242,7 +242,7 @@ namespace VMAP
{
std::string basePath = vmapPath;
if (basePath.length() > 0 && (basePath[basePath.length()-1] != '/' || basePath[basePath.length()-1] != '\\'))
basePath.append("/");
basePath.push_back('/');
std::string fullname = basePath + VMapManager2::getMapFileName(mapID);
bool success = true;
FILE *rf = fopen(fullname.c_str(), "rb");
+13 -6
View File
@@ -112,7 +112,7 @@ namespace VMAP
// write map tree file
std::stringstream mapfilename;
mapfilename << iDestDir << "/" << std::setfill('0') << std::setw(3) << map_iter->first << ".vmtree";
mapfilename << iDestDir << '/' << std::setfill('0') << std::setw(3) << map_iter->first << ".vmtree";
FILE *mapfile = fopen(mapfilename.str().c_str(), "wb");
if (!mapfile)
{
@@ -153,10 +153,10 @@ namespace VMAP
uint32 nSpawns = tileEntries.count(tile->first);
std::stringstream tilefilename;
tilefilename.fill('0');
tilefilename << iDestDir << "/" << std::setw(3) << map_iter->first << "_";
tilefilename << iDestDir << '/' << std::setw(3) << map_iter->first << '_';
uint32 x, y;
StaticMapTree::unpackTileID(tile->first, x, y);
tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile";
tilefilename << std::setw(2) << x << '_' << std::setw(2) << y << ".vmtile";
FILE *tilefile = fopen(tilefilename.str().c_str(), "wb");
// file header
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) success = false;
@@ -242,7 +242,10 @@ namespace VMAP
bool TileAssembler::calculateTransformedBound(ModelSpawn &spawn)
{
std::string modelFilename = iSrcDir + "/" + spawn.name;
std::string modelFilename(iSrcDir);
modelFilename.push_back('/');
modelFilename.append(spawn.name);
ModelPosition modelPosition;
modelPosition.iDir = spawn.iRot;
modelPosition.iScale = spawn.iScale;
@@ -358,7 +361,7 @@ namespace VMAP
bool success = true;
std::string filename = iSrcDir;
if (filename.length() >0)
filename.append("/");
filename.push_back('/');
filename.append(pModelFilename);
FILE *rf = fopen(filename.c_str(), "rb");
@@ -496,7 +499,11 @@ namespace VMAP
if (!groupsArray.empty())
{
model.setGroupModels(groupsArray);
success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo");
std::string filename(iSrcDir);
filename.push_back('/');
filename.append(pModelFilename).append(".vmo");
success = model.writeFile(filename);
}
//std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl;
@@ -49,7 +49,7 @@ namespace VMAP
// std::cout << "Ray crosses bound of '" << name << "'\n";
/* std::cout << "ray from:" << pRay.origin().x << ", " << pRay.origin().y << ", " << pRay.origin().z
<< " dir:" << pRay.direction().x << ", " << pRay.direction().y << ", " << pRay.direction().z
<< " t/tmax:" << time << "/" << pMaxDist;
<< " t/tmax:" << time << '/' << pMaxDist;
std::cout << "\nBound lo:" << iBound.low().x << ", " << iBound.low().y << ", " << iBound.low().z << " hi: "
<< iBound.high().x << ", " << iBound.high().y << ", " << iBound.high().z << std::endl; */
// child bounds are defined in object space:
@@ -491,20 +491,20 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
/// next new/changed record prefix
else
{
ssdel << ", ";
ssins << ", ";
ssdel << ',';
ssins << ',';
}
// new/changed record data
ssdel << iter->first;
ssins << "("<<GetPlayer()->GetGUIDLow() << ", " << iter->first << ", " << uint64(iter->second.date) << ")";
ssins << '(' << GetPlayer()->GetGUIDLow() << ',' << iter->first << ',' << uint64(iter->second.date) << ')';
/// mark as saved in db
iter->second.changed = false;
}
if (need_execute)
ssdel << ")";
ssdel << ')';
if (need_execute)
{
@@ -535,7 +535,7 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
}
/// next new/changed record prefix
else
ssdel << ", ";
ssdel << ',';
// new/changed record data
ssdel << iter->first;
@@ -552,10 +552,10 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
}
/// next new/changed record prefix
else
ssins << ", ";
ssins << ',';
// new/changed record data
ssins << "(" << GetPlayer()->GetGUIDLow() << ", " << iter->first << ", " << iter->second.counter << ", " << iter->second.date << ")";
ssins << '(' << GetPlayer()->GetGUIDLow() << ',' << iter->first << ',' << iter->second.counter << ',' << iter->second.date << ')';
}
/// mark as updated in db
@@ -563,7 +563,7 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
}
if (need_execute_del) // DELETE ... IN (.... _)_
ssdel << ")";
ssdel << ')';
if (need_execute_del || need_execute_ins)
{
@@ -584,7 +584,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
Field* fields = achievementResult->Fetch();
uint32 achievementid = fields[0].GetUInt16();
// don't must happen: cleanup at server startup in sAchievementMgr->LoadCompletedAchievements()
// must not happen: cleanup at server startup in sAchievementMgr->LoadCompletedAchievements()
AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementid);
if (!achievement)
continue;
@@ -140,7 +140,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction, SQLTransaction&
std::ostringstream msgAuctionWonBody;
msgAuctionWonBody.width(16);
msgAuctionWonBody << std::right << std::hex << auction->owner;
msgAuctionWonBody << std::dec << ":" << auction->bid << ":" << auction->buyout;
msgAuctionWonBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionWon body string : %s", msgAuctionWonBody.str().c_str());
// set owner to bidder (to prevent delete item with sender char deleting)
@@ -181,8 +181,8 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction, SQLTran
msgAuctionSalePendingBody.width(16);
msgAuctionSalePendingBody << std::right << std::hex << auction->bidder;
msgAuctionSalePendingBody << std::dec << ":" << auction->bid << ":" << auction->buyout;
msgAuctionSalePendingBody << ":" << auction->deposit << ":" << auctionCut << ":0:";
msgAuctionSalePendingBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
msgAuctionSalePendingBody << ':' << auction->deposit << ':' << auctionCut << ":0:";
msgAuctionSalePendingBody << secsToTimeBitFields(distrTime);
sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str());
@@ -209,8 +209,8 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction, SQLTrans
auctionSuccessfulBody.width(16);
auctionSuccessfulBody << std::right << std::hex << auction->bidder;
auctionSuccessfulBody << std::dec << ":" << auction->bid << ":" << auction->buyout;
auctionSuccessfulBody << ":" << auction->deposit << ":" << auctionCut;
auctionSuccessfulBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
auctionSuccessfulBody << ':' << auction->deposit << ':' << auctionCut;
sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str());
@@ -624,18 +624,10 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
// dbc local name
if (temp)
{
if (locdbc_idx >= 0)
{
// Append the suffix (ie: of the Monkey) to the name using localization
name += " ";
name += temp[locdbc_idx];
}
else
{
// Invalid localization? Append the suffix using default enUS
name += " ";
name += temp[LOCALE_enUS];
}
// Append the suffix (ie: of the Monkey) to the name using localization
// or default enUS if localization is invalid
name += ' ';
name += temp[locdbc_idx >= 0 ? locdbc_idx : LOCALE_enUS];
}
}
}
@@ -885,4 +877,4 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
}
return true;
}
}
+1 -1
View File
@@ -103,7 +103,7 @@ void Channel::UpdateChannelInDB() const
std::ostringstream banlist;
BannedList::const_iterator iter;
for (iter = banned.begin(); iter != banned.end(); ++iter)
banlist << (*iter) << " ";
banlist << (*iter) << ' ';
std::string banListStr = banlist.str();
+1 -1
View File
@@ -173,7 +173,7 @@ inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const *local
else
ss << locale->Name[index];
if (suffixStrings)
ss << " " << suffixStrings[index];
ss << ' ' << suffixStrings[index];
return ss.str();
}
+3 -3
View File
@@ -512,9 +512,9 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
// send area in "id - [name]" format
std::ostringstream ss;
if (m_session)
ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r";
ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << ' ' << localeNames[loc]<< "]|h|r";
else
ss << areaEntry->ID << " - " << name << " " << localeNames[loc];
ss << areaEntry->ID << " - " << name << ' ' << localeNames[loc];
SendSysMessage (ss.str ().c_str());
@@ -575,7 +575,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
if (m_session)
reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
else
reply << " " << itr->first << " " << tele->name << "\n";
reply << " " << itr->first << ' ' << tele->name << "\n";
}
if (reply.str().empty())
+11 -10
View File
@@ -506,29 +506,30 @@ bool ChatHandler::HandleCharacterReputationCommand(const char* args)
FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList();
for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
{
FactionEntry const *factionEntry = sFactionStore.LookupEntry(itr->second.ID);
const FactionState& faction = itr->second;
FactionEntry const *factionEntry = sFactionStore.LookupEntry(faction.ID);
char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#";
ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]);
std::ostringstream ss;
if (m_session)
ss << itr->second.ID << " - |cffffffff|Hfaction:" << itr->second.ID << "|h[" << factionName << " " << localeNames[loc] << "]|h|r";
ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r";
else
ss << itr->second.ID << " - " << factionName << " " << localeNames[loc];
ss << faction.ID << " - " << factionName << ' ' << localeNames[loc];
ss << " " << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ")";
ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
if (itr->second.Flags & FACTION_FLAG_VISIBLE)
if (faction.Flags & FACTION_FLAG_VISIBLE)
ss << GetTrinityString(LANG_FACTION_VISIBLE);
if (itr->second.Flags & FACTION_FLAG_AT_WAR)
if (faction.Flags & FACTION_FLAG_AT_WAR)
ss << GetTrinityString(LANG_FACTION_ATWAR);
if (itr->second.Flags & FACTION_FLAG_PEACE_FORCED)
if (faction.Flags & FACTION_FLAG_PEACE_FORCED)
ss << GetTrinityString(LANG_FACTION_PEACE_FORCED);
if (itr->second.Flags & FACTION_FLAG_HIDDEN)
if (faction.Flags & FACTION_FLAG_HIDDEN)
ss << GetTrinityString(LANG_FACTION_HIDDEN);
if (itr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED)
if (faction.Flags & FACTION_FLAG_INVISIBLE_FORCED)
ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
if (itr->second.Flags & FACTION_FLAG_INACTIVE)
if (faction.Flags & FACTION_FLAG_INACTIVE)
ss << GetTrinityString(LANG_FACTION_INACTIVE);
SendSysMessage(ss.str().c_str());
+8 -8
View File
@@ -1062,9 +1062,9 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
ss << GetTrinityString(LANG_SPELL_RANK) << rank;
if (m_session)
ss << " " << localeNames[loc] << "]|h|r";
ss << ' ' << localeNames[loc] << "]|h|r";
else
ss << " " << localeNames[loc];
ss << ' ' << localeNames[loc];
if (talent)
ss << GetTrinityString(LANG_TALENT);
@@ -1426,16 +1426,16 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
// or "id - [faction] [no reputation]" format
std::ostringstream ss;
if (m_session)
ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << " " << localeNames[loc] << "]|h|r";
ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << ' ' << localeNames[loc] << "]|h|r";
else
ss << id << " - " << name << " " << localeNames[loc];
ss << id << " - " << name << ' ' << localeNames[loc];
if (repState) // and then target != NULL also
{
uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry);
std::string rankName = GetTrinityString(index);
ss << " " << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ")";
ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
if (repState->Flags & FACTION_FLAG_VISIBLE)
ss << GetTrinityString(LANG_FACTION_VISIBLE);
@@ -1589,9 +1589,9 @@ bool ChatHandler::HandleLookupMapCommand(const char *args)
std::ostringstream ss;
if (m_session)
ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << "]";
ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << ']';
else // console
ss << id << " - [" << name << "]";
ss << id << " - [" << name << ']';
if (MapInfo->IsContinent())
ss << GetTrinityString(LANG_CONTINENT);
@@ -4029,7 +4029,7 @@ std::string GetTimeString(uint64 time)
std::ostringstream ss;
if (days) ss << days << "d ";
if (hours) ss << hours << "h ";
ss << minute << "m";
ss << minute << 'm';
return ss.str();
}
+5 -1
View File
@@ -224,7 +224,11 @@ inline void LoadDBC(uint32& availableDbcLocales, StoreProblemList& errors, DBCSt
if (!(availableDbcLocales & (1 << i)))
continue;
std::string localizedName = dbcPath + localeNames[i] + "/" + filename;
std::string localizedName(dbcPath);
localizedName.append(localeNames[i]);
localizedName.push_back('/');
localizedName.append(filename);
if (!storage.LoadStringsFrom(localizedName.c_str()))
availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
}
+1 -1
View File
@@ -1882,7 +1882,7 @@ std::string LFGMgr::ConcatenateGuids(LfgGuidList check)
LfgGuidList::const_iterator it = check.begin();
o << (*it);
for (++it; it != check.end(); ++it)
o << "|" << (*it);
o << '|' << (*it);
return o.str();
}
+24 -24
View File
@@ -437,11 +437,11 @@ void Creature::Update(uint32 diff)
switch(m_deathState)
{
case JUST_ALIVED:
// Don't must be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting.
// Must not be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting.
sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)", GetGUIDLow(), GetEntry());
break;
case JUST_DIED:
// Don't must be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
break;
case DEAD:
@@ -1052,7 +1052,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
dynamicflags = 0;
}
// data->guid = guid don't must be update at save
// data->guid = guid must not be updated at save
data.id = GetEntry();
data.mapid = mapid;
data.phaseMask = phaseMask;
@@ -1076,33 +1076,33 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
data.unit_flags = unit_flags;
data.dynamicflags = dynamicflags;
// updated in DB
// update in DB
SQLTransaction trans = WorldDatabase.BeginTransaction();
trans->PAppend("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid);
std::ostringstream ss;
ss << "INSERT INTO creature VALUES ("
<< m_DBTableGuid << ", "
<< GetEntry() << ", "
<< mapid <<", "
<< uint32(spawnMask) << ", " // cast to prevent save as symbol
<< uint16(GetPhaseMask()) << ", " // prevent out of range error
<< displayId <<", "
<< GetEquipmentId() <<", "
<< GetPositionX() << ", "
<< GetPositionY() << ", "
<< GetPositionZ() << ", "
<< GetOrientation() << ", "
<< m_respawnDelay << ", " //respawn time
<< (float) m_respawnradius << ", " //spawn distance (float)
<< (uint32) (0) << ", " //currentwaypoint
<< GetHealth() << ", " //curhealth
<< GetPower(POWER_MANA) << ", " //curmana
<< GetDefaultMovementType() << ", " //default movement generator type
<< npcflag << ", "
<< unit_flags << ", "
<< dynamicflags << ")";
<< m_DBTableGuid << ','
<< GetEntry() << ','
<< mapid << ','
<< uint32(spawnMask) << ',' // cast to prevent save as symbol
<< uint16(GetPhaseMask()) << ',' // prevent out of range error
<< displayId << ','
<< GetEquipmentId() << ','
<< GetPositionX() << ','
<< GetPositionY() << ','
<< GetPositionZ() << ','
<< GetOrientation() << ','
<< m_respawnDelay << ',' //respawn time
<< (float) m_respawnradius << ',' //spawn distance (float)
<< (uint32) (0) << ',' //currentwaypoint
<< GetHealth() << ',' //curhealth
<< GetPower(POWER_MANA) << ',' //curmana
<< GetDefaultMovementType() << ',' //default movement generator type
<< npcflag << ','
<< unit_flags << ','
<< dynamicflags << ')';
trans->Append(ss.str().c_str());
@@ -668,7 +668,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
// update in loaded data (changing data only in this place)
GameObjectData& data = sObjectMgr->NewGOData(m_DBTableGuid);
// data->guid = guid don't must be update at save
// data->guid = guid must not be updated at save
data.id = GetEntry();
data.mapid = mapid;
data.phaseMask = phaseMask;
@@ -686,25 +686,25 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
data.spawnMask = spawnMask;
data.artKit = GetGoArtKit();
// updated in DB
// update in DB
std::ostringstream ss;
ss << "INSERT INTO gameobject VALUES ("
<< m_DBTableGuid << ", "
<< GetEntry() << ", "
<< mapid << ", "
<< uint32(spawnMask) << ", " // cast to prevent save as symbol
<< uint16(GetPhaseMask()) << ", " // prevent out of range error
<< GetPositionX() << ", "
<< GetPositionY() << ", "
<< GetPositionZ() << ", "
<< GetOrientation() << ", "
<< GetFloatValue(GAMEOBJECT_PARENTROTATION) << ", "
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+1) << ", "
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+2) << ", "
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+3) << ", "
<< m_respawnDelayTime << ", "
<< uint32(GetGoAnimProgress()) << ", "
<< uint32(GetGoState()) << ")";
<< m_DBTableGuid << ','
<< GetEntry() << ','
<< mapid << ','
<< uint32(spawnMask) << ',' // cast to prevent save as symbol
<< uint16(GetPhaseMask()) << ',' // prevent out of range error
<< GetPositionX() << ','
<< GetPositionY() << ','
<< GetPositionZ() << ','
<< GetOrientation() << ','
<< GetFloatValue(GAMEOBJECT_PARENTROTATION) << ','
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+1) << ','
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+2) << ','
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+3) << ','
<< m_respawnDelayTime << ','
<< uint32(GetGoAnimProgress()) << ','
<< uint32(GetGoState()) << ')';
SQLTransaction trans = WorldDatabase.BeginTransaction();
trans->PAppend("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
+4 -4
View File
@@ -330,7 +330,7 @@ void Item::SaveToDB(SQLTransaction& trans)
std::ostringstream ssSpells;
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
ssSpells << GetSpellCharges(i) << " ";
ssSpells << GetSpellCharges(i) << ' ';
stmt->setString(++index, ssSpells.str());
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_FLAGS));
@@ -338,9 +338,9 @@ void Item::SaveToDB(SQLTransaction& trans)
std::ostringstream ssEnchants;
for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
{
ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << " ";
ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << " ";
ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << " ";
ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << ' ';
ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' ';
ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' ';
}
stmt->setString(++index, ssEnchants.str());
+1 -1
View File
@@ -155,7 +155,7 @@ std::string Object::_ConcatFields(uint16 startIndex, uint16 size) const
{
std::ostringstream ss;
for (uint16 index = 0; index < size; ++index)
ss << GetUInt32Value(index + startIndex) << " ";
ss << GetUInt32Value(index + startIndex) << ' ';
return ss.str();
}
+18 -18
View File
@@ -402,30 +402,30 @@ void Pet::SavePetToDB(PetSaveMode mode)
std::ostringstream ss;
ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType) "
<< "VALUES ("
<< m_charmInfo->GetPetNumber() << ", "
<< GetEntry() << ", "
<< owner << ", "
<< GetNativeDisplayId() << ", "
<< uint32(getLevel()) << ", "
<< GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ", "
<< uint32(GetReactState()) << ", "
<< m_charmInfo->GetPetNumber() << ','
<< GetEntry() << ','
<< owner << ','
<< GetNativeDisplayId() << ','
<< uint32(getLevel()) << ','
<< GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ','
<< uint32(GetReactState()) << ','
<< uint32(mode) << ", '"
<< name.c_str() << "', "
<< uint32(HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ? 0 : 1) << ", "
<< curhealth << ", "
<< curmana << ", "
<< uint32(HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ? 0 : 1) << ','
<< curhealth << ','
<< curmana << ','
<< GetPower(POWER_HAPPINESS) << ", '";
for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i)
{
ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << " "
<< uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << " ";
ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << ' '
<< uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' ';
};
ss << "', "
<< time(NULL) << ", "
<< GetUInt32Value(UNIT_CREATED_BY_SPELL) << ", "
<< uint32(getPetType()) << ")";
<< time(NULL) << ','
<< GetUInt32Value(UNIT_CREATED_BY_SPELL) << ','
<< uint32(getPetType()) << ')';
trans->Append(ss.str().c_str());
CharacterDatabase.CommitTransaction(trans);
@@ -1640,7 +1640,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
uint32 id = fields[0].GetUInt32();
if (need_comma)
ss << ", ";
ss << ',';
ss << id;
@@ -1661,7 +1661,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
continue;
if (need_execute)
ss << ", ";
ss << ',';
ss << spell;
@@ -1672,7 +1672,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
if (!need_execute)
return;
ss << ")";
ss << ')';
CharacterDatabase.Execute(ss.str().c_str());
}
+92 -92
View File
@@ -258,7 +258,7 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString()
std::ostringstream ss;
for (size_t i=0; i < m_TaxiDestinations.size(); ++i)
ss << m_TaxiDestinations[i] << " ";
ss << m_TaxiDestinations[i] << ' ';
return ss.str();
}
@@ -278,10 +278,10 @@ uint32 PlayerTaxi::GetCurrentTaxiPath() const
std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi)
{
ss << "'";
ss << '\'';
for (uint8 i = 0; i < TaxiMaskSize; ++i)
ss << taxi.m_taximask[i] << " ";
ss << "'";
ss << taxi.m_taximask[i] << ' ';
ss << '\'';
return ss;
}
@@ -4288,8 +4288,8 @@ void Player::_SaveSpellCooldowns(SQLTransaction& trans)
}
// next new/changed record prefix
else
ss << ", ";
ss << "(" << GetGUIDLow() << ", " << itr->first << ", " << itr->second.itemid << ", " << uint64(itr->second.end) << ")";
ss << ',';
ss << '(' << GetGUIDLow() << ',' << itr->first << ',' << itr->second.itemid << ',' << uint64(itr->second.end) << ')';
++itr;
}
else
@@ -11895,7 +11895,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
// save data
std::ostringstream ss;
for (AllowedLooterSet::iterator itr = allowedLooters->begin(); itr != allowedLooters->end(); ++itr)
ss << *itr << " ";
ss << *itr << ' ';
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_ITEM_BOP_TRADE);
stmt->setUInt32(0, pItem->GetGUIDLow());
@@ -18187,118 +18187,118 @@ void Player::SaveToDB()
"death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, "
"todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, "
"power4, power5, power6, power7, latency, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars) VALUES ("
<< GetGUIDLow() << ", "
<< GetGUIDLow() << ','
<< GetSession()->GetAccountId() << ", '"
<< sql_name << "', "
<< uint32(getRace()) << ", "
<< uint32(getClass()) << ", "
<< uint32(getGender()) << ", "
<< uint32(getLevel()) << ", "
<< GetUInt32Value(PLAYER_XP) << ", "
<< GetMoney() << ", "
<< GetUInt32Value(PLAYER_BYTES) << ", "
<< GetUInt32Value(PLAYER_BYTES_2) << ", "
<< GetUInt32Value(PLAYER_FLAGS) << ", ";
<< uint32(getRace()) << ','
<< uint32(getClass()) << ','
<< uint32(getGender()) << ','
<< uint32(getLevel()) << ','
<< GetUInt32Value(PLAYER_XP) << ','
<< GetMoney() << ','
<< GetUInt32Value(PLAYER_BYTES) << ','
<< GetUInt32Value(PLAYER_BYTES_2) << ','
<< GetUInt32Value(PLAYER_FLAGS) << ',';
if (!IsBeingTeleported())
{
ss << GetMapId() << ", "
<< (uint32)GetInstanceId() << ", "
<< uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ", "
<< finiteAlways(GetPositionX()) << ", "
<< finiteAlways(GetPositionY()) << ", "
<< finiteAlways(GetPositionZ()) << ", "
<< finiteAlways(GetOrientation()) << ", ";
ss << GetMapId() << ','
<< (uint32)GetInstanceId() << ','
<< uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ','
<< finiteAlways(GetPositionX()) << ','
<< finiteAlways(GetPositionY()) << ','
<< finiteAlways(GetPositionZ()) << ','
<< finiteAlways(GetOrientation()) << ',';
}
else
{
ss << GetTeleportDest().GetMapId() << ", "
<< (uint32)0 << ", "
<< uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ", "
<< finiteAlways(GetTeleportDest().GetPositionX()) << ", "
<< finiteAlways(GetTeleportDest().GetPositionY()) << ", "
<< finiteAlways(GetTeleportDest().GetPositionZ()) << ", "
<< finiteAlways(GetTeleportDest().GetOrientation()) << ", ";
ss << GetTeleportDest().GetMapId() << ','
<< (uint32)0 << ','
<< uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ','
<< finiteAlways(GetTeleportDest().GetPositionX()) << ','
<< finiteAlways(GetTeleportDest().GetPositionY()) << ','
<< finiteAlways(GetTeleportDest().GetPositionZ()) << ','
<< finiteAlways(GetTeleportDest().GetOrientation()) << ',';
}
ss << m_taxi << ", "; // string with TaxiMaskSize numbers
ss << m_taxi << ','; // string with TaxiMaskSize numbers
ss << (IsInWorld() ? 1 : 0) << ", ";
ss << (IsInWorld() ? 1 : 0) << ',';
ss << uint32(m_cinematic) << ", ";
ss << uint32(m_cinematic) << ',';
ss << m_Played_time[PLAYED_TIME_TOTAL] << ", ";
ss << m_Played_time[PLAYED_TIME_LEVEL] << ", ";
ss << m_Played_time[PLAYED_TIME_TOTAL] << ',';
ss << m_Played_time[PLAYED_TIME_LEVEL] << ',';
ss << finiteAlways(m_rest_bonus) << ", ";
ss << uint32(time(NULL)) << ", ";
ss << (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0) << ", ";
ss << finiteAlways(m_rest_bonus) << ',';
ss << uint32(time(NULL)) << ',';
ss << (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0) << ',';
//save, far from tavern/city
//save, but in tavern/city
ss << m_resetTalentsCost << ", ";
ss << uint32(m_resetTalentsTime) << ", ";
ss << m_resetTalentsCost << ',';
ss << uint32(m_resetTalentsTime) << ',';
ss << finiteAlways(m_movementInfo.t_pos.GetPositionX()) << ", ";
ss << finiteAlways(m_movementInfo.t_pos.GetPositionY()) << ", ";
ss << finiteAlways(m_movementInfo.t_pos.GetPositionZ()) << ", ";
ss << finiteAlways(m_movementInfo.t_pos.GetOrientation()) << ", ";
ss << finiteAlways(m_movementInfo.t_pos.GetPositionX()) << ',';
ss << finiteAlways(m_movementInfo.t_pos.GetPositionY()) << ',';
ss << finiteAlways(m_movementInfo.t_pos.GetPositionZ()) << ',';
ss << finiteAlways(m_movementInfo.t_pos.GetOrientation()) << ',';
if (m_transport)
ss << m_transport->GetGUIDLow();
else
ss << "0";
ss << ", ";
ss << '0';
ss << ',';
ss << m_ExtraFlags << ", ";
ss << m_ExtraFlags << ',';
ss << uint32(m_stableSlots) << ", "; // to prevent save uint8 as char
ss << uint32(m_stableSlots) << ','; // to prevent save uint8 as char
ss << uint32(m_atLoginFlags) << ", ";
ss << uint32(m_atLoginFlags) << ',';
ss << GetZoneId() << ", ";
ss << GetZoneId() << ',';
ss << uint32(m_deathExpireTime) << ", '";
ss << m_taxi.SaveTaxiDestinationsToString() << "', ";
ss << GetArenaPoints() << ", ";
ss << GetArenaPoints() << ',';
ss << GetHonorPoints() << ", ";
ss << GetHonorPoints() << ',';
ss << GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION) << ", ";
ss << GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION) << ',';
ss << GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION) << ", ";
ss << GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION) << ',';
ss << GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) << ", ";
ss << GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) << ',';
ss << GetUInt16Value(PLAYER_FIELD_KILLS, 0) << ", ";
ss << GetUInt16Value(PLAYER_FIELD_KILLS, 0) << ',';
ss << GetUInt16Value(PLAYER_FIELD_KILLS, 1) << ", ";
ss << GetUInt16Value(PLAYER_FIELD_KILLS, 1) << ',';
ss << GetUInt32Value(PLAYER_CHOSEN_TITLE) << ", ";
ss << GetUInt32Value(PLAYER_CHOSEN_TITLE) << ',';
ss << GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES) << ", ";
ss << GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES) << ',';
ss << GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX) << ", ";
ss << GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX) << ',';
ss << (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE) << ", ";
ss << (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE) << ',';
ss << GetHealth();
for (uint32 i = 0; i < MAX_POWERS; ++i)
ss << ", " << GetPower(Powers(i));
ss << ", ";
ss << ',' << GetPower(Powers(i));
ss << ',';
ss << GetSession()->GetLatency();
ss << ", ";
ss << ',';
ss << uint32(m_specsCount);
ss << ", ";
ss << ',';
ss << uint32(m_activeSpec) << ", '";
for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << " ";
ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
// cache equipment...
ss << "', '";
for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << " ";
ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
// ...and bags for enum opcode
for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
@@ -18306,19 +18306,19 @@ void Player::SaveToDB()
if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
ss << item->GetEntry();
else
ss << "0";
ss << '0';
ss << " 0 ";
}
ss << "', ";
ss << "',";
ss << GetUInt32Value(PLAYER_AMMO_ID) << ", '";
for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << " ";
ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << ' ';
ss << "', ";
ss << "',";
ss << uint32(GetByteValue(PLAYER_FIELD_BYTES, 2));
ss << ")";
ss << ')';
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -18785,25 +18785,25 @@ void Player::_SaveStats(SQLTransaction& trans)
ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, "
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower, resilience) VALUES ("
<< GetGUIDLow() << ", "
<< GetMaxHealth() << ", ";
<< GetGUIDLow() << ','
<< GetMaxHealth() << ',';
for (uint8 i = 0; i < MAX_POWERS; ++i)
ss << GetMaxPower(Powers(i)) << ", ";
ss << GetMaxPower(Powers(i)) << ',';
for (uint8 i = 0; i < MAX_STATS; ++i)
ss << GetStat(Stats(i)) << ", ";
ss << GetStat(Stats(i)) << ',';
// armor + school resistances
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
ss << GetResistance(SpellSchools(i)) << ", ";
ss << GetFloatValue(PLAYER_BLOCK_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_DODGE_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_PARRY_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_CRIT_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1) << ", "
<< GetUInt32Value(UNIT_FIELD_ATTACK_POWER) << ", "
<< GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) << ", "
<< GetBaseSpellPowerBonus() << ", "
<< GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL) << ")";
ss << GetResistance(SpellSchools(i)) << ',';
ss << GetFloatValue(PLAYER_BLOCK_PERCENTAGE) << ','
<< GetFloatValue(PLAYER_DODGE_PERCENTAGE) << ','
<< GetFloatValue(PLAYER_PARRY_PERCENTAGE) << ','
<< GetFloatValue(PLAYER_CRIT_PERCENTAGE) << ','
<< GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE) << ','
<< GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1) << ','
<< GetUInt32Value(UNIT_FIELD_ATTACK_POWER) << ','
<< GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) << ','
<< GetBaseSpellPowerBonus() << ','
<< GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL) << ')';
trans->Append(ss.str().c_str());
}
@@ -18878,10 +18878,10 @@ void Player::SendAttackSwingNotInRange()
void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid)
{
std::ostringstream ss;
ss << "UPDATE characters SET position_x='"<<x<<"', position_y='"<<y
<< "', position_z='"<<z<<"', orientation='"<<o<<"', map='"<<mapid
<< "', zone='"<<zone<<"', trans_x='0', trans_y='0', trans_z='0', "
<< "transguid='0', taxi_path='' WHERE guid='"<< GUID_LOPART(guid) <<"'";
ss << "UPDATE characters SET position_x='" << x << "', position_y='" << y
<< "', position_z='" << z << "', orientation='" << o << "', map='" << mapid
<< "', zone='" << zone << "', trans_x='0', trans_y='0', trans_z='0', "
<< "transguid='0', taxi_path='' WHERE guid='" << GUID_LOPART(guid) << '\'';
sLog->outDebug(LOG_FILTER_UNITS, "%s", ss.str().c_str());
CharacterDatabase.Execute(ss.str().c_str());
}
+1 -1
View File
@@ -244,7 +244,7 @@ std::string InstanceScript::GetBossSaveData()
{
std::ostringstream saveStream;
for (std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i)
saveStream << (uint32)i->state << " ";
saveStream << (uint32)i->state << ' ';
return saveStream.str();
}
+1 -1
View File
@@ -790,7 +790,7 @@ void PoolMgr::LoadFromDB()
std::ostringstream ss;
ss<< "The pool(s) ";
for (std::set<uint32>::const_iterator itr=checkedPools.begin(); itr != checkedPools.end(); ++itr)
ss << *itr << " ";
ss << *itr << ' ';
ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool "
<< poolItr->first << " and child pool " << poolItr->second;
sLog->outErrorDb("%s", ss.str().c_str());
@@ -1738,12 +1738,12 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
if (playerClass != CLASS_DEATH_KNIGHT)
{
for (uint8 i = 0; i < numFullTaximasks; ++i)
taximaskstream << uint32(sAllianceTaxiNodesMask[i]) << " ";
taximaskstream << uint32(sAllianceTaxiNodesMask[i]) << ' ';
}
else
{
for (uint8 i = 0; i < numFullTaximasks; ++i)
taximaskstream << uint32(sAllianceTaxiNodesMask[i] | sDeathKnightTaxiNodesMask[i]) << " ";
taximaskstream << uint32(sAllianceTaxiNodesMask[i] | sDeathKnightTaxiNodesMask[i]) << ' ';
}
}
else
@@ -1751,19 +1751,19 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
if (playerClass != CLASS_DEATH_KNIGHT)
{
for (uint8 i = 0; i < numFullTaximasks; ++i)
taximaskstream << uint32(sHordeTaxiNodesMask[i]) << " ";
taximaskstream << uint32(sHordeTaxiNodesMask[i]) << ' ';
}
else
{
for (uint8 i = 0; i < numFullTaximasks; ++i)
taximaskstream << uint32(sHordeTaxiNodesMask[i] | sDeathKnightTaxiNodesMask[i]) << " ";
taximaskstream << uint32(sHordeTaxiNodesMask[i] | sDeathKnightTaxiNodesMask[i]) << ' ';
}
}
uint32 numEmptyTaximasks = 11 - numFullTaximasks;
for (uint8 i = 0; i < numEmptyTaximasks; ++i)
taximaskstream << "0 ";
taximaskstream << "0";
taximaskstream << '0';
std::string taximask = taximaskstream.str();
trans->PAppend("UPDATE `characters` SET `taximask`= '%s' WHERE `guid` = '%u'", taximask.c_str(), lowGuid);
}
@@ -1784,7 +1784,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
if (requiredRaces & RACEMASK_ALLIANCE)
{
quests << uint32(qinfo->GetQuestId());
quests << ",";
quests << ',';
}
}
else // if (team == BG_TEAM_HORDE)
@@ -1792,7 +1792,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
if (requiredRaces & RACEMASK_HORDE)
{
quests << uint32(qinfo->GetQuestId());
quests << ",";
quests << ',';
}
}
}
@@ -516,10 +516,9 @@ void WorldSession::HandleStandStateChangeOpcode(WorldPacket & recv_data)
void WorldSession::HandleContactListOpcode(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_CONTACT_LIST");
uint32 unk;
recv_data >> unk;
sLog->outDebug(LOG_FILTER_NETWORKIO, "unk value is %u", unk);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_CONTACT_LIST - Unk: %d", unk);
_player->GetSocial()->SendSocialList(_player);
}
@@ -537,7 +536,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
if (!normalizePlayerName(friendName))
return;
CharacterDatabase.EscapeString(friendName); // prevent SQL injection - normal name don't must changed by this call
CharacterDatabase.EscapeString(friendName); // prevent SQL injection - normal name must not be changed by this call
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'",
GetPlayer()->GetName(), friendName.c_str());
@@ -626,7 +625,7 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket & recv_data)
if (!normalizePlayerName(IgnoreName))
return;
CharacterDatabase.EscapeString(IgnoreName); // prevent SQL injection - normal name don't must changed by this call
CharacterDatabase.EscapeString(IgnoreName); // prevent SQL injection - normal name must not be changed by this call
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to Ignore: '%s'",
GetPlayer()->GetName(), IgnoreName.c_str());
@@ -225,12 +225,12 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
do
{
Field *fields = result->Fetch();
ssInvalidPetitionGUIDs << "'" << fields[0].GetUInt32() << "' , ";
ssInvalidPetitionGUIDs << '\'' << fields[0].GetUInt32() << "' , ";
} while (result->NextRow());
}
// delete petitions with the same guid as this one
ssInvalidPetitionGUIDs << "'" << charter->GetGUIDLow() << "'";
ssInvalidPetitionGUIDs << '\'' << charter->GetGUIDLow() << '\'';
sLog->outDebug(LOG_FILTER_NETWORKIO, "Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str());
CharacterDatabase.EscapeString(name);
+1 -1
View File
@@ -45,7 +45,7 @@ void WorldLog::Initialize()
if (!logsDir.empty())
{
if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\'))
logsDir.append("/");
logsDir.push_back('/');
}
std::string logname = sConfig->GetStringDefault("WorldLogFile", "");
@@ -79,7 +79,6 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
std::ostringstream ss;
do
{
Field *fields = result->Fetch();
uint32 id = fields[0].GetUInt32();
@@ -92,7 +91,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
found = true;
}
else
ss << ", ";
ss << ',';
ss << id;
}
@@ -101,7 +100,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
if (found)
{
ss << ")";
ss << ')';
CharacterDatabase.Execute(ss.str().c_str());
}
}
+5 -5
View File
@@ -91,7 +91,7 @@ bool findnth(std::string &str, int n, std::string::size_type &s, std::string::si
do
{
e = str.find("'", s);
e = str.find('\'', s);
if (e == std::string::npos) return false;
} while (str[e-1] == '\\');
@@ -100,7 +100,7 @@ bool findnth(std::string &str, int n, std::string::size_type &s, std::string::si
do
{
s = e+4;
e = str.find("'", s);
e = str.find('\'', s);
if (e == std::string::npos) return false;
} while (str[e-1] == '\\');
}
@@ -202,14 +202,14 @@ std::string CreateDumpString(char const* tableName, QueryResult result)
Field *fields = result->Fetch();
for (uint32 i = 0; i < result->GetFieldCount(); ++i)
{
if (i == 0) ss << "'";
if (i == 0) ss << '\'';
else ss << ", '";
std::string s = fields[i].GetString();
CharacterDatabase.EscapeString(s);
ss << s;
ss << "'";
ss << '\'';
}
ss << ");";
return ss.str();
@@ -218,7 +218,7 @@ std::string CreateDumpString(char const* tableName, QueryResult result)
std::string PlayerDumpWriter::GenerateWhereStr(char const* field, uint32 guid)
{
std::ostringstream wherestr;
wherestr << field << " = '" << guid << "'";
wherestr << field << " = '" << guid << '\'';
return wherestr.str();
}
+1 -1
View File
@@ -1103,7 +1103,7 @@ void World::LoadConfigSettings(bool reload)
///- Read the "Data" directory from the config file
std::string dataPath = sConfig->GetStringDefault("DataDir", "./");
if (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\')
dataPath.append("/");
dataPath.push_back('/');
if (reload)
{
+3 -3
View File
@@ -101,7 +101,7 @@ public:
if (!tEntry)
return false;
whereClause << "WHERE id = '" << tEntry << "'";
whereClause << "WHERE id = '" << tEntry << '\'';
}
else
{
@@ -114,11 +114,11 @@ public:
{
std::string name = pParam1;
WorldDatabase.EscapeString(name);
whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name "_LIKE_" '" << name << "'";
whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name "_LIKE_" '" << name << '\'';
}
else
{
whereClause << "WHERE guid = '" << guid << "'";
whereClause << "WHERE guid = '" << guid << '\'';
}
}
//sLog->outError("DEBUG: %s", whereClause.c_str());
+2 -2
View File
@@ -254,13 +254,13 @@ public:
initString =false;
}
else
eventFilter << ", " << *itr;
eventFilter << ',' << *itr;
}
if (!initString)
eventFilter << "))";
else
eventFilter << ")";
eventFilter << ')';
result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, phaseMask, "
"(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
@@ -50,14 +50,14 @@ public:
{
mob_water_elementalAI(Creature* c) : ScriptedAI(c) {}
uint32 uiWaterBoltTimer;
uint64 uiBalindaGUID;
uint32 uiResetTimer;
uint32 waterBoltTimer;
uint64 balindaGUID;
uint32 resetTimer;
void Reset()
{
uiWaterBoltTimer = 3*IN_MILLISECONDS;
uiResetTimer = 5*IN_MILLISECONDS;
waterBoltTimer = 3*IN_MILLISECONDS;
resetTimer = 5*IN_MILLISECONDS;
}
void UpdateAI(const uint32 diff)
@@ -65,20 +65,20 @@ public:
if (!UpdateVictim())
return;
if (uiWaterBoltTimer < diff)
if (waterBoltTimer < diff)
{
DoCast(me->getVictim(), SPELL_WATERBOLT);
uiWaterBoltTimer = 5*IN_MILLISECONDS;
} else uiWaterBoltTimer -= diff;
waterBoltTimer = 5*IN_MILLISECONDS;
} else waterBoltTimer -= diff;
// check if creature is not outside of building
if (uiResetTimer < diff)
if (resetTimer < diff)
{
if (Creature* pBalinda = Unit::GetCreature(*me, uiBalindaGUID))
if (Creature* pBalinda = Unit::GetCreature(*me, balindaGUID))
if (me->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
EnterEvadeMode();
uiResetTimer = 5*IN_MILLISECONDS;
} else uiResetTimer -= diff;
resetTimer = 5*IN_MILLISECONDS;
} else resetTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -97,27 +97,27 @@ public:
struct boss_balindaAI : public ScriptedAI
{
boss_balindaAI(Creature* c) : ScriptedAI(c), Summons(me) {}
boss_balindaAI(Creature* c) : ScriptedAI(c), summons(me) {}
uint32 uiArcaneExplosionTimer;
uint32 uiConeOfColdTimer;
uint32 uiFireBoltTimer;
uint32 uiFrostboltTimer;
uint32 uiResetTimer;
uint32 uiWaterElementalTimer;
uint32 arcaneExplosionTimer;
uint32 coneOfColdTimer;
uint32 fireBoltTimer;
uint32 frostboltTimer;
uint32 resetTimer;
uint32 waterElementalTimer;
SummonList Summons;
SummonList summons;
void Reset()
{
uiArcaneExplosionTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
uiConeOfColdTimer = 8*IN_MILLISECONDS;
uiFireBoltTimer = 1*IN_MILLISECONDS;
uiFrostboltTimer = 4*IN_MILLISECONDS;
uiResetTimer = 5*IN_MILLISECONDS;
uiWaterElementalTimer = 0;
arcaneExplosionTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
coneOfColdTimer = 8*IN_MILLISECONDS;
fireBoltTimer = 1*IN_MILLISECONDS;
frostboltTimer = 4*IN_MILLISECONDS;
resetTimer = 5*IN_MILLISECONDS;
waterElementalTimer = 0;
Summons.DespawnAll();
summons.DespawnAll();
}
void EnterCombat(Unit* /*who*/)
@@ -132,15 +132,15 @@ public:
void JustSummoned(Creature* summoned)
{
CAST_AI(mob_water_elemental::mob_water_elementalAI, summoned->AI())->uiBalindaGUID = me->GetGUID();
CAST_AI(mob_water_elemental::mob_water_elementalAI, summoned->AI())->balindaGUID = me->GetGUID();
summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true));
summoned->setFaction(me->getFaction());
Summons.Summon(summoned);
summons.Summon(summoned);
}
void JustDied(Unit* /*Killer*/)
{
Summons.DespawnAll();
summons.DespawnAll();
}
void UpdateAI(const uint32 diff)
@@ -148,47 +148,47 @@ public:
if (!UpdateVictim())
return;
if (uiWaterElementalTimer < diff)
if (waterElementalTimer < diff)
{
if (Summons.empty())
if (summons.empty())
me->SummonCreature(NPC_WATER_ELEMENTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45*IN_MILLISECONDS);
uiWaterElementalTimer = 50*IN_MILLISECONDS;
} else uiWaterElementalTimer -= diff;
waterElementalTimer = 50*IN_MILLISECONDS;
} else waterElementalTimer -= diff;
if (uiArcaneExplosionTimer < diff)
if (arcaneExplosionTimer < diff)
{
DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION);
uiArcaneExplosionTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
} else uiArcaneExplosionTimer -= diff;
arcaneExplosionTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
} else arcaneExplosionTimer -= diff;
if (uiConeOfColdTimer < diff)
if (coneOfColdTimer < diff)
{
DoCast(me->getVictim(), SPELL_CONE_OF_COLD);
uiConeOfColdTimer = urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS);
} else uiConeOfColdTimer -= diff;
coneOfColdTimer = urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS);
} else coneOfColdTimer -= diff;
if (uiFireBoltTimer < diff)
if (fireBoltTimer < diff)
{
DoCast(me->getVictim(), SPELL_FIREBALL);
uiFireBoltTimer = urand(5*IN_MILLISECONDS, 9*IN_MILLISECONDS);
} else uiFireBoltTimer -= diff;
fireBoltTimer = urand(5*IN_MILLISECONDS, 9*IN_MILLISECONDS);
} else fireBoltTimer -= diff;
if (uiFrostboltTimer < diff)
if (frostboltTimer < diff)
{
DoCast(me->getVictim(), SPELL_FROSTBOLT);
uiFrostboltTimer = urand(4*IN_MILLISECONDS, 12*IN_MILLISECONDS);
} else uiFrostboltTimer -= diff;
frostboltTimer = urand(4*IN_MILLISECONDS, 12*IN_MILLISECONDS);
} else frostboltTimer -= diff;
// check if creature is not outside of building
if (uiResetTimer < diff)
if (resetTimer < diff)
{
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
{
EnterEvadeMode();
DoScriptText(YELL_EVADE, me);
}
uiResetTimer = 5*IN_MILLISECONDS;
} else uiResetTimer -= diff;
resetTimer = 5*IN_MILLISECONDS;
} else resetTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -204,4 +204,4 @@ void AddSC_boss_balinda()
{
new boss_balinda;
new mob_water_elemental;
};
};
@@ -265,8 +265,8 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
<< m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << GhostKillCount;
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' '
<< m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5] << ' ' << GhostKillCount;
str_data = saveStream.str();
@@ -170,9 +170,9 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
<< m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " "
<< m_auiEncounter[7] << " " << m_auiEncounter[8] << " " << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11];
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' '
<< m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5] << ' ' << m_auiEncounter[6] << ' '
<< m_auiEncounter[7] << ' ' << m_auiEncounter[8] << ' ' << m_auiEncounter[9] << ' ' << m_auiEncounter[10] << ' ' << m_auiEncounter[11];
strSaveData = saveStream.str();
@@ -181,7 +181,7 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3];
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
str_data = saveStream.str();
@@ -367,8 +367,8 @@ class instance_stratholme : public InstanceMapScript
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << EncounterState[0] << " " << EncounterState[1] << " " << EncounterState[2] << " "
<< EncounterState[3] << " " << EncounterState[4] << " " << EncounterState[5];
saveStream << EncounterState[0] << ' ' << EncounterState[1] << ' ' << EncounterState[2] << ' '
<< EncounterState[3] << ' ' << EncounterState[4] << ' ' << EncounterState[5];
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
@@ -273,8 +273,8 @@ public:
{
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " "
<< m_auiEncounter[4] << " " << m_auiEncounter[5];
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' '
<< m_auiEncounter[4] << ' ' << m_auiEncounter[5];
char* out = new char[stream.str().length() + 1];
strcpy(out, stream.str().c_str());
if (out)
@@ -377,7 +377,7 @@ class instance_uldaman : public InstanceMapScript
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2];
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2];
str_data = saveStream.str();
@@ -179,7 +179,7 @@ class instance_zulaman : public InstanceMapScript
std::string GetSaveData()
{
std::ostringstream ss;
ss << "S " << BossKilled << " " << ChestLooted << " " << QuestMinute;
ss << "S " << BossKilled << ' ' << ChestLooted << ' ' << QuestMinute;
char* data = new char[ss.str().length()+1];
strcpy(data, ss.str().c_str());
//sLog->outError("TSCR: Zul'aman saved, %s.", data);
@@ -267,10 +267,10 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
<< m_auiEncounter[3] << " " << m_auiEncounter[4]
<< " " << allianceRetreat << " " << hordeRetreat
<< " " << RaidDamage;
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' '
<< m_auiEncounter[3] << ' ' << m_auiEncounter[4]
<< ' ' << allianceRetreat << ' ' << hordeRetreat
<< ' ' << RaidDamage;
str_data = saveStream.str();
@@ -248,8 +248,8 @@ class instance_culling_of_stratholme : public InstanceMapScript
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "C S " << _encounterState[0] << " " << _encounterState[1] << " "
<< _encounterState[2] << " " << _encounterState[3] << " " << _encounterState[4];
saveStream << "C S " << _encounterState[0] << ' ' << _encounterState[1] << ' '
<< _encounterState[2] << ' ' << _encounterState[3] << ' ' << _encounterState[4];
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
@@ -60,7 +60,7 @@ public:
std::ostringstream saveStream;
saveStream << "T C " << m_auiEncounter[0]
<< " " << uiGongWaves;
<< ' ' << uiGongWaves;
str_data = saveStream.str();
@@ -108,9 +108,9 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
<< m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " "
<< m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8];
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' '
<< m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5] << ' '
<< m_auiEncounter[6] << ' ' << m_auiEncounter[7] << ' ' << m_auiEncounter[8];
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
@@ -164,7 +164,7 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "A N " << auiEncounter[0] << " " << auiEncounter[1] << " "
saveStream << "A N " << auiEncounter[0] << ' ' << auiEncounter[1] << ' '
<< auiEncounter[2];
OUT_SAVE_INST_DATA_COMPLETE;
@@ -249,9 +249,9 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "A K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
<< m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " "
<< spheres[0] << " " << spheres[1];
saveStream << "A K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' '
<< spheres[0] << ' ' << spheres[1];
str_data = saveStream.str();
@@ -60,8 +60,8 @@ enum eSpells
enum eModels
{
MODEL_SKELETON = 29846,
MODEL_GHOST = 21300
MODEL_SKELETON = 29846,
MODEL_GHOST = 21300
};
enum ePhases
@@ -325,7 +325,7 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
{
if (target && target->isAlive())
DoCast(target, (SPELL_LEAP));
DoCast(target, (SPELL_LEAP));
}
uiAttackTimer = 3500;
} else uiAttackTimer -= uiDiff;
@@ -286,11 +286,11 @@ public:
std::ostringstream saveStream;
saveStream << "T C " << m_auiEncounter[0]
<< " " << m_auiEncounter[1]
<< " " << m_auiEncounter[2]
<< " " << m_auiEncounter[3]
<< " " << uiGrandChampionsDeaths
<< " " << uiMovementDone;
<< ' ' << m_auiEncounter[1]
<< ' ' << m_auiEncounter[2]
<< ' ' << m_auiEncounter[3]
<< ' ' << uiGrandChampionsDeaths
<< ' ' << uiMovementDone;
str_data = saveStream.str();
@@ -284,7 +284,7 @@ public:
switch (uiId)
{
case 0: // JUMP!? Fuck! THAT'S BEEZARR! Would someone PLEASE make MotionMaster->Move* work better?
case 0:
if (m_bTargetDied)
me->DespawnOrUnsummon();
break;
@@ -728,7 +728,7 @@ public:
switch (uiId)
{
case 0: // JUMP!? Fuck! THAT'S BEEZARR! Would someone PLEASE make MotionMaster->Move* work better?
case 0:
if (me->GetDistance2d(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()) < 6.0f)
{
// Middle of the room
@@ -619,7 +619,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
std::ostringstream saveStream;
for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
saveStream << EncounterStatus[i] << " ";
saveStream << EncounterStatus[i] << ' ';
saveStream << TrialCounter;
SaveDataBuffer = saveStream.str();
@@ -191,8 +191,8 @@ public:
std::string str_data;
std::ostringstream saveStream;
saveStream << "D K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
<< m_auiEncounter[2] << " " << m_auiEncounter[3];
saveStream << "D K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3];
str_data = saveStream.str();
@@ -274,7 +274,7 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "H R 1 " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2];
saveStream << "H R 1 " << uiEncounter[0] << ' ' << uiEncounter[1] << ' ' << uiEncounter[2];
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
@@ -366,11 +366,11 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "G D " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
<< m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " "
<< (uiSladRanStatue ? GetObjState(uiSladRanStatue) : GO_STATE_ACTIVE) << " " << (uiMoorabiStatue ? GetObjState(uiMoorabiStatue) : GO_STATE_ACTIVE) << " "
<< (uiDrakkariColossusStatue ? GetObjState(uiDrakkariColossusStatue) : GO_STATE_ACTIVE) << " " << (uiGalDarahStatue ? GetObjState(uiGalDarahStatue) : GO_STATE_READY) << " "
<< (uiBridge ? GetObjState(uiBridge) : GO_STATE_ACTIVE) << " " << (uiCollision ? GetObjState(uiCollision) : GO_STATE_READY);
saveStream << "G D " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' '
<< (uiSladRanStatue ? GetObjState(uiSladRanStatue) : GO_STATE_ACTIVE) << ' ' << (uiMoorabiStatue ? GetObjState(uiMoorabiStatue) : GO_STATE_ACTIVE) << ' '
<< (uiDrakkariColossusStatue ? GetObjState(uiDrakkariColossusStatue) : GO_STATE_ACTIVE) << ' ' << (uiGalDarahStatue ? GetObjState(uiGalDarahStatue) : GO_STATE_READY) << ' '
<< (uiBridge ? GetObjState(uiBridge) : GO_STATE_ACTIVE) << ' ' << (uiCollision ? GetObjState(uiCollision) : GO_STATE_READY);
str_data = saveStream.str();
@@ -1013,8 +1013,8 @@ class instance_icecrown_citadel : public InstanceMapScript
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "I C " << GetBossSaveData() << HeroicAttempts << " "
<< ColdflameJetsState << " " << BloodQuickeningState << " " << BloodQuickeningMinutes;
saveStream << "I C " << GetBossSaveData() << HeroicAttempts << ' '
<< ColdflameJetsState << ' ' << BloodQuickeningState << ' ' << BloodQuickeningMinutes;
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
@@ -371,7 +371,7 @@ public:
std::string GetSaveData()
{
std::ostringstream saveStream;
saveStream << GetBossSaveData() << " " << gothikDoorState;
saveStream << GetBossSaveData() << ' ' << gothikDoorState;
return saveStream.str();
}
@@ -206,7 +206,7 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' '
<< m_auiEncounter[3];
strInstData = saveStream.str();
@@ -210,8 +210,8 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "H L " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
<< m_auiEncounter[2] << " " << m_auiEncounter[3];
saveStream << "H L " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3];
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
@@ -225,7 +225,7 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "H S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3];
saveStream << "H S " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
str_data = saveStream.str();
@@ -261,8 +261,8 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "U K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
<< m_auiEncounter[2] << " " << forge_event[0] << " " << forge_event[1] << " " << forge_event[2];
saveStream << "U K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << forge_event[0] << ' ' << forge_event[1] << ' ' << forge_event[2];
str_data = saveStream.str();
@@ -211,8 +211,8 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "U P " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
<< m_auiEncounter[2] << " " << m_auiEncounter[3];
saveStream << "U P " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3];
str_data = saveStream.str();
@@ -617,10 +617,10 @@ public:
std::ostringstream saveStream;
saveStream << "V H " << (uint16)m_auiEncounter[0]
<< " " << (uint16)m_auiEncounter[1]
<< " " << (uint16)m_auiEncounter[2]
<< " " << (uint16)uiFirstBoss
<< " " << (uint16)uiSecondBoss;
<< ' ' << (uint16)m_auiEncounter[1]
<< ' ' << (uint16)m_auiEncounter[2]
<< ' ' << (uint16)uiFirstBoss
<< ' ' << (uint16)uiSecondBoss;
str_data = saveStream.str();
@@ -144,12 +144,10 @@ public:
// TODO: Find better way to handle emote
// Emote
std::string *emote = new std::string(EMOTE_FOCUSES_ON);
emote->append(target->GetName());
emote->append("!");
const char* text = emote->c_str();
me->MonsterTextEmote(text, 0, true);
delete emote;
std::string emote(EMOTE_FOCUSES_ON);
emote.append(target->GetName());
emote.push_back('!');
me->MonsterTextEmote(emote.c_str(), 0, true);
}
FocusFire_Timer = 15000+(rand()%5000);
} else FocusFire_Timer -= diff;
@@ -167,8 +167,8 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
<< m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4];
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4];
str_data = saveStream.str();
@@ -284,10 +284,10 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
<< m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]
<< " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " << m_auiEncounter[7]
<< " " << m_auiEncounter[8];
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4]
<< ' ' << m_auiEncounter[5] << ' ' << m_auiEncounter[6] << ' ' << m_auiEncounter[7]
<< ' ' << m_auiEncounter[8];
str_data = saveStream.str();
@@ -383,8 +383,8 @@ class instance_serpent_shrine : public InstanceMapScript
{
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
<< m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << TrashCount;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' '
<< m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5] << ' ' << TrashCount;
OUT_SAVE_INST_DATA_COMPLETE;
return stream.str();
}
@@ -200,7 +200,7 @@ public:
{
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3];
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
char* out = new char[stream.str().length() + 1];
strcpy(out, stream.str().c_str());
if (out)
@@ -100,9 +100,12 @@ public:
{
case 184468:
MaulgarDoor = go->GetGUID();
if (m_auiEncounter[0] == DONE) HandleGameObject(0, true, go);
if (m_auiEncounter[0] == DONE)
HandleGameObject(0, true, go);
break;
case 184662:
GruulDoor = go->GetGUID();
break;
case 184662: GruulDoor = go->GetGUID(); break;
}
}
@@ -159,7 +162,7 @@ public:
{
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << m_auiEncounter[0] << " " << m_auiEncounter[1];
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1];
char* out = new char[stream.str().length() + 1];
strcpy(out, stream.str().c_str());
if (out)
@@ -94,44 +94,49 @@ class instance_blood_furnace : public InstanceMapScript
{
switch(creature->GetEntry())
{
case 17381: The_MakerGUID = creature->GetGUID(); break;
case 17380: BroggokGUID = creature->GetGUID(); break;
case 17377: Kelidan_The_BreakerGUID = creature->GetGUID(); break;
case 17381:
The_MakerGUID = creature->GetGUID();
break;
case 17380:
BroggokGUID = creature->GetGUID();
break;
case 17377:
Kelidan_The_BreakerGUID = creature->GetGUID();
break;
}
}
void OnGameObjectCreate(GameObject* go)
{
if (go->GetEntry() == 181766) //Final exit door
Door1GUID = go->GetGUID();
if (go->GetEntry() == 181811) //The Maker Front door
Door2GUID = go->GetGUID();
if (go->GetEntry() == 181812) //The Maker Rear door
Door3GUID = go->GetGUID();
if (go->GetEntry() == 181822) //Broggok Front door
Door4GUID = go->GetGUID();
if (go->GetEntry() == 181819) //Broggok Rear door
Door5GUID = go->GetGUID();
if (go->GetEntry() == 181823) //Kelidan exit door
Door6GUID = go->GetGUID();
if (go->GetEntry() == 181766) //Final exit door
Door1GUID = go->GetGUID();
if (go->GetEntry() == 181811) //The Maker Front door
Door2GUID = go->GetGUID();
if (go->GetEntry() == 181812) //The Maker Rear door
Door3GUID = go->GetGUID();
if (go->GetEntry() == 181822) //Broggok Front door
Door4GUID = go->GetGUID();
if (go->GetEntry() == 181819) //Broggok Rear door
Door5GUID = go->GetGUID();
if (go->GetEntry() == 181823) //Kelidan exit door
Door6GUID = go->GetGUID();
if (go->GetEntry() == 181813) //The Maker prison cell front right
PrisonCell1GUID = go->GetGUID();
if (go->GetEntry() == 181814) //The Maker prison cell back right
PrisonCell2GUID = go->GetGUID();
if (go->GetEntry() == 181816) //The Maker prison cell front left
PrisonCell3GUID = go->GetGUID();
if (go->GetEntry() == 181815) //The Maker prison cell back left
PrisonCell4GUID = go->GetGUID();
if (go->GetEntry() == 181821) //Broggok prison cell front right
PrisonCell5GUID = go->GetGUID();
if (go->GetEntry() == 181818) //Broggok prison cell back right
PrisonCell6GUID = go->GetGUID();
if (go->GetEntry() == 181820) //Broggok prison cell front left
PrisonCell7GUID = go->GetGUID();
if (go->GetEntry() == 181817) //Broggok prison cell back left
PrisonCell8GUID = go->GetGUID();
if (go->GetEntry() == 181813) //The Maker prison cell front right
PrisonCell1GUID = go->GetGUID();
if (go->GetEntry() == 181814) //The Maker prison cell back right
PrisonCell2GUID = go->GetGUID();
if (go->GetEntry() == 181816) //The Maker prison cell front left
PrisonCell3GUID = go->GetGUID();
if (go->GetEntry() == 181815) //The Maker prison cell back left
PrisonCell4GUID = go->GetGUID();
if (go->GetEntry() == 181821) //Broggok prison cell front right
PrisonCell5GUID = go->GetGUID();
if (go->GetEntry() == 181818) //Broggok prison cell back right
PrisonCell6GUID = go->GetGUID();
if (go->GetEntry() == 181820) //Broggok prison cell front left
PrisonCell7GUID = go->GetGUID();
if (go->GetEntry() == 181817) //Broggok prison cell back left
PrisonCell8GUID = go->GetGUID();
}
uint64 GetData64(uint32 data)
@@ -174,7 +179,7 @@ class instance_blood_furnace : public InstanceMapScript
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2];
saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2];
str_data = saveStream.str();
@@ -165,7 +165,7 @@ class instance_the_eye : public InstanceMapScript
{
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3];
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
char* out = new char[stream.str().length() + 1];
strcpy(out, stream.str().c_str());
if (out)
@@ -340,12 +340,12 @@ std::string MySQLPreparedStatement::getQueryString(const char *query)
pos = queryString.find("?", pos);
std::stringstream replace;
replace << "'";
replace << '\'';
switch (m_stmt->statement_data[i].type)
{
case TYPE_BOOL:
replace << (m_stmt->statement_data[i].data.boolean ? "1" : "0");
replace << (m_stmt->statement_data[i].data.boolean ? '1' : '0');
break;
case TYPE_UI8:
case TYPE_UI16:
@@ -373,7 +373,7 @@ std::string MySQLPreparedStatement::getQueryString(const char *query)
replace << m_stmt->statement_data[i].str;
break;
}
replace << "'";
replace << '\'';
queryString.replace(pos, 1, replace.str());
}
+2 -2
View File
@@ -120,7 +120,7 @@ void Log::Initialize()
m_logsDir = sConfig->GetStringDefault("LogsDir", "");
if (!m_logsDir.empty())
if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
m_logsDir.append("/");
m_logsDir.push_back('/');
m_logsTimestamp = "_" + GetTimestampStr();
@@ -183,7 +183,7 @@ void Log::Initialize()
m_dumpsDir = sConfig->GetStringDefault("CharLogDump.SeparateDir", "");
if (!m_dumpsDir.empty())
if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\'))
m_dumpsDir.append("/");
m_dumpsDir.push_back('/');
}
}
+5 -5
View File
@@ -182,7 +182,7 @@ uint32 TimeStringToSecs(const std::string& timestring)
uint32 buffer = 0;
uint32 multiplier = 0;
for (std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); itr++ )
for (std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); ++itr)
{
if(isdigit(*itr))
{
@@ -318,11 +318,11 @@ bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr)
{
try
{
size_t len = utf8::distance(utf8str.c_str(), utf8str.c_str()+utf8str.size());
wstr.resize(len);
if (len)
if (size_t len = utf8::distance(utf8str.c_str(), utf8str.c_str()+utf8str.size()))
{
wstr.resize(len);
utf8::utf8to16(utf8str.c_str(), utf8str.c_str()+utf8str.size(), &wstr[0]);
}
}
catch(std::exception)
{