[Zoning] Fix zone routing edge case (#4255)

* [Zoning] Fix zone routing edge case

* Push
This commit is contained in:
Chris Miles 2024-04-15 07:50:38 -05:00 committed by GitHub
parent 2538ee7976
commit ff3e955804
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 5 deletions

View File

@ -357,3 +357,13 @@ WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id
return WorldContentService::FindZoneResult{.zone_id = 0};
}
bool WorldContentService::IsInPublicStaticInstance(uint32 instance_id)
{
for (auto &i: m_zone_instances) {
if (i.id == instance_id) {
return true;
}
}
return false;
}

View File

@ -178,6 +178,8 @@ public:
};
FindZoneResult FindZone(uint32 zone_id, uint32 instance_id);
bool IsInPublicStaticInstance(uint32 instance_id);
private:
int current_expansion{};
std::vector<ContentFlagsRepository::ContentFlags> content_flags;

View File

@ -755,11 +755,6 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
pZoneName = strcpy(new char[zd->long_name.length() + 1], zd->long_name.c_str());
}
// If we are zoning to the same zone, we need to use the current instance ID if it is not specified.
if (zoneID == zone->GetZoneID() && instance_id == 0) {
instance_id = zone->GetInstanceID();
}
auto r = content_service.FindZone(zoneID, instance_id);
if (r.zone_id) {
zoneID = r.zone_id;
@ -776,6 +771,11 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
ignorerestrictions,
static_cast<int>(zm)
);
// If we are zoning to the same zone, we need to use the current instance ID if it is not specified.
if (content_service.IsInPublicStaticInstance(instance_id) && zoneID == zone->GetZoneID() && instance_id == 0) {
instance_id = zone->GetInstanceID();
}
}
LogInfo(