From 2da01caa1e1541122f8d8fd6a257aefe01726f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= Date: Wed, 5 Dec 2018 07:39:57 +0100 Subject: [PATCH] Fix #8338: GAs using player id instead of index to log money spent. (#8361) --- src/openrct2/actions/GameAction.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/openrct2/actions/GameAction.cpp b/src/openrct2/actions/GameAction.cpp index 8dc67380a6..3f82d7a0eb 100644 --- a/src/openrct2/actions/GameAction.cpp +++ b/src/openrct2/actions/GameAction.cpp @@ -253,10 +253,13 @@ namespace GameActions { NetworkPlayerId_t playerId = action->GetPlayer(); - network_set_player_last_action(network_get_player_index(playerId.id), action->GetType()); + int32_t playerIndex = network_get_player_index(playerId.id); + Guard::Assert(playerIndex != -1); + + network_set_player_last_action(playerIndex, action->GetType()); if (result->Cost != 0) { - network_add_player_money_spent(playerId.id, result->Cost); + network_add_player_money_spent(playerIndex, result->Cost); } } }