mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[12206] Let GetMapEntranceTrigger and GetGoBackTrigger work in a better defined order
Actually as this is still no total order (and it is basicly impossible to define a reasonable total order for areatrigger_teleport) it is not well defined, but probably good enough for all cases
This commit is contained in:
parent
e27c72311a
commit
824aa5429e
3 changed files with 41 additions and 9 deletions
|
|
@ -5714,16 +5714,21 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const
|
|||
if (!mapEntry || mapEntry->ghost_entrance_map < 0)
|
||||
return NULL;
|
||||
|
||||
AreaTrigger const* compareTrigger = NULL;
|
||||
for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr)
|
||||
{
|
||||
if (itr->second.target_mapId == uint32(mapEntry->ghost_entrance_map))
|
||||
{
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
|
||||
if (atEntry && atEntry->mapid == map_id)
|
||||
return &itr->second;
|
||||
if (!compareTrigger || itr->second.IsLessOrEqualThan(compareTrigger))
|
||||
{
|
||||
if (itr->second.IsMinimal())
|
||||
return &itr->second;
|
||||
|
||||
compareTrigger = &itr->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return compareTrigger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -5731,16 +5736,32 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const
|
|||
*/
|
||||
AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const
|
||||
{
|
||||
AreaTrigger const* compareTrigger = NULL;
|
||||
MapEntry const* mEntry = sMapStore.LookupEntry(Map);
|
||||
|
||||
for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr)
|
||||
{
|
||||
if (itr->second.target_mapId == Map)
|
||||
{
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
|
||||
if (atEntry)
|
||||
return &itr->second;
|
||||
if (mEntry->Instanceable())
|
||||
{
|
||||
// Remark that IsLessOrEqualThan is no total order, and a->IsLeQ(b) != !b->IsLeQ(a)
|
||||
if (!compareTrigger || compareTrigger->IsLessOrEqualThan(&itr->second))
|
||||
compareTrigger = &itr->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!compareTrigger || itr->second.IsLessOrEqualThan(compareTrigger))
|
||||
{
|
||||
if (itr->second.IsMinimal())
|
||||
return &itr->second;
|
||||
|
||||
compareTrigger = &itr->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return compareTrigger;
|
||||
}
|
||||
|
||||
void ObjectMgr::PackGroupIds()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue