[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 Freeman
2024-05-09 02:53:36 -03:00
committed by GitHub
parent 257935d33a
commit d1c7e45437
14 changed files with 210 additions and 136 deletions
+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