mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Zoning] Fix zone race condition (#2479)
* Testing * Separate auto shutdown fix * Revert for PR * Invalidate lock in places where zoning is cancelled
This commit is contained in:
parent
18bfee5616
commit
bc72641eef
@ -233,6 +233,7 @@ Client::Client(EQStreamInterface* ieqs)
|
|||||||
zonesummon_id = 0;
|
zonesummon_id = 0;
|
||||||
zonesummon_ignorerestrictions = 0;
|
zonesummon_ignorerestrictions = 0;
|
||||||
bZoning = false;
|
bZoning = false;
|
||||||
|
m_lock_save_position = false;
|
||||||
zone_mode = ZoneUnsolicited;
|
zone_mode = ZoneUnsolicited;
|
||||||
casting_spell_id = 0;
|
casting_spell_id = 0;
|
||||||
npcflag = false;
|
npcflag = false;
|
||||||
@ -634,11 +635,14 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Wrote current basics to PP for saves */
|
/* Wrote current basics to PP for saves */
|
||||||
|
if (!m_lock_save_position) {
|
||||||
m_pp.x = m_Position.x;
|
m_pp.x = m_Position.x;
|
||||||
m_pp.y = m_Position.y;
|
m_pp.y = m_Position.y;
|
||||||
m_pp.z = m_Position.z;
|
m_pp.z = m_Position.z;
|
||||||
m_pp.guildrank = guildrank;
|
|
||||||
m_pp.heading = m_Position.w;
|
m_pp.heading = m_Position.w;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pp.guildrank = guildrank;
|
||||||
|
|
||||||
/* Mana and HP */
|
/* Mana and HP */
|
||||||
if (GetHP() <= 0) {
|
if (GetHP() <= 0) {
|
||||||
@ -11827,3 +11831,13 @@ bool Client::HasRecipeLearned(uint32 recipe_id)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Client::IsLockSavePosition() const
|
||||||
|
{
|
||||||
|
return m_lock_save_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client::SetLockSavePosition(bool lock_save_position)
|
||||||
|
{
|
||||||
|
Client::m_lock_save_position = lock_save_position;
|
||||||
|
}
|
||||||
|
|||||||
@ -1801,6 +1801,13 @@ private:
|
|||||||
int32 max_end;
|
int32 max_end;
|
||||||
int32 current_endurance;
|
int32 current_endurance;
|
||||||
|
|
||||||
|
// https://github.com/EQEmu/Server/pull/2479
|
||||||
|
bool m_lock_save_position = false;
|
||||||
|
public:
|
||||||
|
bool IsLockSavePosition() const;
|
||||||
|
void SetLockSavePosition(bool lock_save_position);
|
||||||
|
private:
|
||||||
|
|
||||||
PlayerProfile_Struct m_pp;
|
PlayerProfile_Struct m_pp;
|
||||||
ExtendedProfile_Struct m_epp;
|
ExtendedProfile_Struct m_epp;
|
||||||
EQ::InventoryProfile m_inv;
|
EQ::InventoryProfile m_inv;
|
||||||
|
|||||||
@ -365,6 +365,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
zc2->success = ZONE_ERROR_NOTREADY;
|
zc2->success = ZONE_ERROR_NOTREADY;
|
||||||
entity->CastToMob()->SetZone(ztz->current_zone_id, ztz->current_instance_id);
|
entity->CastToMob()->SetZone(ztz->current_zone_id, ztz->current_instance_id);
|
||||||
entity->CastToClient()->SetZoning(false);
|
entity->CastToClient()->SetZoning(false);
|
||||||
|
entity->CastToClient()->SetLockSavePosition(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
entity->CastToClient()->UpdateWho(1);
|
entity->CastToClient()->UpdateWho(1);
|
||||||
|
|||||||
@ -394,6 +394,8 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) {
|
|||||||
zone_mode = ZoneUnsolicited;
|
zone_mode = ZoneUnsolicited;
|
||||||
// reset since we're not zoning anymore
|
// reset since we're not zoning anymore
|
||||||
bZoning = false;
|
bZoning = false;
|
||||||
|
// remove save position lock
|
||||||
|
m_lock_save_position = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::SendZoneError(ZoneChange_Struct *zc, int8 err)
|
void Client::SendZoneError(ZoneChange_Struct *zc, int8 err)
|
||||||
@ -413,6 +415,8 @@ void Client::SendZoneError(ZoneChange_Struct *zc, int8 err)
|
|||||||
zone_mode = ZoneUnsolicited;
|
zone_mode = ZoneUnsolicited;
|
||||||
// reset since we're not zoning anymore
|
// reset since we're not zoning anymore
|
||||||
bZoning = false;
|
bZoning = false;
|
||||||
|
// remove save position lock
|
||||||
|
m_lock_save_position = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instance_id, float dest_x, float dest_y, float dest_z, float dest_h, int8 ignore_r) {
|
void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instance_id, float dest_x, float dest_y, float dest_z, float dest_h, int8 ignore_r) {
|
||||||
@ -467,6 +471,8 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
|
|||||||
//Force a save so its waiting for them when they zone
|
//Force a save so its waiting for them when they zone
|
||||||
Save(2);
|
Save(2);
|
||||||
|
|
||||||
|
m_lock_save_position = true;
|
||||||
|
|
||||||
if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) {
|
if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) {
|
||||||
// No need to ask worldserver if we're zoning to ourselves (most
|
// No need to ask worldserver if we're zoning to ourselves (most
|
||||||
// likely to a bind point), also fixes a bug since the default response was failure
|
// likely to a bind point), also fixes a bug since the default response was failure
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user