void ObjectAccessor::RemoveCorpse(Corpse* corpse) { ASSERT(corpse && corpse->GetType() != CORPSE_BONES); /// @todo more works need to be done for corpse and other world object if (Map* map = corpse->FindMap()) { corpse->DestroyForNearbyPlayers(); if (corpse->IsInGrid()) map->RemoveFromMap(corpse, false); else { corpse->RemoveFromWorld(); corpse->ResetMap(); } } else corpse->RemoveFromWorld(); // Critical section { TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID()); if (iter == i_player2corpse.end()) /// @todo Fix this return; // build mapid*cellid -> guid_set map CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), GUID_LOPART(corpse->GetOwnerGUID())); i_player2corpse.erase(iter); } }
void ObjectAccessor::RemoveCorpse(Corpse* corpse) { ASSERT(corpse && corpse->GetType() != CORPSE_BONES); if (Map* map = corpse->FindMap()) { corpse->DestroyForNearbyPlayers(); map->RemoveFromMap(corpse, false); } else corpse->RemoveFromWorld(); // Critical section { TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID()); if (iter == i_player2corpse.end()) // TODO: Fix this return; // build mapid*cellid -> guid_set map CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); uint32 cell_id = (cellCoord.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID())); i_player2corpse.erase(iter); } }
void ObjectAccessor::AddCorpse(Corpse* corpse) { ASSERT(corpse && corpse->GetType() != CORPSE_BONES); // Critical section { TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end()); i_player2corpse[corpse->GetOwnerGUID()] = corpse; // build mapid*cellid -> guid_set map CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); sObjectMgr->AddCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), GUID_LOPART(corpse->GetOwnerGUID()), corpse->GetInstanceId()); } }
VehicleSeatEntry const* Vehicle::GetSeatForPassenger(Unit const* passenger) { if (!passenger) return NULL; // Critical section { TRINITY_WRITE_GUARD(LockType, i_lock); SeatMap::iterator itr; for (itr = Seats.begin(); itr != Seats.end(); ++itr) { if (itr->second.Passenger == passenger->GetGUID()) return itr->second.SeatInfo; } } return NULL; }