mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
show last action in player window
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) { }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user