diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index de0a106d89..5bdfc25d30 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -4002,6 +4002,7 @@ STR_5660 :Modify Groups STR_5661 :Set Player Group STR_5662 :N/A STR_5663 :Clear Landscape +STR_5701 :{WINDOW_COLOUR_2}Last action: {BLACK}{STRINGID} STR_5702 :{SMALLFONT}{BLACK}Locate player's most recent action STR_5703 :Can't kick the host STR_5704 :Last Action: diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index b9141c326e..810ca181f8 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -2291,6 +2291,7 @@ enum { STR_ACTION_NA = 5662, STR_ACTION_CLEAR_LANDSCAPE = 5663, + STR_LAST_ACTION_RAN = 5701, STR_LOCATE_PLAYER_TIP = 5702, STR_CANT_KICK_THE_HOST = 5703, STR_LAST_ACTION = 5704, diff --git a/src/network/network.cpp b/src/network/network.cpp index 2624dafa15..415e8ea909 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -1931,9 +1931,9 @@ void network_add_player_money_spent(unsigned int index, money32 cost) gNetwork.player_list[index]->AddMoneySpent(cost); } -int network_get_player_last_action(unsigned int index) +int network_get_player_last_action(unsigned int index, int time) { - if (SDL_TICKS_PASSED(SDL_GetTicks(), gNetwork.player_list[index]->last_action_time + 2000)) { + if (time && SDL_TICKS_PASSED(SDL_GetTicks(), gNetwork.player_list[index]->last_action_time + time)) { return -999; } return gNetwork.player_list[index]->last_action; @@ -2254,7 +2254,7 @@ int network_get_player_ping(unsigned int index) { return 0; } int network_get_player_id(unsigned int index) { return 0; } money32 network_get_player_money_spent(unsigned int index) { return MONEY(0, 0); } void network_add_player_money_spent(unsigned int index, money32 cost) { } -int network_get_player_last_action(unsigned int index) { return -999; } +int network_get_player_last_action(unsigned int index, int time) { return -999; } void network_set_player_last_action(unsigned int index, int command) { } rct_xyz16 network_get_player_last_action_coord(unsigned int index) { return {0, 0, 0}; } void network_set_player_last_action_coord(unsigned int index, rct_xyz16 coord) { } diff --git a/src/network/network.h b/src/network/network.h index 76aacc6600..781025a55b 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -423,7 +423,7 @@ int network_get_player_ping(unsigned int index); int network_get_player_id(unsigned int index); money32 network_get_player_money_spent(unsigned int index); void network_add_player_money_spent(unsigned int index, money32 cost); -int network_get_player_last_action(unsigned int index); +int network_get_player_last_action(unsigned int index, int time); void network_set_player_last_action(unsigned int index, int command); rct_xyz16 network_get_player_last_action_coord(unsigned int index); void network_set_player_last_action_coord(unsigned int index, rct_xyz16 coord); diff --git a/src/windows/multiplayer.c b/src/windows/multiplayer.c index a4336fb619..7760a5129b 100644 --- a/src/windows/multiplayer.c +++ b/src/windows/multiplayer.c @@ -436,7 +436,7 @@ static void window_multiplayer_players_scrollpaint(rct_window *w, rct_drawpixeli } // Draw last action - int action = network_get_player_last_action(i); + int action = network_get_player_last_action(i, 2000); RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_ACTION_NA; if (action != -999) { RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = network_get_action_name_string_id(action); diff --git a/src/windows/player.c b/src/windows/player.c index 5d60ad2f70..19c31c0163 100644 --- a/src/windows/player.c +++ b/src/windows/player.c @@ -354,6 +354,15 @@ void window_player_overview_paint(rct_window *w, rct_drawpixelinfo *dpi) RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = network_get_player_money_spent(player); gfx_draw_string_left(dpi, STR_MONEY_SPENT, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0,x, y); + + y += 10; + + int lastaction = network_get_player_last_action(player, 0); + RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_ACTION_NA; + if (lastaction != -999) { + RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = network_get_action_name_string_id(lastaction); + } + gfx_draw_string_left(dpi, STR_LAST_ACTION_RAN, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0,x, y); } void window_player_overview_invalidate(rct_window *w)