Core: Cleanup.

This commit is contained in:
Chaplain
2011-08-30 23:09:39 +03:00
parent 5d0a2b6094
commit f5a668ae8d
12 changed files with 27 additions and 37 deletions
@@ -520,7 +520,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId
if (selectionWeights)
{
if (!selectionWeights->size())
if (selectionWeights->empty())
return NULL;
uint32 Weight = 0;
uint32 selectedWeight = 0;
@@ -122,7 +122,7 @@ class BattlegroundMgr
bool isTesting() const { return m_Testing; }
static bool IsArenaType(BattlegroundTypeId bgTypeId);
static bool IsBattlegroundType(BattlegroundTypeId bgTypeId) { return !BattlegroundMgr::IsArenaType(bgTypeId); }
static bool IsBattlegroundType(BattlegroundTypeId bgTypeId) { return !IsArenaType(bgTypeId); }
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType);
static BattlegroundTypeId BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId);
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId);
@@ -377,7 +377,6 @@ void Channel::UnBan(uint64 good, const char *badname)
void Channel::Password(uint64 p, const char *pass)
{
std::string plName;
uint32 sec = 0;
Player *plr = ObjectAccessor::FindPlayer(p);
if (plr)
+1 -1
View File
@@ -743,7 +743,7 @@ LfgProposal* LFGMgr::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
return NULL;
// Try to match with queued groups
while (!pProposal && all.size() > 0)
while (!pProposal && !all.empty())
{
check.push_back(all.front());
all.pop_front();
+2 -6
View File
@@ -282,11 +282,7 @@ public:
return false;
}
std::string password_old = old_pass;
std::string password_new = new_pass;
std::string password_new_c = new_pass_c;
if (!sAccountMgr->CheckPassword(handler->GetSession()->GetAccountId(), password_old))
if (!sAccountMgr->CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass)))
{
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
handler->SetSentErrorMessage(true);
@@ -300,7 +296,7 @@ public:
return false;
}
AccountOpResult result = sAccountMgr->ChangePassword(handler->GetSession()->GetAccountId(), password_new);
AccountOpResult result = sAccountMgr->ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass));
switch(result)
{
case AOR_OK:
+6 -8
View File
@@ -1012,20 +1012,19 @@ public:
handler->PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
return false;
}
uint32 iValue;
float fValue;
bool isint32 = true;
if (pz)
isint32 = (bool)atoi(pz);
if (isint32)
{
iValue = (uint32)atoi(py);
uint32 iValue = (uint32)atoi(py);
target->SetUInt32Value(Opcode , iValue);
handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue);
}
else
{
fValue = (float)atof(py);
float fValue = (float)atof(py);
target->SetFloatValue(Opcode , fValue);
handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue);
}
@@ -1060,20 +1059,19 @@ public:
handler->PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
return false;
}
uint32 iValue;
float fValue;
bool isint32 = true;
if (pz)
isint32 = (bool)atoi(pz);
if (isint32)
{
iValue = target->GetUInt32Value(Opcode);
uint32 iValue = target->GetUInt32Value(Opcode);
handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue);
}
else
{
fValue = target->GetFloatValue(Opcode);
float fValue = target->GetFloatValue(Opcode);
handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue);
}
+8 -12
View File
@@ -199,7 +199,7 @@ public:
}
static bool HandleWpUnLoadCommand(ChatHandler* handler, const char* /*args*/)
{
uint32 guidlow = 0;
Creature* target = handler->getSelectedCreature();
if (!target)
@@ -208,11 +208,13 @@ public:
return true;
}
uint32 guidlow = target->GetDBTableGUIDLow();
if (target->GetCreatureAddon())
{
if (target->GetCreatureAddon()->path_id != 0)
{
WorldDatabase.PExecute("DELETE FROM creature_addon WHERE guid = %u", target->GetGUIDLow());
WorldDatabase.PExecute("DELETE FROM creature_addon WHERE guid = %u", guidlow);
target->UpdateWaypointID(0);
WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", IDLE_MOTION_TYPE, guidlow);
target->LoadPath(0);
@@ -373,8 +375,6 @@ public:
return true;
}
float coord;
if (arg_str_2 == "setid")
{
uint32 newid = atoi(arg_3);
@@ -394,33 +394,29 @@ public:
if (arg_str_2 == "posx")
{
coord = (float)(atof(arg_3));
WorldDatabase.PExecute("UPDATE waypoint_scripts SET x='%f' WHERE guid='%u'",
coord, id);
(float)(atof(arg_3)), id);
handler->PSendSysMessage("|cff00ff00Waypoint script:|r|cff00ffff %u|r|cff00ff00 position_x updated.|r", id);
return true;
}
else if (arg_str_2 == "posy")
{
coord = (float)(atof(arg_3));
WorldDatabase.PExecute("UPDATE waypoint_scripts SET y='%f' WHERE guid='%u'",
coord, id);
(float)(atof(arg_3)), id);
handler->PSendSysMessage("|cff00ff00Waypoint script: %u position_y updated.|r", id);
return true;
}
else if (arg_str_2 == "posz")
{
coord = (float)(atof(arg_3));
WorldDatabase.PExecute("UPDATE waypoint_scripts SET z='%f' WHERE guid='%u'",
coord, id);
(float)(atof(arg_3)), id);
handler->PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 position_z updated.|r", id);
return true;
}
else if (arg_str_2 == "orientation")
{
coord = (float)(atof(arg_3));
WorldDatabase.PExecute("UPDATE waypoint_scripts SET o='%f' WHERE guid='%u'",
coord, id);
(float)(atof(arg_3)), id);
handler->PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 orientation updated.|r", id);
return true;
}
@@ -189,7 +189,7 @@ public:
std::vector<Unit*> targets;
std::list<HostileReference *> t_list = me->getThreatManager().getThreatList();
if (!t_list.size())
if (t_list.empty())
return;
//store the threat list in a different container
+1 -1
View File
@@ -490,7 +490,7 @@ public:
if (Wave_Timer <= diff)
{
if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill)
if (Wave < 6 && AffrayChallenger[Wave] && !EventBigWill)
{
DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, me);
Creature* creature = Unit::GetCreature((*me), AffrayChallenger[Wave]);
@@ -204,12 +204,11 @@ class mob_corrupted_soul_fragment : public CreatureScript
if (type != TARGETED_MOTION_TYPE)
return;
uint64 BronjahmGUID = 0;
if (instance)
{
if (TempSummon* summ = me->ToTempSummon())
{
BronjahmGUID = instance->GetData64(DATA_BRONJAHM);
uint64 BronjahmGUID = instance->GetData64(DATA_BRONJAHM);
if (GUID_LOPART(BronjahmGUID) != id)
return;
@@ -78,6 +78,7 @@ class instance_ulduar : public InstanceMapScript
// Miscellaneous
uint32 TeamInInstance;
uint32 HodirRareCacheData;
uint32 ColossusData;
uint8 elderCount;
bool conSpeedAtory;
@@ -117,6 +118,7 @@ class instance_ulduar : public InstanceMapScript
ArchivumDoorGUID = 0;
TeamInInstance = 0;
HodirRareCacheData = 0;
ColossusData = 0;
elderCount = 0;
conSpeedAtory = false;
@@ -473,7 +475,7 @@ class instance_ulduar : public InstanceMapScript
switch (type)
{
case DATA_COLOSSUS:
Encounter[DATA_COLOSSUS] = data;
ColossusData = data;
if (data == 2)
{
if (Creature* Leviathan = instance->GetCreature(LeviathanGUID))
@@ -589,7 +591,7 @@ class instance_ulduar : public InstanceMapScript
switch (type)
{
case DATA_COLOSSUS:
return Encounter[type];
return ColossusData;
case DATA_HODIR_RARE_CACHE:
return HodirRareCacheData;
default:
@@ -132,7 +132,7 @@ class boss_void_reaver : public CreatureScript
target = NULL;
}
if (target_list.size())
if (!target_list.empty())
target = *(target_list.begin()+rand()%target_list.size());
else
target = me->getVictim();