Various Cleanups (game L-M)

This commit is contained in:
Schmoozerd 2012-07-19 21:46:40 +02:00
parent 2bd41afb3e
commit 8d0c106aa4
29 changed files with 2201 additions and 2163 deletions

View file

@ -594,7 +594,8 @@ bool ChatHandler::HandleGoCreatureCommand(char* args)
FindCreatureData worker(0, m_session ? m_session->GetPlayer() : NULL);
do {
do
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
@ -604,7 +605,8 @@ bool ChatHandler::HandleGoCreatureCommand(char* args)
worker(*cr_data);
} while (result->NextRow());
}
while (result->NextRow());
delete result;
@ -741,7 +743,8 @@ bool ChatHandler::HandleGoObjectCommand(char* args)
FindGOData worker(0, m_session ? m_session->GetPlayer() : NULL);
do {
do
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
@ -751,7 +754,8 @@ bool ChatHandler::HandleGoObjectCommand(char* args)
worker(*go_data);
} while (result->NextRow());
}
while (result->NextRow());
delete result;
@ -852,7 +856,8 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
pool_id = sPoolMgr.IsPartOfAPool<GameObject>(lowguid);
if (!pool_id || pl->GetMap()->GetPersistentState()->IsSpawnedPoolObject<GameObject>(lowguid))
found = true;
} while (result->NextRow() && (!found));
}
while (result->NextRow() && (!found));
delete result;
@ -1192,7 +1197,8 @@ bool ChatHandler::HandleGameObjectNearCommand(char* args)
PSendSysMessage(LANG_GO_MIXED_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), entry, guid, gInfo->name, x, y, z, mapid);
++count;
} while (result->NextRow());
}
while (result->NextRow());
delete result;
}
@ -2919,7 +2925,8 @@ bool ChatHandler::HandleWpAddCommand(char* args)
Field* fields = result->Fetch();
lowguid = fields[0].GetUInt32();
point = fields[1].GetUInt32();
} while (result->NextRow());
}
while (result->NextRow());
delete result;
CreatureData const* data = sObjectMgr.GetCreatureData(lowguid);
@ -3565,7 +3572,8 @@ bool ChatHandler::HandleWpShowCommand(char* args)
for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i)
PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, i+1, textid[i], (textid[i] ? GetMangosString(textid[i]) : ""));
} while (result->NextRow());
}
while (result->NextRow());
// Cleanup memory
delete result;
return true;
@ -3605,7 +3613,8 @@ bool ChatHandler::HandleWpShowCommand(char* args)
pCreature->AddObjectToRemoveList();
}
} while (result2->NextRow());
}
while (result2->NextRow());
delete result2;
if (hasError)
{
@ -3644,7 +3653,8 @@ bool ChatHandler::HandleWpShowCommand(char* args)
wpCreature->LoadFromDB(wpCreature->GetGUIDLow(),map);
map->Add(wpCreature);
//wpCreature->GetMap()->Add(wpCreature);
} while (result->NextRow());
}
while (result->NextRow());
// Cleanup memory
delete result;
@ -3762,7 +3772,8 @@ bool ChatHandler::HandleWpShowCommand(char* args)
pCreature->DeleteFromDB();
pCreature->AddObjectToRemoveList();
}
}while(result->NextRow());
}
while (result->NextRow());
// set "wpguid" column to "empty" - no visual waypoint spawned
WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid=0 WHERE wpguid <> 0");
@ -3894,7 +3905,8 @@ bool ChatHandler::HandleWpExportCommand(char *args)
outfile << fields[14].GetUInt32(); // textid5
outfile << ");\n ";
} while (result->NextRow());
}
while (result->NextRow());
delete result;
PSendSysMessage(LANG_WAYPOINT_EXPORTED);
@ -4535,7 +4547,8 @@ bool ChatHandler::ShowAccountListHelper(QueryResult* result, uint32* limit, bool
PSendSysMessage(LANG_ACCOUNT_LIST_LINE_CONSOLE,
account,fields[1].GetString(),char_name,fields[2].GetString(),fields[3].GetUInt32(),fields[4].GetUInt32());
}while(result->NextRow());
}
while (result->NextRow());
delete result;
@ -4639,7 +4652,8 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, uint32* limit)
else
delete chars;
}
} while(result->NextRow());
}
while (result->NextRow());
delete result;

