Skip to content

Commit

Permalink
MP: removed game_config_view ctor arguments from Create Game and Lobby
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Dec 21, 2020
1 parent 512e778 commit 2b2f334
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/game_initialization/multiplayer.cpp
Expand Up @@ -552,7 +552,7 @@ void mp_manager::enter_create_mode()
{
DBG_MP << "entering create mode" << std::endl;

if(gui2::dialogs::mp_create_game::execute(*game_config, state, connection == nullptr)) {
if(gui2::dialogs::mp_create_game::execute(state, connection == nullptr)) {
enter_staging_mode();
} else if(connection) {
connection->send_data(config("refresh_lobby"));
Expand Down Expand Up @@ -582,7 +582,7 @@ bool mp_manager::enter_lobby_mode()
int dlg_retval = 0;
int dlg_joined_game_id = 0;
{
gui2::dialogs::mp_lobby dlg(*game_config, lobby_info, *connection, dlg_joined_game_id);
gui2::dialogs::mp_lobby dlg(lobby_info, *connection, dlg_joined_game_id);
dlg.show();
dlg_retval = dlg.get_retval();
}
Expand Down
5 changes: 3 additions & 2 deletions src/gui/dialogs/multiplayer/lobby.cpp
Expand Up @@ -43,6 +43,7 @@
#include "font/text_formatting.hpp"
#include "formatter.hpp"
#include "formula/string_utils.hpp"
#include "game_config_manager.hpp"
#include "preferences/game.hpp"
#include "gettext.hpp"
#include "help/help.hpp"
Expand Down Expand Up @@ -120,9 +121,9 @@ bool mp_lobby::logout_prompt()
std::string mp_lobby::announcements_ = "";
std::string mp_lobby::server_information_ = "";

mp_lobby::mp_lobby(const game_config_view& game_config, mp::lobby_info& info, wesnothd_connection &connection, int& joined_game)
mp_lobby::mp_lobby(mp::lobby_info& info, wesnothd_connection& connection, int& joined_game)
: quit_confirmation(&mp_lobby::logout_prompt)
, game_config_(game_config)
, game_config_(game_config_manager::get()->game_config())
, gamelistbox_(nullptr)
, lobby_info_(info)
, chatbox_(nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/multiplayer/lobby.hpp
Expand Up @@ -64,7 +64,7 @@ struct player_list
class mp_lobby : public modal_dialog, public quit_confirmation, private plugin_executor
{
public:
mp_lobby(const game_config_view& game_config, mp::lobby_info& info, wesnothd_connection &connection, int& joined_game);
mp_lobby(mp::lobby_info& info, wesnothd_connection& connection, int& joined_game);

~mp_lobby();

Expand Down
5 changes: 2 additions & 3 deletions src/gui/dialogs/multiplayer/mp_create_game.cpp
Expand Up @@ -21,7 +21,6 @@
#include "formula/string_utils.hpp"
#include "game_config.hpp"
#include "game_config_manager.hpp"
#include "game_config_view.hpp"
#include "game_initialization/lobby_data.hpp"
#include "gettext.hpp"
#include "gui/auxiliary/field.hpp"
Expand Down Expand Up @@ -67,8 +66,8 @@ namespace prefs = preferences;

REGISTER_DIALOG(mp_create_game)

mp_create_game::mp_create_game(const game_config_view& cfg, saved_game& state, bool local_mode)
: cfg_(cfg)
mp_create_game::mp_create_game(saved_game& state, bool local_mode)
: cfg_(game_config_manager::get()->game_config())
, create_engine_(state)
, config_engine_()
, options_manager_()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/multiplayer/mp_create_game.hpp
Expand Up @@ -39,7 +39,7 @@ class mp_create_game : public modal_dialog, private plugin_executor
typedef std::pair<ng::level::TYPE, std::string> level_type_info;

public:
mp_create_game(const game_config_view& cfg, saved_game& state, bool local_mode);
mp_create_game(saved_game& state, bool local_mode);

/** The execute function. See @ref modal_dialog for more information. */
DEFINE_SIMPLE_EXECUTE_WRAPPER(mp_create_game);
Expand Down
6 changes: 2 additions & 4 deletions src/tests/gui/test_gui2.cpp
Expand Up @@ -842,18 +842,16 @@ template<>
struct dialog_tester<mp_lobby>
{
config game_config;
game_config_view gc_view;
wesnothd_connection connection;
std::vector<std::string> installed_addons;
mp::lobby_info li;
int selected_game;
dialog_tester() : connection("", ""), li(installed_addons)
{
gc_view = game_config_view::wrap(game_config);
}
mp_lobby* create()
{
return new mp_lobby(gc_view, li, connection, selected_game);
return new mp_lobby(li, connection, selected_game);
}
};

Expand Down Expand Up @@ -922,7 +920,7 @@ struct dialog_tester<mp_create_game>
}
mp_create_game* create()
{
return new mp_create_game(game_config_view_, state, true);
return new mp_create_game(state, true);
}
};

Expand Down

0 comments on commit 2b2f334

Please sign in to comment.