Skip to content

Commit

Permalink
Renamed a bunch of wesnothd dialog members for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Oct 19, 2017
1 parent f3ea0d7 commit c6d4dff
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
22 changes: 11 additions & 11 deletions src/gui/dialogs/lobby/lobby.cpp
Expand Up @@ -141,7 +141,7 @@ mp_lobby::mp_lobby(const config& game_config, mp::lobby_info& info, wesnothd_con
, gamelist_dirty_(true)
, last_gamelist_update_(0)
, gamelist_diff_update_(true)
, wesnothd_connection_(connection)
, network_connection_(connection)
, lobby_update_timer_(0)
, gamelist_id_at_row_()
, delay_playerlist_update_(false)
Expand Down Expand Up @@ -318,7 +318,7 @@ void mp_lobby::update_gamelist_diff()
} else {
if(list_i >= gamelistbox_->get_item_count()) {
ERR_LB << "Ran out of listbox items -- triggering a full refresh\n";
wesnothd_connection_.send_data(config("refresh_lobby"));
network_connection_.send_data(config("refresh_lobby"));
return;
}

Expand All @@ -327,15 +327,15 @@ void mp_lobby::update_gamelist_diff()
<< list_rows_deleted
<< " >= " << gamelist_id_at_row_.size()
<< " -- triggering a full refresh\n";
wesnothd_connection_.send_data(config("refresh_lobby"));
network_connection_.send_data(config("refresh_lobby"));
return;
}

int listbox_game_id = gamelist_id_at_row_[list_i + list_rows_deleted];
if(game.id != listbox_game_id) {
ERR_LB << "Listbox game id does not match expected id "
<< listbox_game_id << " " << game.id << " (row " << list_i << ")\n";
wesnothd_connection_.send_data(config("refresh_lobby"));
network_connection_.send_data(config("refresh_lobby"));
return;
}

Expand Down Expand Up @@ -697,7 +697,7 @@ void mp_lobby::pre_show(window& window)

chatbox_ = find_widget<chatbox>(&window, "chat", false, true);
chatbox_->set_lobby_info(lobby_info_);
chatbox_->set_wesnothd_connection(wesnothd_connection_);
chatbox_->set_wesnothd_connection(network_connection_);
chatbox_->set_active_window_changed_callback([this]() { player_list_dirty_ = true; });

find_widget<button>(&window, "create", false).set_retval(CREATE);
Expand Down Expand Up @@ -804,7 +804,7 @@ void mp_lobby::network_handler()
{
try {
config data;
if (wesnothd_connection_.receive_data(data)) {
if (network_connection_.receive_data(data)) {
process_network_data(data);
}
} catch (wesnothd_error& e) {
Expand Down Expand Up @@ -855,7 +855,7 @@ void mp_lobby::process_gamelist_diff(const config& data)
gamelist_dirty_ = true;
} else {
ERR_LB << "process_gamelist_diff failed!" << std::endl;
wesnothd_connection_.send_data(config("refresh_lobby"));
network_connection_.send_data(config("refresh_lobby"));
}
const int joined = data.child_count("insert_child");
const int left = data.child_count("remove_child");
Expand Down Expand Up @@ -988,14 +988,14 @@ bool mp_lobby::do_game_join(int idx, bool observe)
join["password"] = password;
}

wesnothd_connection_.send_data(response);
network_connection_.send_data(response);
joined_game_id_ = game.id;
return true;
}

void mp_lobby::refresh_button_callback(window& /*window*/)
{
wesnothd_connection_.send_data(config("refresh_lobby"));
network_connection_.send_data(config("refresh_lobby"));
}

void mp_lobby::show_preferences_button_callback(window& window)
Expand All @@ -1021,7 +1021,7 @@ void mp_lobby::show_preferences_button_callback(window& window)
*/
window.invalidate_layout();

wesnothd_connection_.send_data(config("refresh_lobby"));
network_connection_.send_data(config("refresh_lobby"));
}

void mp_lobby::game_filter_reload()
Expand Down Expand Up @@ -1122,7 +1122,7 @@ void mp_lobby::user_dialog_callback(mp::user_info* info)
// update_gamelist();
delay_playerlist_update_ = false;
player_list_dirty_ = true;
wesnothd_connection_.send_data(config("refresh_lobby"));
network_connection_.send_data(config("refresh_lobby"));
}

void mp_lobby::skip_replay_changed_callback(window& window)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/lobby/lobby.hpp
Expand Up @@ -198,7 +198,7 @@ class mp_lobby : public modal_dialog, public quit_confirmation, private plugin_e

bool gamelist_diff_update_;

