[Expeditions] Cleanup client dz safe return methods (#1300)

This changes Zone::GetDynamicZone to return a pointer instead of a copy
and also lets DynamicZone be forward declared in zone.h
This commit is contained in:
hg
2021-03-19 00:42:20 -04:00
committed by GitHub
parent 739b975cad
commit ee4af65268
5 changed files with 21 additions and 30 deletions
+4 -4
View File
@@ -2729,20 +2729,20 @@ bool Zone::IsZone(uint32 zone_id, uint16 instance_id) const
return (zoneid == zone_id && instanceid == instance_id);
}
DynamicZone Zone::GetDynamicZone()
DynamicZone* Zone::GetDynamicZone()
{
if (GetInstanceID() == 0)
{
return {}; // invalid
return nullptr;
}
auto expedition = Expedition::FindCachedExpeditionByZoneInstance(GetZoneID(), GetInstanceID());
if (expedition)
{
return expedition->GetDynamicZone();
return &expedition->GetDynamicZone();
}
// todo: tasks, missions, and quests with an associated dz for this instance id
return {}; // invalid
return nullptr;
}