Apply style fix

This commit is contained in:
Antz 2020-01-10 23:13:44 +00:00
parent 5531a0087d
commit 35405dd549
155 changed files with 10968 additions and 3660 deletions

View file

@ -59,13 +59,19 @@ Unit*
ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid guid)
{
if (!guid)
{ return NULL; }
{
return NULL;
}
if (guid.IsPlayer())
{ return FindPlayer(guid); }
{
return FindPlayer(guid);
}
if (!u.IsInWorld())
{ return NULL; }
{
return NULL;
}
return u.GetMap()->GetAnyTypeCreature(guid);
}
@ -74,9 +80,13 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
{
Corpse* ret = HashMapHolder<Corpse>::Find(guid);
if (!ret)
{ return NULL; }
{
return NULL;
}
if (ret->GetMapId() != mapid)
{ return NULL; }
{
return NULL;
}
return ret;
}
@ -84,11 +94,15 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
Player* ObjectAccessor::FindPlayer(ObjectGuid guid, bool inWorld /*= true*/)
{
if (!guid)
{ return NULL; }
{
return NULL;
}
Player* plr = HashMapHolder<Player>::Find(guid);
if (!plr || (!plr->IsInWorld() && inWorld))
{ return NULL; }
{
return NULL;
}
return plr;
}
@ -99,7 +113,9 @@ Player* ObjectAccessor::FindPlayerByName(const char* name)
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
for (HashMapHolder<Player>::MapType::iterator iter = m.begin(); iter != m.end(); ++iter)
if (iter->second->IsInWorld() && (::strcmp(name, iter->second->GetName()) == 0))
{ return iter->second; }
{
return iter->second;
}
return NULL;
}
@ -130,7 +146,9 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid)
Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid);
if (iter == i_player2corpse.end())
{ return NULL; }
{
return NULL;
}
MANGOS_ASSERT(iter->second->GetType() != CORPSE_BONES);
return iter->second;
@ -145,7 +163,9 @@ ObjectAccessor::RemoveCorpse(Corpse* corpse)
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGuid());
if (iter == i_player2corpse.end())
{ return; }
{
return;
}
// build mapid*cellid -> guid_set map
CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY());
@ -218,7 +238,9 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia)
// do not load the map if it's not loaded
Map* map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId());
if (map)
{ map->Remove(corpse, false); }
{
map->Remove(corpse, false);
}
// remove corpse from DB
corpse->DeleteFromDB();
@ -250,7 +272,9 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia)
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
{ bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0); }
{
bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
}
}
// add bones in grid store if grid loaded where corpse placed
@ -273,7 +297,9 @@ void ObjectAccessor::RemoveOldCorpses()
++next;
if (!itr->second->IsExpired(now))
{ continue; }
{
continue;
}
ConvertCorpseForPlayer(itr->first);
}