Skip to content

Commit

Permalink
Lobby Info: handle keeping games ptr vector up-to-date here
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Nov 9, 2021
1 parent fe36d2e commit e54afdf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/game_initialization/lobby_info.cpp
Expand Up @@ -134,6 +134,9 @@ void lobby_info::process_gamelist(const config& data)
DBG_LB << dump_games_map(games_by_id_);
DBG_LB << dump_games_config(gamelist_.child("gamelist"));

// Sync order vector
make_games_vector();

process_userlist();
}

Expand Down Expand Up @@ -221,6 +224,9 @@ bool lobby_info::process_gamelist_diff_impl(const config& data)

DBG_LB << "postclean " << dump_games_config(gamelist_.child("gamelist"));

// Sync order vector
make_games_vector();

process_userlist();
return true;
}
Expand Down
12 changes: 6 additions & 6 deletions src/game_initialization/lobby_info.hpp
Expand Up @@ -50,12 +50,6 @@ class lobby_info

void sync_games_display_status();

/**
* Generates a new vector of game pointers from the ID/game map.
* The games will be referenced in ascending order by ID.
*/
void make_games_vector();

/** Returns the raw game list config data. */
const config& gamelist() const
{
Expand Down Expand Up @@ -129,6 +123,12 @@ class lobby_info

void process_userlist();

/**
* Generates a new vector of game pointers from the ID/game map.
* The games will be referenced in ascending order by ID.
*/
void make_games_vector();

std::vector<std::string> installed_addons_;

config gamelist_;
Expand Down
2 changes: 0 additions & 2 deletions src/gui/dialogs/multiplayer/lobby.cpp
Expand Up @@ -231,7 +231,6 @@ void mp_lobby::update_gamelist()
SCOPE_LB;
gamelistbox_->clear();
gamelist_id_at_row_.clear();
lobby_info_.make_games_vector();

int select_row = -1;
for(unsigned i = 0; i < lobby_info_.games().size(); ++i) {
Expand Down Expand Up @@ -266,7 +265,6 @@ void mp_lobby::update_gamelist_diff()
if(delay_gamelist_update_) return;

SCOPE_LB;
lobby_info_.make_games_vector();
int select_row = -1;
unsigned list_i = 0;
int list_rows_deleted = 0;
Expand Down

0 comments on commit e54afdf

Please sign in to comment.