mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[11138] Make sure GameEvent/Pool systems work with static instance object guids
* Pool System for correct full power work in instance need implement
MapPersistentState local pool system state for instanceable maps.
Unit this not implemented pool system must avoid creating/despawn/touch
instance map objects. Currently this work because instance map object use
dynamic generated guids and "invisible" for Pool System, with explcitly forbiden
for it spawn directly new objects. Code changes add explicit checks for preserve
this way work for time when instance object will use static guids. When local pool
state storing in persistent state this protection checks will possible drop.
Non-instanced working cases converted in local map object search calls.
* GameEvent Systems currently have code that work correctly only with objects at
non-instanced maps by same reasons as Pool System. But in different Pool System
case game event activate/deactivate expected applied to _all_ object copies in all
existed instanceable map copies. Code modified for work in expected way.
Direct spawn disabled for instanceable maps until swith to static guids.
Despawn code will make affect only for non-instanceavble maps unit swithc to static guids as-is.
This is preserve current code working result.
* Convert last case usage global creature search in aura code to map local case.
Player case also possible not need now after including caster damage/heal mods
part to aura base damage/heal. In any cases player case preserved in old way work.
NOTE: this last places dependent from global creature/gameobject guid search so look like this
make possible start direct work to switch instances use static guids instead dynamic generated
This commit is contained in:
parent
47060fe4b1
commit
9a8a74c2ad
8 changed files with 231 additions and 65 deletions
|
|
@ -1701,4 +1701,57 @@ bool GameObject::IsInSkillupList(Player* player) const
|
|||
void GameObject::AddToSkillupList(Player* player)
|
||||
{
|
||||
m_SkillupSet.insert(player->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
|
||||
struct AddGameObjectToRemoveListInMapsWorker
|
||||
{
|
||||
AddGameObjectToRemoveListInMapsWorker(ObjectGuid guid) : i_guid(guid) {}
|
||||
|
||||
void operator() (Map* map)
|
||||
{
|
||||
if (GameObject* pGameobject = map->GetGameObject(i_guid))
|
||||
pGameobject->AddObjectToRemoveList();
|
||||
}
|
||||
|
||||
ObjectGuid i_guid;
|
||||
};
|
||||
|
||||
void GameObject::AddToRemoveListInMaps(uint32 db_guid, GameObjectData const* data)
|
||||
{
|
||||
AddGameObjectToRemoveListInMapsWorker worker(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, db_guid));
|
||||
sMapMgr.DoForAllMapsWithMapId(data->mapid, worker);
|
||||
}
|
||||
|
||||
struct SpawnGameObjectInMapsWorker
|
||||
{
|
||||
SpawnGameObjectInMapsWorker(uint32 guid, GameObjectData const* data)
|
||||
: i_guid(guid), i_data(data) {}
|
||||
|
||||
void operator() (Map* map)
|
||||
{
|
||||
// Spawn if necessary (loaded grids only)
|
||||
if (map->IsLoaded(i_data->posX, i_data->posY))
|
||||
{
|
||||
GameObject* pGameobject = new GameObject;
|
||||
//DEBUG_LOG("Spawning gameobject %u", *itr);
|
||||
if (!pGameobject->LoadFromDB(i_guid, map))
|
||||
{
|
||||
delete pGameobject;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pGameobject->isSpawnedByDefault())
|
||||
map->Add(pGameobject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 i_guid;
|
||||
GameObjectData const* i_data;
|
||||
};
|
||||
|
||||
void GameObject::SpawnInMaps(uint32 db_guid, GameObjectData const* data)
|
||||
{
|
||||
SpawnGameObjectInMapsWorker worker(db_guid, data);
|
||||
sMapMgr.DoForAllMapsWithMapId(data->mapid, worker);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue