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