View file

@ -2787,7 +2787,8 @@ bool ChatHandler::HandleListItemCommand(char* args)
PSendSysMessage(LANG_ITEMLIST_SLOT,
item_guid,owner_name.c_str(),owner_guid,owner_acc,item_pos);
} while (result->NextRow());
}
while (result->NextRow());
uint32 res_count = uint32(result->GetRowCount());
@ -2837,7 +2838,8 @@ bool ChatHandler::HandleListItemCommand(char* args)
PSendSysMessage(LANG_ITEMLIST_MAIL,
item_guid,item_s_name.c_str(),item_s,item_s_acc,item_r_name.c_str(),item_r,item_r_acc,item_pos);
} while (result->NextRow());
}
while (result->NextRow());
uint32 res_count = uint32(result->GetRowCount());
@ -2882,7 +2884,8 @@ bool ChatHandler::HandleListItemCommand(char* args)
char const* item_pos = "[in auction]";
PSendSysMessage(LANG_ITEMLIST_AUCTION, item_guid, owner_name.c_str(), owner, owner_acc,item_pos);
} while (result->NextRow());
}
while (result->NextRow());
delete result;
}
@ -2914,7 +2917,8 @@ bool ChatHandler::HandleListItemCommand(char* args)
char const* item_pos = "[in guild bank]";
PSendSysMessage(LANG_ITEMLIST_GUILD,item_guid,guild_name.c_str(),guild_guid,item_pos);
} while (result->NextRow());
}
while (result->NextRow());
uint32 res_count = uint32(result->GetRowCount());
@ -2999,7 +3003,8 @@ bool ChatHandler::HandleListObjectCommand(char* args)
PSendSysMessage(LANG_GO_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), guid, gInfo->name, x, y, z, mapid);
else
PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), gInfo->name, x, y, z, mapid);
} while (result->NextRow());
}
while (result->NextRow());
delete result;
}
@ -3069,7 +3074,8 @@ bool ChatHandler::HandleListCreatureCommand(char* args)
PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), guid, cInfo->Name, x, y, z, mapid);
else
PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), cInfo->Name, x, y, z, mapid);
} while (result->NextRow());
}
while (result->NextRow());
delete result;
}
@ -4673,7 +4679,8 @@ bool ChatHandler::HandleAuctionItemCommand(char* args)
auctionHouse->AddAuction(auctionHouseEntry, newItem, etime, price, buyout);
} while (item_count);
}
while (item_count);
return true;
}
@ -5661,7 +5668,8 @@ bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
std::string bantime = permanent?GetMangosString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true);
PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
fields[0].GetString(), bantime.c_str(), active ? GetMangosString(LANG_BANINFO_YES):GetMangosString(LANG_BANINFO_NO), fields[4].GetString(), fields[5].GetString());
}while (result->NextRow());
}
while (result->NextRow());
delete result;
return true;
@ -5768,7 +5776,8 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
PSendSysMessage("%s",fields2[0].GetString());
delete banresult;
}
} while (result->NextRow());
}
while (result->NextRow());
}
// Console wide output
else
@ -5816,10 +5825,12 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min,
fields2[2].GetString(),fields2[3].GetString());
}
}while ( banInfo->NextRow() );
}
while (banInfo->NextRow());
delete banInfo;
}
}while( result->NextRow() );
}
while (result->NextRow());
SendSysMessage("===============================================================================");
}
@ -5864,7 +5875,8 @@ bool ChatHandler::HandleBanListIPCommand(char* args)
{
Field* fields = result->Fetch();
PSendSysMessage("%s",fields[0].GetString());
} while (result->NextRow());
}
while (result->NextRow());
}
// Console wide output
else
@ -5893,7 +5905,8 @@ bool ChatHandler::HandleBanListIPCommand(char* args)
aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min,
fields[3].GetString(), fields[4].GetString());
}
}while( result->NextRow() );
}
while (result->NextRow());
SendSysMessage("===============================================================================");
}
@ -6583,7 +6596,8 @@ bool ChatHandler::HandleGMListFullCommand(char* /*args*/)
{
Field* fields = result->Fetch();
PSendSysMessage("|%15s|%6s|", fields[0].GetString(),fields[1].GetString());
}while( result->NextRow() );
}
while (result->NextRow());
PSendSysMessage("========================");
delete result;
@ -6651,7 +6665,8 @@ bool ChatHandler::ShowPlayerListHelper(QueryResult* result, uint32* limit, bool
else
PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CHAT, guid, name.c_str(), name.c_str(), race_name, class_name, level);
}while( result->NextRow() );
}
while (result->NextRow());
delete result;
}

