[Server] Add PreReading virtual method

add "const" qualifier to exteriorCellPattern
sol2-server-rewrite
Koncord 7 years ago
parent d0eef7c98e
commit afbafdf806

@ -14,6 +14,7 @@ const vector<string> Utils::split(const string &str, int delimiter)
vector<string> result;
for (const auto &symb : str)
{
if (symb != delimiter)
buffer += symb;
else if (!buffer.empty())
@ -21,6 +22,7 @@ const vector<string> Utils::split(const string &str, int delimiter)
result.push_back(move(buffer));
buffer.clear();
}
}
if (!buffer.empty())
result.push_back(move(buffer));
@ -32,7 +34,7 @@ ESM::Cell Utils::getCellFromDescription(const std::string &cellDescription)
ESM::Cell cell;
cell.blank();
static regex exteriorCellPattern("^(-?\\d+), (-?\\d+)$");
static const regex exteriorCellPattern("^(-?\\d+), (-?\\d+)$");
smatch baseMatch;
if (regex_match(cellDescription, baseMatch, exteriorCellPattern))

@ -20,10 +20,15 @@ bool PlayerProcessor::Process(RakNet::Packet &packet) noexcept
PlayerPacket *myPacket = Networking::get().getPlayerPacketController()->GetPacket(packet.data[0]);
myPacket->setPlayer(player.get());
LOG_MESSAGE_SIMPLE(Log::LOG_TRACE, "Processing %s from %s", processor.second->strPacketID.c_str(), player->npc.mName.c_str());
LOG_MESSAGE_SIMPLE(Log::LOG_TRACE, "Processing %s from %s", processor.second->strPacketID.c_str(),
player->npc.mName.c_str());
if (!processor.second->avoidReading)
{
processor.second->PreReading(*myPacket, player);
myPacket->Read();
}
processor.second->Do(*myPacket, player);
return true;

@ -18,6 +18,7 @@ namespace mwmp
{
public:
virtual void PreReading(PlayerPacket &packet, const std::shared_ptr<Player> &player){};
virtual void Do(PlayerPacket &packet, const std::shared_ptr<Player> &player) = 0;
static bool Process(RakNet::Packet &packet) noexcept;

Loading…
Cancel
Save