[Bug Fix] Fix crash in Client::Handle_OP_GMGoto (#3832)

# Notes
- Logic was incorrect.
This commit is contained in:
Alex King 2023-12-31 15:45:08 -05:00 committed by GitHub
parent a0f2a8a743
commit 2f4af4f0c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6598,17 +6598,26 @@ void Client::Handle_OP_GMGoto(const EQApplicationPacket *app)
auto *gmg = (GMSummon_Struct *) app->pBuffer; auto *gmg = (GMSummon_Struct *) app->pBuffer;
Mob *gt = entity_list.GetMob(gmg->charname); Mob *gt = entity_list.GetMob(gmg->charname);
if (!gt) { if (gt) {
MovePC(zone->GetZoneID(), zone->GetInstanceID(), gt->GetX(), gt->GetY(), gt->GetZ(), gt->GetHeading()); MovePC(
zone->GetZoneID(),
zone->GetInstanceID(),
gt->GetX(),
gt->GetY(),
gt->GetZ(),
gt->GetHeading()
);
} else if (!worldserver.Connected()) { } else if (!worldserver.Connected()) {
Message(Chat::Red, "Error: World server disconnected."); Message(Chat::Red, "Error: World server disconnected.");
} else { } else {
auto pack = new ServerPacket(ServerOP_GMGoto, sizeof(ServerGMGoto_Struct)); auto pack = new ServerPacket(ServerOP_GMGoto, sizeof(ServerGMGoto_Struct));
memset(pack->pBuffer, 0, pack->size); memset(pack->pBuffer, 0, pack->size);
ServerGMGoto_Struct *wsgmg = (ServerGMGoto_Struct *) pack->pBuffer;
strcpy(wsgmg->myname, GetName()); auto* g = (ServerGMGoto_Struct *) pack->pBuffer;
strcpy(wsgmg->gotoname, gmg->charname); strcpy(g->myname, GetName());
wsgmg->admin = admin; strcpy(g->gotoname, gmg->charname);
g->admin = admin;
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
} }