mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-13 23:28:21 +00:00
Packets take SerializeBuffer via move
The existing implemented behavior is that of a transfer of ownership, however it does it without move semantics. This doesn't change the behavior but makes it explicitly clear that there is a transfer of ownership via enforced move semantics. Also includes some cleanup in the packet classes, including converting the size parameter to size_t. While no packet will ever be large enough to require 64-bits of size, many places that are initializing packets are doing so with a size_t parameter, so this will address those warnings here.
This commit is contained in:
+4
-4
@@ -1784,7 +1784,7 @@ void Client::Message(uint32 type, const char* message, ...) {
|
||||
buf.WriteInt32(0);
|
||||
buf.WriteString(buffer);
|
||||
|
||||
auto app = new EQApplicationPacket(OP_SpecialMesg, buf);
|
||||
auto app = new EQApplicationPacket(OP_SpecialMesg, std::move(buf));
|
||||
|
||||
FastQueuePacket(&app);
|
||||
|
||||
@@ -1813,7 +1813,7 @@ void Client::FilteredMessage(Mob *sender, uint32 type, eqFilterType filter, cons
|
||||
buf.WriteInt32(0);
|
||||
buf.WriteString(buffer);
|
||||
|
||||
auto app = new EQApplicationPacket(OP_SpecialMesg, buf);
|
||||
auto app = new EQApplicationPacket(OP_SpecialMesg, std::move(buf));
|
||||
|
||||
FastQueuePacket(&app);
|
||||
|
||||
@@ -3869,7 +3869,7 @@ void Client::MessageString(uint32 type, uint32 string_id, const char* message1,
|
||||
|
||||
buf.WriteInt8(0); // prevent oob in packet translation, maybe clean that up sometime
|
||||
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_FormattedMessage, buf);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_FormattedMessage, std::move(buf));
|
||||
|
||||
if (distance > 0)
|
||||
entity_list.QueueCloseClients(this, outapp.get(), false, distance);
|
||||
@@ -3987,7 +3987,7 @@ void Client::FilteredMessageString(Mob *sender, uint32 type, eqFilterType filter
|
||||
|
||||
buf.WriteInt8(0); // prevent oob in packet translation, maybe clean that up sometime
|
||||
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_FormattedMessage, buf);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_FormattedMessage, std::move(buf));
|
||||
|
||||
QueuePacket(outapp.get());
|
||||
}
|
||||
|
||||
+1
-1
@@ -4437,7 +4437,7 @@ void EntityList::QuestJournalledSayClose(
|
||||
buf.WriteString(message);
|
||||
}
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_SpecialMesg, buf);
|
||||
auto outapp = new EQApplicationPacket(OP_SpecialMesg, std::move(buf));
|
||||
|
||||
// client only bothers logging if target spawn ID matches, safe to send to everyone
|
||||
QueueCloseClients(sender, outapp, false, dist);
|
||||
|
||||
@@ -117,7 +117,7 @@ void SharedTaskZoneMessaging::HandleWorldMessage(ServerPacket *pack)
|
||||
buf.WriteInt8(m.is_leader ? 1 : 0);
|
||||
}
|
||||
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_SharedTaskMemberList, buf);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_SharedTaskMemberList, std::move(buf));
|
||||
c->QueuePacket(outapp.get());
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ void SharedTaskZoneMessaging::HandleWorldMessage(ServerPacket *pack)
|
||||
// live sends more after the name but it might just be garbage from
|
||||
// a re-used buffer (possibly a former name[64] buffer?)
|
||||
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_SharedTaskMemberChange, buf);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_SharedTaskMemberChange, std::move(buf));
|
||||
c->QueuePacket(outapp.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -858,7 +858,7 @@ void TaskManager::SendTaskSelector(Client* client, Mob* mob, const std::vector<i
|
||||
client->GetTaskState()->AddOffer(task_list[i], mob->GetID());
|
||||
}
|
||||
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_TaskSelectWindow, buf);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_TaskSelectWindow, std::move(buf));
|
||||
client->QueuePacket(outapp.get());
|
||||
}
|
||||
|
||||
@@ -883,7 +883,7 @@ void TaskManager::SendSharedTaskSelector(Client* client, Mob* mob, const std::ve
|
||||
client->GetTaskState()->AddOffer(task_id, mob->GetID());
|
||||
}
|
||||
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_SharedTaskSelectWindow, buf);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_SharedTaskSelectWindow, std::move(buf));
|
||||
client->QueuePacket(outapp.get());
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,7 @@ void TaskManager::SendTaskActivityLong(
|
||||
|
||||
activity.SerializeObjective(buf, client->ClientVersion(), done_count);
|
||||
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_TaskActivity, buf);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_TaskActivity, std::move(buf));
|
||||
client->QueuePacket(outapp.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -550,7 +550,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
SerializeBuffer buf(100);
|
||||
buf.WriteString(smotd->motd);
|
||||
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_MOTD, buf);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_MOTD, std::move(buf));
|
||||
|
||||
entity_list.QueueClients(0, outapp.get());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user