[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 -10
View File
@@ -1577,19 +1577,20 @@ void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) {
eqs->QueuePacket(app, ack_req);
}
void Client::SendGuildList() {
EQApplicationPacket *outapp;
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("", outapp->size);
if(outapp->pBuffer == nullptr) {
safe_delete(outapp);
return;
}
std::stringstream ss;
cereal::BinaryOutputArchive ar(ss);
ar(guilds_list);
uint32 packet_size = ss.str().length();
eqs->FastQueuePacket((EQApplicationPacket **)&outapp);
std::unique_ptr<EQApplicationPacket> out(new EQApplicationPacket(OP_GuildsList, packet_size));
memcpy(out->pBuffer, ss.str().data(), out->size);
QueuePacket(out.get());
}
// @merth: I have no idea what this struct is for, so it's hardcoded for now