mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Misc: Fixed some more issues found by code analysis tools.
This commit is contained in:
@@ -75,6 +75,8 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
|
||||
}
|
||||
}
|
||||
|
||||
// Intended duplicated check, the code above this should select a victim
|
||||
// If it can't find a suitable attack target then we should error out.
|
||||
if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim())
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_GENERAL, "DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
|
||||
|
||||
@@ -2407,6 +2407,8 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
||||
mapSave = sInstanceSaveMgr->AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true);
|
||||
}
|
||||
|
||||
ASSERT(mapSave);
|
||||
|
||||
// check for existing instance binds
|
||||
InstancePlayerBind* playerBind = player->GetBoundInstance(GetId(), Difficulty(GetSpawnMode()));
|
||||
if (playerBind && playerBind->perm)
|
||||
@@ -2441,10 +2443,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
||||
if (groupBind->save != mapSave)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
|
||||
if (mapSave)
|
||||
TC_LOG_ERROR(LOG_FILTER_MAPS, "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
|
||||
else
|
||||
TC_LOG_ERROR(LOG_FILTER_MAPS, "MapSave NULL");
|
||||
TC_LOG_ERROR(LOG_FILTER_MAPS, "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
|
||||
if (groupBind->save)
|
||||
TC_LOG_ERROR(LOG_FILTER_MAPS, "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
|
||||
else
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
if (Creature* pBalinda = Unit::GetCreature(*me, balindaGUID))
|
||||
if (me->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
|
||||
EnterEvadeMode();
|
||||
resetTimer = 5 * IN_MILLISECONDS;
|
||||
resetTimer = 5 * IN_MILLISECONDS;
|
||||
} else resetTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
|
||||
@@ -34,13 +34,11 @@ bool FileLoader::loadFile(char *filename, bool log)
|
||||
data_size = mf.getSize();
|
||||
|
||||
data = new uint8 [data_size];
|
||||
if (data)
|
||||
{
|
||||
mf.read(data, data_size);
|
||||
mf.close();
|
||||
if (prepareLoadedData())
|
||||
return true;
|
||||
}
|
||||
mf.read(data, data_size);
|
||||
mf.close();
|
||||
if (prepareLoadedData())
|
||||
return true;
|
||||
|
||||
printf("Error loading %s", filename);
|
||||
mf.close();
|
||||
free();
|
||||
|
||||
@@ -571,19 +571,7 @@ namespace MMAP
|
||||
|
||||
// merge per tile poly and detail meshes
|
||||
rcPolyMesh** pmmerge = new rcPolyMesh*[TILES_PER_MAP * TILES_PER_MAP];
|
||||
if (!pmmerge)
|
||||
{
|
||||
printf("%s alloc pmmerge FIALED!\n", tileString);
|
||||
return;
|
||||
}
|
||||
|
||||
rcPolyMeshDetail** dmmerge = new rcPolyMeshDetail*[TILES_PER_MAP * TILES_PER_MAP];
|
||||
if (!dmmerge)
|
||||
{
|
||||
printf("%s alloc dmmerge FIALED!\n", tileString);
|
||||
return;
|
||||
}
|
||||
|
||||
int nmerge = 0;
|
||||
// build all tiles
|
||||
for (int y = 0; y < TILES_PER_MAP; ++y)
|
||||
@@ -678,12 +666,9 @@ namespace MMAP
|
||||
rcFreeContourSet(tile.cset);
|
||||
tile.cset = NULL;
|
||||
|
||||
if (tile.pmesh)
|
||||
{
|
||||
pmmerge[nmerge] = tile.pmesh;
|
||||
dmmerge[nmerge] = tile.dmesh;
|
||||
nmerge++;
|
||||
}
|
||||
pmmerge[nmerge] = tile.pmesh;
|
||||
dmmerge[nmerge] = tile.dmesh;
|
||||
nmerge++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user