1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00
Files
OpenRCT2/src/openrct2/network/NetworkPlayer.cpp
73 b9e677945d Replace 20XX with 2022 (#18158)
* Replace 2020 with 2022

Replace all 2020 headers with 2022

* replace other years with 2022

add missing years
2022-10-01 08:42:14 +01:00

47 lines
1.3 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2022 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#ifndef DISABLE_NETWORK
# include "NetworkPlayer.h"
# include "../interface/Window.h"
# include "../localisation/Localisation.h"
# include "NetworkPacket.h"
void NetworkPlayer::SetName(std::string_view name)
{
// 36 == 31 + strlen(" #255");
Name = name.substr(0, 36);
}
void NetworkPlayer::Read(NetworkPacket& packet)
{
auto name = packet.ReadString();
SetName(name);
packet >> Id >> Flags >> Group >> LastAction >> LastActionCoord.x >> LastActionCoord.y >> LastActionCoord.z >> MoneySpent
>> CommandsRan;
}
void NetworkPlayer::Write(NetworkPacket& packet)
{
packet.WriteString(Name);
packet << Id << Flags << Group << LastAction << LastActionCoord.x << LastActionCoord.y << LastActionCoord.z << MoneySpent
<< CommandsRan;
}
void NetworkPlayer::AddMoneySpent(money32 cost)
{
MoneySpent += cost;
CommandsRan++;
window_invalidate_by_number(WindowClass::Player, Id);
}
#endif