diff --git a/port/linux/game/menu_functions.c b/port/linux/game/menu_functions.c index 0c85e5e6..e4616354 100644 --- a/port/linux/game/menu_functions.c +++ b/port/linux/game/menu_functions.c @@ -813,6 +813,7 @@ static void profile_name_show(struct widget_instance *description) static struct player_profile profile; static long read_index = NONE; static unsigned long read_time; + static boolean read_good; long index = player_ui_get_active_player_profile_index(0); if (!description) @@ -824,13 +825,17 @@ static void profile_name_show(struct widget_instance *description) } else if ((index = player_ui_get_player1_last_used_profile_index()) == NONE) return; - else if (index != read_index || system_milliseconds() - read_time > 1000) + else { - read_index = NONE; - if (!player_profile_get(index, &profile)) + /* (one that cannot be read too: tried again a second later) */ + if (index != read_index || system_milliseconds() - read_time > 1000) + { + read_index = index; + read_good = player_profile_get(index, &profile); + read_time = system_milliseconds(); + } + if (!read_good) return; - read_index = index; - read_time = system_milliseconds(); } text_set(named(description, "current_profile_name", 0), profile.player_name); } @@ -3103,8 +3108,8 @@ scenario's path or name */ static void map_display_name(char const *map_name, wchar_t *text) { char const *const *names; - short last, index; - short count = ui_widget_port_multiplayer_maps(&names, &last); + short index; + short count = ui_widget_port_multiplayer_maps(&names, NULL); for (index = 0; index < count; index++) { @@ -4037,7 +4042,7 @@ static void lobby_row_text(short row, wchar_t *text) static void lobby_map_show(struct widget_instance *description, char const *map_name) { char const *const *names; - short last, count = ui_widget_port_multiplayer_maps(&names, &last), map = 19, index; + short count = ui_widget_port_multiplayer_maps(&names, NULL), map = 19, index; short level = campaign_level_of(map_name); struct widget_instance *widget; diff --git a/source/interface/ui_widget_event_handler_functions.c b/source/interface/ui_widget_event_handler_functions.c index 45147d92..2d2dca43 100644 --- a/source/interface/ui_widget_event_handler_functions.c +++ b/source/interface/ui_widget_event_handler_functions.c @@ -5881,7 +5881,9 @@ static boolean solo_level_initialize_list_single_player( /* port: the PC version's multiplayer menus (port/linux/game/menu_functions.c), on our lists rather than the Xbox's spinners: */ -/* the multiplayer maps (the Xbox's 13), and the one used last (else 0) */ +/* the multiplayer maps (the Xbox's 13), and the one used last (else 0), +unless last_used is NULL: it is read from a file of the save root, which the +menus that name maps each frame need not do */ short ui_widget_port_multiplayer_maps( char const *const **names, short *last_used) @@ -5890,6 +5892,8 @@ short ui_widget_port_multiplayer_maps( short level_index; *names = (char const *const *)event_handler_functions.multiplayer_levels; + if (!last_used) + return 13; *last_used = 0; if (saved_game_file_retrieve_last_used_multiplayer_map(map_name)) {