mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Core/Misc: Fix issues reported by static analysis
Coverity defect IDs: 1023115
This commit is contained in:
@@ -370,28 +370,13 @@ public:
|
||||
|
||||
uint32 lowGuid = atoi((char*)guidStr);
|
||||
|
||||
Creature* creature = NULL;
|
||||
|
||||
/* FIXME: impossible without entry
|
||||
if (lowguid)
|
||||
creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), MAKE_GUID(lowguid, HIGHGUID_UNIT));
|
||||
*/
|
||||
|
||||
// attempt check creature existence by DB data
|
||||
if (!creature)
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(lowGuid);
|
||||
if (!data)
|
||||
{
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(lowGuid);
|
||||
if (!data)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowGuid);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// obtain real GUID for DB operations
|
||||
lowGuid = creature->GetDBTableGUIDLow();
|
||||
handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowGuid);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
int wait = waitStr ? atoi(waitStr) : 0;
|
||||
@@ -407,18 +392,6 @@ public:
|
||||
|
||||
WorldDatabase.Execute(stmt);
|
||||
|
||||
if (creature && creature->GetWaypointPath())
|
||||
{
|
||||
creature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
|
||||
creature->GetMotionMaster()->Initialize();
|
||||
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
|
||||
{
|
||||
creature->setDeathState(JUST_DIED);
|
||||
creature->Respawn(true);
|
||||
}
|
||||
creature->SaveToDB();
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_WAYPOINT_ADDED);
|
||||
|
||||
return true;
|
||||
@@ -830,34 +803,22 @@ public:
|
||||
|
||||
lowguid = atoi(cId);
|
||||
|
||||
/* FIXME: impossible without entry
|
||||
if (lowguid)
|
||||
creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), MAKE_GUID(lowguid, HIGHGUID_UNIT));
|
||||
*/
|
||||
|
||||
// Attempting creature load from DB data
|
||||
if (!creature)
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
|
||||
if (!data)
|
||||
{
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
|
||||
if (!data)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 map_id = data->mapid;
|
||||
|
||||
if (handler->GetSession()->GetPlayer()->GetMapId() != map_id)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_CREATUREATSAMEMAP, lowguid);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
uint32 map_id = data->mapid;
|
||||
|
||||
if (handler->GetSession()->GetPlayer()->GetMapId() != map_id)
|
||||
{
|
||||
lowguid = creature->GetDBTableGUIDLow();
|
||||
handler->PSendSysMessage(LANG_COMMAND_CREATUREATSAMEMAP, lowguid);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user