wesnothd_connection &wesnothd_connection_;
wesnothd_connection &network_connection_;

/** Timer for updating the lobby. */
size_t lobby_update_timer_;
Expand Down
14 changes: 7 additions & 7 deletions src/gui/dialogs/multiplayer/mp_join_game.cpp
Expand Up @@ -67,7 +67,7 @@ mp_join_game::mp_join_game(saved_game& state, mp::lobby_info& lobby_info, wesnot
: level_()
, state_(state)
, lobby_info_(lobby_info)
, wesnothd_connection_(connection)
, network_connection_(connection)
, update_timer_(0)
, first_scenario_(first_scenario)
, observe_game_(observe_game)
Expand All @@ -91,14 +91,14 @@ bool mp_join_game::fetch_game_config(CVideo& video)
{
// Ask for the next scenario data, if applicable
if(!first_scenario_) {
wesnothd_connection_.send_data(config("load_next_scenario"));
network_connection_.send_data(config("load_next_scenario"));
}

bool has_scenario_and_controllers = false;
while(!has_scenario_and_controllers) {
config revc;
const bool data_res = gui2::dialogs::network_transmission::wesnothd_receive_dialog(
video, "download level data", revc, wesnothd_connection_);
video, "download level data", revc, network_connection_);

if(!data_res) {
return false;
Expand Down Expand Up @@ -229,7 +229,7 @@ bool mp_join_game::fetch_game_config(CVideo& video)
change["leader"] = flg.current_leader();
change["gender"] = flg.current_gender();

wesnothd_connection_.send_data(faction);
network_connection_.send_data(faction);
}

return true;
Expand Down Expand Up @@ -282,7 +282,7 @@ void mp_join_game::pre_show(window& window)
chatbox& chat = find_widget<chatbox>(&window, "chat", false);

chat.set_lobby_info(lobby_info_);
chat.set_wesnothd_connection(wesnothd_connection_);
chat.set_wesnothd_connection(network_connection_);

chat.room_window_open("this game", true, false); // TODO: better title?
chat.active_window_changed();
Expand Down Expand Up @@ -442,7 +442,7 @@ void mp_join_game::network_handler(window& window)
}

config data;
if(!wesnothd_connection_.receive_data(data)) {
if(!network_connection_.receive_data(data)) {
return;
}

Expand Down Expand Up @@ -518,7 +518,7 @@ void mp_join_game::post_show(window& window)

mp_ui_alerts::game_has_begun();
} else {
wesnothd_connection_.send_data(config("leave_game"));
network_connection_.send_data(config("leave_game"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/multiplayer/mp_join_game.hpp
Expand Up @@ -72,7 +72,7 @@ class mp_join_game : public modal_dialog, private plugin_executor

mp::lobby_info& lobby_info_;

wesnothd_connection& wesnothd_connection_;
wesnothd_connection& network_connection_;

size_t update_timer_;

Expand Down
8 changes: 4 additions & 4 deletions src/gui/dialogs/multiplayer/mp_staging.cpp
Expand Up @@ -53,7 +53,7 @@ mp_staging::mp_staging(ng::connect_engine& connect_engine, mp::lobby_info& lobby
: connect_engine_(connect_engine)
, ai_algorithms_(ai::configuration::get_available_ais())
, lobby_info_(lobby_info)
, wesnothd_connection_(connection)
, network_connection_(connection)
, update_timer_(0)
, state_changed_(false)
, team_tree_map_()
Expand Down Expand Up @@ -102,8 +102,8 @@ void mp_staging::pre_show(window& window)

chat.set_lobby_info(lobby_info_);

if(wesnothd_connection_) {
chat.set_wesnothd_connection(*wesnothd_connection_);
if(network_connection_) {
chat.set_wesnothd_connection(*network_connection_);
}

chat.room_window_open("this game", true, false); // TODO: better title?
Expand Down Expand Up @@ -459,7 +459,7 @@ void mp_staging::network_handler(window& window)

// Next, check for any incoming changes
config data;
if(!state_changed_ && (!wesnothd_connection_ || !wesnothd_connection_->receive_data(data))) {
if(!state_changed_ && (!network_connection_ || !network_connection_->receive_data(data))) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/multiplayer/mp_staging.hpp
Expand Up @@ -80,7 +80,7 @@ class mp_staging : public modal_dialog, private plugin_executor

mp::lobby_info& lobby_info_;

wesnothd_connection* wesnothd_connection_;
wesnothd_connection* network_connection_;

size_t update_timer_;

Expand Down

0 comments on commit c6d4dff

Please sign in to comment.