[FIX] Fix for world crash with over 1500 guilds (#4299)

* Fix for world crash with over 1500 guilds

There was an existing issue with certain clients (RoF2) if there were more than 1500 guilds.  This also enhances the loading of guilds in both world and zone for performance if there are large number of guilds as RoF2 will support 1500+ guilds.

* Safely access permissions map

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Mitch FreemanandAkkadius authored and GitHub committed 2024-05-09 00:53:36 -05:00
1 parent 257935d33a
commit d1c7e45437
14 files changed
+210 -136

No files matched your search

+11 -13
View File
@@ -189,22 +189,20 @@ void Client::SendGuildSpawnAppearance() {
UpdateWho();
}
void Client::SendGuildList() {
EQApplicationPacket *outapp;
// outapp = new EQApplicationPacket(OP_ZoneGuildList);
outapp = new EQApplicationPacket(OP_GuildsList);
void Client::SendGuildList()
{
auto guilds_list = guild_mgr.MakeGuildList();
//ask the guild manager to build us a nice guild list packet
outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size);
if(outapp->pBuffer == nullptr) {
LogGuilds("Unable to make guild list!");
safe_delete(outapp);
return;
}
std::stringstream ss;
cereal::BinaryOutputArchive ar(ss);
ar(guilds_list);
LogGuilds("Sending OP_ZoneGuildList of length [{}]", outapp->size);
uint32 packet_size = ss.str().length();
FastQueuePacket(&outapp);
std::unique_ptr<EQApplicationPacket> out(new EQApplicationPacket(OP_GuildsList, packet_size));
memcpy(out->pBuffer, ss.str().data(), out->size);
QueuePacket(out.get());
}