Core/Misc: Multiple static analysis issues fixed (small optimizations and clear code)
This commit is contained in:
1 parent
e6b7de8c97
commit
cefcde9ba9
40 files changed
+72
-84
No files matched your search
@@ -775,7 +775,7 @@ public:
|
||||
if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
|
||||
return false;
|
||||
|
||||
if (strcmp(password, passwordConfirmation))
|
||||
if (strcmp(password, passwordConfirmation) != 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
|
||||
handler->SetSentErrorMessage(true);
|
||||
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
std::string type;
|
||||
parsedStream >> type;
|
||||
|
||||
if (type == "")
|
||||
if (type.empty())
|
||||
break;
|
||||
|
||||
if (type == "uint8")
|
||||
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
{
|
||||
Guild* guild = nullptr;
|
||||
|
||||
if (args && strlen(args) > 0)
|
||||
if (args && args[0] != '\0')
|
||||
{
|
||||
if (isNumeric(args))
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
uint16 counter = 0;
|
||||
uint16 MapId = 0;
|
||||
|
||||
if (strcmp(map, "all"))
|
||||
if (strcmp(map, "all") != 0)
|
||||
{
|
||||
MapId = uint16(atoi(map));
|
||||
if (!MapId)
|
||||
|
||||
@@ -199,10 +199,12 @@ public:
|
||||
else
|
||||
handler->PSendSysMessage(LANG_GPS_NO_VMAP);
|
||||
|
||||
char const* unknown = handler->GetTrinityString(LANG_UNKNOWN);
|
||||
|
||||
handler->PSendSysMessage(LANG_MAP_POSITION,
|
||||
mapId, (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)),
|
||||
zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)),
|
||||
areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)),
|
||||
mapId, (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : unknown),
|
||||
zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : unknown),
|
||||
areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : unknown),
|
||||
object->GetPhaseMask(),
|
||||
object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
|
||||
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
|
||||
@@ -1711,7 +1713,9 @@ public:
|
||||
}
|
||||
|
||||
if (target)
|
||||
handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)), (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
|
||||
handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale],
|
||||
(!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)),
|
||||
(!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
|
||||
|
||||
// Output XVII. - XVIX. if they are not empty
|
||||
if (!guildName.empty())
|
||||
@@ -2187,7 +2191,7 @@ public:
|
||||
{
|
||||
Player* target = NULL;
|
||||
|
||||
if (args && strlen(args) > 0)
|
||||
if (args && args[0] != '\0')
|
||||
{
|
||||
target = sObjectAccessor->FindPlayerByName(args);
|
||||
if (!target)
|
||||
|
||||
@@ -681,7 +681,7 @@ public:
|
||||
}
|
||||
|
||||
creature->AI()->SetData(data_1, data_2);
|
||||
std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
|
||||
std::string AIorScript = !creature->GetAIName().empty() ? "AI type: " + creature->GetAIName() : (!creature->GetScriptName().empty() ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
|
||||
handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID().GetCounter(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, NULL);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
player->StoreNewItem(dest, 11522, 1, true);
|
||||
player->StoreNewItem(dest, 11522, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -196,7 +196,7 @@ class boss_anubarak_trial : public CreatureScript
|
||||
std::list<Creature*> FrostSphereList;
|
||||
me->GetCreatureListWithEntryInGrid(FrostSphereList, NPC_FROST_SPHERE, 150.0f);
|
||||
if (!FrostSphereList.empty())
|
||||
for (std::list<Creature*>::iterator itr = FrostSphereList.begin(); itr != FrostSphereList.end(); itr++)
|
||||
for (std::list<Creature*>::iterator itr = FrostSphereList.begin(); itr != FrostSphereList.end(); ++itr)
|
||||
(*itr)->DespawnOrUnsummon();
|
||||
|
||||
_burrowGUID.clear();
|
||||
@@ -243,7 +243,7 @@ class boss_anubarak_trial : public CreatureScript
|
||||
me->GetCreatureListWithEntryInGrid(AddList, NPC_FROST_SPHERE, 150.0f);
|
||||
me->GetCreatureListWithEntryInGrid(AddList, NPC_BURROWER, 150.0f);
|
||||
if (!AddList.empty())
|
||||
for (std::list<Creature*>::iterator itr = AddList.begin(); itr != AddList.end(); itr++)
|
||||
for (std::list<Creature*>::iterator itr = AddList.begin(); itr != AddList.end(); ++itr)
|
||||
(*itr)->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ class instance_ulduar : public InstanceMapScript
|
||||
_algalonSummoned = false;
|
||||
_summonAlgalon = false;
|
||||
|
||||
memset(_summonObservationRingKeeper, false, sizeof(_summonObservationRingKeeper));
|
||||
memset(_summonYSKeeper, false, sizeof(_summonYSKeeper));
|
||||
memset(_summonObservationRingKeeper, 0, sizeof(_summonObservationRingKeeper));
|
||||
memset(_summonYSKeeper, 0, sizeof(_summonYSKeeper));
|
||||
}
|
||||
|
||||
void FillInitialWorldStates(WorldPacket& packet) override
|
||||
|
||||
@@ -459,7 +459,7 @@ public:
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30658, 1, NULL);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
player->StoreNewItem(dest, 30658, 1, true);
|
||||
player->StoreNewItem(dest, 30658, true);
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
}
|
||||
}
|
||||
@@ -469,7 +469,7 @@ public:
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30659, 1, NULL);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
player->StoreNewItem(dest, 30659, 1, true);
|
||||
player->StoreNewItem(dest, 30659, true);
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user