Applied coding style.

This commit is contained in:
tomrus88 2009-06-07 21:37:49 +04:00
parent f874c86052
commit 8b5d67338f

View file

@ -90,31 +90,36 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u
if(typemask & TYPEMASK_PLAYER)
{
obj = FindPlayer(guid);
if(obj) return obj;
if(obj)
return obj;
}
if(typemask & TYPEMASK_UNIT)
{
obj = GetCreatureOrPetOrVehicle(p,guid);
if(obj) return obj;
if(obj)
return obj;
}
if(typemask & TYPEMASK_GAMEOBJECT)
{
obj = p.GetMap()->GetGameObject(guid);
if(obj) return obj;
if(obj)
return obj;
}
if(typemask & TYPEMASK_DYNAMICOBJECT)
{
obj = p.GetMap()->GetDynamicObject(guid);
if(obj) return obj;
if(obj)
return obj;
}
if(typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER)
{
obj = ((Player const &)p).GetItemByGuid( guid );
if(obj) return obj;
if(obj)
return obj;
}
return NULL;
@ -262,7 +267,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse)
CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY());
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
objmgr.DeleteCorpseCellData(corpse->GetMapId(),cell_id,corpse->GetOwnerGUID());
objmgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID());
corpse->RemoveFromWorld();
i_player2corpse.erase(iter);
@ -281,7 +286,7 @@ ObjectAccessor::AddCorpse(Corpse *corpse)
CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY());
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
objmgr.AddCorpseCellData(corpse->GetMapId(),cell_id,corpse->GetOwnerGUID(),corpse->GetInstanceId());
objmgr.AddCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID(), corpse->GetInstanceId());
}
void
@ -289,19 +294,19 @@ ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* ma
{
Guard guard(i_corpseGuard);
for(Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter)
if(iter->second->GetGrid()==gridpair)
if(iter->second->GetGrid() == gridpair)
{
// verify, if the corpse in our instance (add only corpses which are)
if (map->Instanceable())
{
if (iter->second->GetInstanceId() == map->GetInstanceId())
{
grid.AddWorldObject(iter->second,iter->second->GetGUID());
grid.AddWorldObject(iter->second, iter->second->GetGUID());
}
}
else
{
grid.AddWorldObject(iter->second,iter->second->GetGUID());
grid.AddWorldObject(iter->second, iter->second->GetGUID());
}
}
}
@ -323,10 +328,11 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
// remove corpse from player_guid -> corpse map
RemoveCorpse(corpse);
// remove resurrectble corpse from grid object registry (loaded state checked into call)
// remove resurrectable corpse from grid object registry (loaded state checked into call)
// do not load the map if it's not loaded
Map *map = MapManager::Instance().FindMap(corpse->GetMapId(), corpse->GetInstanceId());
if(map) map->Remove(corpse,false);
if(map)
map->Remove(corpse, false);
// remove corpse from DB
corpse->DeleteFromDB();
@ -342,7 +348,7 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
bones = new Corpse;
bones->Create(corpse->GetGUIDLow());
for (int i = 3; i < CORPSE_END; i++) // don't overwrite guid and object type
for (int i = 3; i < CORPSE_END; ++i) // don't overwrite guid and object type
bones->SetUInt32Value(i, corpse->GetUInt32Value(i));
bones->SetGrid(corpse->GetGrid());
@ -352,12 +358,12 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
bones->SetMapId(corpse->GetMapId());
bones->SetInstanceId(corpse->GetInstanceId());
bones->SetPhaseMask(corpse->GetPhaseMask(),false);
bones->SetPhaseMask(corpse->GetPhaseMask(), false);
bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES);
bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0);
for (int i = 0; i < EQUIPMENT_SLOT_END; i++)
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if(corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
@ -422,7 +428,7 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj)
CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
Cell cell(p);
obj->GetMap()->UpdateObjectVisibility(obj,cell,p);
obj->GetMap()->UpdateObjectVisibility(obj, cell, p);
}
void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
@ -431,8 +437,8 @@ void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
Cell cell(p);
Map* m = player->GetMap();
m->UpdatePlayerVisibility(player,cell,p);
m->UpdateObjectsVisibilityFor(player,cell,p);
m->UpdatePlayerVisibility(player, cell, p);
m->UpdateObjectsVisibilityFor(player, cell, p);
}
/// Define the static member of HashMapHolder