mirror of https://github.com/OpenRCT2/OpenRCT2.git
parent
cb51d63dc8
commit
37caebdde9
|
@ -1,5 +1,6 @@
|
|||
0.4.7 (in development)
|
||||
------------------------------------------------------------------------
|
||||
- Fix: [#20737] Spent money in player window underflows when getting refunds.
|
||||
|
||||
0.4.6 (2023-09-03)
|
||||
------------------------------------------------------------------------
|
||||
|
|
|
@ -387,7 +387,8 @@ namespace GameActions
|
|||
playerIndex != -1, "Unable to find player %u for game action %u", playerId, action->GetType());
|
||||
|
||||
NetworkSetPlayerLastAction(playerIndex, action->GetType());
|
||||
if (result.Cost != 0)
|
||||
NetworkIncrementPlayerNumCommands(playerIndex);
|
||||
if (result.Cost > 0)
|
||||
{
|
||||
NetworkAddPlayerMoneySpent(playerIndex, result.Cost);
|
||||
}
|
||||
|
|
|
@ -3352,6 +3352,14 @@ std::string NetworkGetPlayerPublicKeyHash(uint32_t id)
|
|||
return {};
|
||||
}
|
||||
|
||||
void NetworkIncrementPlayerNumCommands(uint32_t playerIndex)
|
||||
{
|
||||
auto& network = OpenRCT2::GetContext()->GetNetwork();
|
||||
Guard::IndexInRange(playerIndex, network.player_list);
|
||||
|
||||
network.player_list[playerIndex]->IncrementNumCommands();
|
||||
}
|
||||
|
||||
void NetworkAddPlayerMoneySpent(uint32_t index, money64 cost)
|
||||
{
|
||||
auto& network = OpenRCT2::GetContext()->GetNetwork();
|
||||
|
@ -4090,6 +4098,9 @@ std::string NetworkGetPlayerPublicKeyHash(uint32_t id)
|
|||
{
|
||||
return {};
|
||||
}
|
||||
void NetworkIncrementPlayerNumCommands(uint32_t playerIndex)
|
||||
{
|
||||
}
|
||||
void NetworkAddPlayerMoneySpent(uint32_t index, money64 cost)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -36,11 +36,16 @@ void NetworkPlayer::Write(NetworkPacket& packet)
|
|||
<< CommandsRan;
|
||||
}
|
||||
|
||||
void NetworkPlayer::AddMoneySpent(money64 cost)
|
||||
void NetworkPlayer::IncrementNumCommands()
|
||||
{
|
||||
MoneySpent += cost;
|
||||
CommandsRan++;
|
||||
WindowInvalidateByNumber(WindowClass::Player, Id);
|
||||
}
|
||||
|
||||
void NetworkPlayer::AddMoneySpent(money64 cost)
|
||||
{
|
||||
MoneySpent += cost;
|
||||
WindowInvalidateByNumber(WindowClass::Player, Id);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -45,5 +45,6 @@ public:
|
|||
|
||||
void Read(NetworkPacket& packet);
|
||||
void Write(NetworkPacket& packet);
|
||||
void IncrementNumCommands();
|
||||
void AddMoneySpent(money64 cost);
|
||||
};
|
||||
|
|
|
@ -64,6 +64,7 @@ void NetworkFlush();
|
|||
[[nodiscard]] money64 NetworkGetPlayerMoneySpent(uint32_t index);
|
||||
[[nodiscard]] std::string NetworkGetPlayerIPAddress(uint32_t id);
|
||||
[[nodiscard]] std::string NetworkGetPlayerPublicKeyHash(uint32_t id);
|
||||
void NetworkIncrementPlayerNumCommands(uint32_t playerIndex);
|
||||
void NetworkAddPlayerMoneySpent(uint32_t index, money64 cost);
|
||||
[[nodiscard]] int32_t NetworkGetPlayerLastAction(uint32_t index, int32_t time);
|
||||
void NetworkSetPlayerLastAction(uint32_t index, GameCommand command);
|
||||
|
|
Loading…
Reference in New Issue