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) if(typemask & TYPEMASK_PLAYER)
{ {
obj = FindPlayer(guid); obj = FindPlayer(guid);
if(obj) return obj; if(obj)
return obj;
} }
if(typemask & TYPEMASK_UNIT) if(typemask & TYPEMASK_UNIT)
{ {
obj = GetCreatureOrPetOrVehicle(p,guid); obj = GetCreatureOrPetOrVehicle(p,guid);
if(obj) return obj; if(obj)
return obj;
} }
if(typemask & TYPEMASK_GAMEOBJECT) if(typemask & TYPEMASK_GAMEOBJECT)
{ {
obj = p.GetMap()->GetGameObject(guid); obj = p.GetMap()->GetGameObject(guid);
if(obj) return obj; if(obj)
return obj;
} }
if(typemask & TYPEMASK_DYNAMICOBJECT) if(typemask & TYPEMASK_DYNAMICOBJECT)
{ {
obj = p.GetMap()->GetDynamicObject(guid); obj = p.GetMap()->GetDynamicObject(guid);
if(obj) return obj; if(obj)
return obj;
} }
if(typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER) if(typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER)
{ {
obj = ((Player const &)p).GetItemByGuid( guid ); obj = ((Player const &)p).GetItemByGuid( guid );
if(obj) return obj; if(obj)
return obj;
} }
return NULL; return NULL;
@ -262,7 +267,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse)
CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); 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; 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(); corpse->RemoveFromWorld();
i_player2corpse.erase(iter); i_player2corpse.erase(iter);
@ -281,7 +286,7 @@ ObjectAccessor::AddCorpse(Corpse *corpse)
CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); 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; 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 void
@ -289,19 +294,19 @@ ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* ma
{ {
Guard guard(i_corpseGuard); Guard guard(i_corpseGuard);
for(Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter) 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) // verify, if the corpse in our instance (add only corpses which are)
if (map->Instanceable()) if (map->Instanceable())
{ {
if (iter->second->GetInstanceId() == map->GetInstanceId()) if (iter->second->GetInstanceId() == map->GetInstanceId())
{ {
grid.AddWorldObject(iter->second,iter->second->GetGUID()); grid.AddWorldObject(iter->second, iter->second->GetGUID());
} }
} }
else 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 // remove corpse from player_guid -> corpse map
RemoveCorpse(corpse); 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 // do not load the map if it's not loaded
Map *map = MapManager::Instance().FindMap(corpse->GetMapId(), corpse->GetInstanceId()); 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 // remove corpse from DB
corpse->DeleteFromDB(); corpse->DeleteFromDB();
@ -342,7 +348,7 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
bones = new Corpse; bones = new Corpse;
bones->Create(corpse->GetGUIDLow()); 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->SetUInt32Value(i, corpse->GetUInt32Value(i));
bones->SetGrid(corpse->GetGrid()); 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->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
bones->SetMapId(corpse->GetMapId()); bones->SetMapId(corpse->GetMapId());
bones->SetInstanceId(corpse->GetInstanceId()); 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->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES);
bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0); 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)) if(corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0); bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
@ -422,7 +428,7 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj)
CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
Cell cell(p); Cell cell(p);
obj->GetMap()->UpdateObjectVisibility(obj,cell,p); obj->GetMap()->UpdateObjectVisibility(obj, cell, p);
} }
void ObjectAccessor::UpdateVisibilityForPlayer( Player* player ) void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
@ -431,8 +437,8 @@ void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
Cell cell(p); Cell cell(p);
Map* m = player->GetMap(); Map* m = player->GetMap();
m->UpdatePlayerVisibility(player,cell,p); m->UpdatePlayerVisibility(player, cell, p);
m->UpdateObjectsVisibilityFor(player,cell,p); m->UpdateObjectsVisibilityFor(player, cell, p);
} }
/// Define the static member of HashMapHolder /// Define the static member of HashMapHolder