Avoid crashing when HandleHouseEntityCommands is called with no current zone, make sure zone id and instance id are set immediately when zoning in the group member info

This commit is contained in:
Emagi 2025-08-16 07:43:58 -04:00
parent dbbb1d4015
commit 807b7f254b
2 changed files with 8 additions and 4 deletions

View File

@ -5146,7 +5146,7 @@ void Client::Zone(ZoneChangeDetails* new_zone, ZoneServer* opt_zone, bool set_co
} }
// block out the member info for the group // block out the member info for the group
TempRemoveGroup(); TempRemoveGroup(zoning_id, zoning_instance_id);
UpdateTimeStampFlag(ZONE_UPDATE_FLAG); UpdateTimeStampFlag(ZONE_UPDATE_FLAG);
@ -12666,7 +12666,7 @@ void Client::AddItemSale(int64 unique_id, int32 item_id, int64 price, int32 inv_
} }
bool Client::HandleHouseEntityCommands(Spawn* spawn, int32 spawnid, string command) bool Client::HandleHouseEntityCommands(Spawn* spawn, int32 spawnid, string command)
{ {
if (GetCurrentZone()->GetInstanceType() != PERSONAL_HOUSE_INSTANCE) if (!GetCurrentZone() || GetCurrentZone()->GetInstanceType() != PERSONAL_HOUSE_INSTANCE)
return false; return false;
if (command == "house_spawn_examine") if (command == "house_spawn_examine")
@ -12995,7 +12995,7 @@ void Client::ReplaceGroupClient(Client* new_client)
} }
} }
void Client::TempRemoveGroup() void Client::TempRemoveGroup(int32 zone_id, int32 instance_id)
{ {
if (this->GetPlayer()->GetGroupMemberInfo()) if (this->GetPlayer()->GetGroupMemberInfo())
{ {
@ -13007,6 +13007,10 @@ void Client::TempRemoveGroup()
rejoin_group_id = this->GetPlayer()->GetGroupMemberInfo()->group_id; rejoin_group_id = this->GetPlayer()->GetGroupMemberInfo()->group_id;
this->GetPlayer()->GetGroupMemberInfo()->client = 0; this->GetPlayer()->GetGroupMemberInfo()->client = 0;
this->GetPlayer()->GetGroupMemberInfo()->member = 0; this->GetPlayer()->GetGroupMemberInfo()->member = 0;
if(zone_id) {
this->GetPlayer()->GetGroupMemberInfo()->zone_id = zone_id;
this->GetPlayer()->GetGroupMemberInfo()->instance_id = instance_id;
}
this->GetPlayer()->SetGroupMemberInfo(0); this->GetPlayer()->SetGroupMemberInfo(0);
group->MGroupMembers.releasewritelock(); group->MGroupMembers.releasewritelock();
group->RemoveClientReference(this); group->RemoveClientReference(this);

View File

@ -604,7 +604,7 @@ public:
void SetRejoinGroupID(int32 id) { rejoin_group_id = id; } void SetRejoinGroupID(int32 id) { rejoin_group_id = id; }
void TempRemoveGroup(); void TempRemoveGroup(int32 zone_id = 0, int32 instance_id = 0);
void ReplaceGroupClient(Client* new_client); void ReplaceGroupClient(Client* new_client);
void SendWaypoints(); void SendWaypoints();