mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-18 07:11:29 +00:00
[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:
parent
739b975cad
commit
ee4af65268
@ -9901,23 +9901,22 @@ std::unique_ptr<EQApplicationPacket> Client::CreateCompassPacket(
|
|||||||
return outapp;
|
return outapp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::GoToDzSafeReturnOrBind(const DynamicZone& dynamic_zone)
|
void Client::GoToDzSafeReturnOrBind(const DynamicZone* dynamic_zone)
|
||||||
{
|
{
|
||||||
auto safereturn = dynamic_zone.GetSafeReturnLocation();
|
if (dynamic_zone)
|
||||||
LogDynamicZonesDetail(
|
|
||||||
"Sending character [{}] to safereturn zone [{}] or bind", CharacterID(), safereturn.zone_id
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!dynamic_zone.IsValid() || safereturn.zone_id == 0)
|
|
||||||
{
|
{
|
||||||
GoToBind();
|
auto safereturn = dynamic_zone->GetSafeReturnLocation();
|
||||||
}
|
if (safereturn.zone_id != 0)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
LogDynamicZonesDetail("Sending [{}] to safereturn zone [{}]", CharacterID(), safereturn.zone_id);
|
||||||
MovePC(safereturn.zone_id, 0, safereturn.x, safereturn.y, safereturn.z, safereturn.heading);
|
MovePC(safereturn.zone_id, 0, safereturn.x, safereturn.y, safereturn.z, safereturn.heading);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GoToBind();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<DynamicZone*> Client::GetDynamicZones(uint32_t zone_id, int zone_version)
|
std::vector<DynamicZone*> Client::GetDynamicZones(uint32_t zone_id, int zone_version)
|
||||||
{
|
{
|
||||||
std::vector<DynamicZone*> client_dzs;
|
std::vector<DynamicZone*> client_dzs;
|
||||||
|
|||||||
@ -1352,7 +1352,7 @@ public:
|
|||||||
void DzListTimers();
|
void DzListTimers();
|
||||||
void SetDzRemovalTimer(bool enable_timer);
|
void SetDzRemovalTimer(bool enable_timer);
|
||||||
void SendDzCompassUpdate();
|
void SendDzCompassUpdate();
|
||||||
void GoToDzSafeReturnOrBind(const DynamicZone& dynamic_zone);
|
void GoToDzSafeReturnOrBind(const DynamicZone* dynamic_zone);
|
||||||
void MovePCDynamicZone(uint32 zone_id, int zone_version = -1, bool msg_if_invalid = true);
|
void MovePCDynamicZone(uint32 zone_id, int zone_version = -1, bool msg_if_invalid = true);
|
||||||
void MovePCDynamicZone(const std::string& zone_name, int zone_version = -1, bool msg_if_invalid = true);
|
void MovePCDynamicZone(const std::string& zone_name, int zone_version = -1, bool msg_if_invalid = true);
|
||||||
std::vector<DynamicZone*> GetDynamicZones(uint32_t zone_id = 0, int zone_version = -1);
|
std::vector<DynamicZone*> GetDynamicZones(uint32_t zone_id = 0, int zone_version = -1);
|
||||||
|
|||||||
@ -5251,16 +5251,7 @@ std::unordered_map<uint16, Mob *> &EntityList::GetCloseMobList(Mob *mob, float d
|
|||||||
|
|
||||||
void EntityList::GateAllClientsToSafeReturn()
|
void EntityList::GateAllClientsToSafeReturn()
|
||||||
{
|
{
|
||||||
DynamicZone dz;
|
DynamicZone* dz = zone ? zone->GetDynamicZone() : nullptr;
|
||||||
if (zone)
|
|
||||||
{
|
|
||||||
dz = zone->GetDynamicZone();
|
|
||||||
|
|
||||||
LogDynamicZones(
|
|
||||||
"Sending all clients in zone: [{}] instance: [{}] to dz safereturn or bind",
|
|
||||||
zone->GetZoneID(), zone->GetInstanceID()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& client_list_iter : client_list)
|
for (const auto& client_list_iter : client_list)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2729,20 +2729,20 @@ bool Zone::IsZone(uint32 zone_id, uint16 instance_id) const
|
|||||||
return (zoneid == zone_id && instanceid == instance_id);
|
return (zoneid == zone_id && instanceid == instance_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicZone Zone::GetDynamicZone()
|
DynamicZone* Zone::GetDynamicZone()
|
||||||
{
|
{
|
||||||
if (GetInstanceID() == 0)
|
if (GetInstanceID() == 0)
|
||||||
{
|
{
|
||||||
return {}; // invalid
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto expedition = Expedition::FindCachedExpeditionByZoneInstance(GetZoneID(), GetInstanceID());
|
auto expedition = Expedition::FindCachedExpeditionByZoneInstance(GetZoneID(), GetInstanceID());
|
||||||
if (expedition)
|
if (expedition)
|
||||||
{
|
{
|
||||||
return expedition->GetDynamicZone();
|
return &expedition->GetDynamicZone();
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: tasks, missions, and quests with an associated dz for this instance id
|
// todo: tasks, missions, and quests with an associated dz for this instance id
|
||||||
|
|
||||||
return {}; // invalid
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,10 +33,11 @@
|
|||||||
#include "spawn2.h"
|
#include "spawn2.h"
|
||||||
#include "spawngroup.h"
|
#include "spawngroup.h"
|
||||||
#include "aa_ability.h"
|
#include "aa_ability.h"
|
||||||
#include "dynamic_zone.h"
|
|
||||||
#include "pathfinder_interface.h"
|
#include "pathfinder_interface.h"
|
||||||
#include "global_loot_manager.h"
|
#include "global_loot_manager.h"
|
||||||
|
|
||||||
|
class DynamicZone;
|
||||||
|
|
||||||
struct ZonePoint {
|
struct ZonePoint {
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
@ -178,7 +179,7 @@ public:
|
|||||||
void DumpMerchantList(uint32 npcid);
|
void DumpMerchantList(uint32 npcid);
|
||||||
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold = false);
|
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold = false);
|
||||||
int32 MobsAggroCount() { return aggroedmobs; }
|
int32 MobsAggroCount() { return aggroedmobs; }
|
||||||
DynamicZone GetDynamicZone();
|
DynamicZone* GetDynamicZone();
|
||||||
|
|
||||||
IPathfinder *pathing;
|
IPathfinder *pathing;
|
||||||
LinkedList<NPC_Emote_Struct *> NPCEmoteList;
|
LinkedList<NPC_Emote_Struct *> NPCEmoteList;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user