View file

@ -386,7 +386,8 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
go->SetLootState(GO_JUST_DEACTIVATED);
}
else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
{ // The fishing hole used once more
{
// The fishing hole used once more
go->AddUse(); // if the max usage is reached, will be despawned at next tick
if (go->GetUseCount() >= urand(go->GetGOInfo()->fishinghole.minSuccessOpens,go->GetGOInfo()->fishinghole.maxSuccessOpens))
{

View file

@ -27,7 +27,8 @@
#include "DBCStores.h"
#include "SQLStorages.h"
static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] = {
static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] =
{
CONFIG_FLOAT_RATE_DROP_ITEM_POOR, // ITEM_QUALITY_POOR
CONFIG_FLOAT_RATE_DROP_ITEM_NORMAL, // ITEM_QUALITY_NORMAL
CONFIG_FLOAT_RATE_DROP_ITEM_UNCOMMON, // ITEM_QUALITY_UNCOMMON
@ -165,7 +166,8 @@ void LootStore::LoadLootTable()
tab->second->AddEntry(storeitem);
++count;
} while (result->NextRow());
}
while (result->NextRow());
delete result;

View file

@ -839,7 +839,8 @@ uint32 Map::GetMaxPlayers() const
if (mapDiff->maxPlayers || IsRegularDifficulty()) // Normal case (expect that regular difficulty always have correct maxplayers)
return mapDiff->maxPlayers;
else // DBC have 0 maxplayers for heroic instances with expansion < 2
{ // The heroic entry exists, so we don't have to check anything, simply return normal max players
{
// The heroic entry exists, so we don't have to check anything, simply return normal max players
MapDifficulty const* normalDiff = GetMapDifficultyData(i_id, REGULAR_DIFFICULTY);
return normalDiff ? normalDiff->maxPlayers : 0;
}

View file

@ -434,7 +434,8 @@ void DungeonResetScheduler::LoadResetTimes()
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty);
SetResetTimeFor(mapid,difficulty,newresettime);
} while(result->NextRow());
}
while (result->NextRow());
delete result;
}
@ -723,7 +724,8 @@ void MapPersistentStateManager::_DelHelper(DatabaseType &db, const char *fields,
ss << (i != 0 ? " AND " : "") << fieldTokens[i] << " = '" << fieldValue << "'";
}
db.PExecute("DELETE FROM %s WHERE %s", table, ss.str().c_str());
} while (result->NextRow());
}
while (result->NextRow());
delete result;
}
}
@ -994,7 +996,8 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
++count;
} while (result->NextRow());
}
while (result->NextRow());
delete result;
@ -1060,7 +1063,8 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
++count;
} while (result->NextRow());
}
while (result->NextRow());
delete result;

View file

@ -61,7 +61,8 @@ struct MassMailerQueryHandler
Field* fields = result->Fetch();
recievers.insert(fields[0].GetUInt32());
} while (result->NextRow());
}
while (result->NextRow());
delete result;
}
} massMailerQueryHandler;