add some mp debugging output

This commit is contained in:
Chris Beck 2014-12-03 00:10:52 -05:00
parent 1f93699c8b
commit 4d69cabec7
2 changed files with 19 additions and 1 deletions

View File

@ -103,7 +103,7 @@ void run_lobby_loop(display& disp, mp::ui& ui)
if (plugins_context * pc = ui.get_plugins_context()) {
pc->play_slice();
DBG_MP << "* playing a plugins slice\n";
//DBG_MP << "* playing a plugins slice\n";
}
events::pump();
@ -466,6 +466,8 @@ static void enter_wait_mode(game_display& disp, const config& game_config,
//FIXME implement true skip replay
//state = ui.request_snapshot();
//}
} else {
DBG_MP << "skipped wait mode, result = " << res << std::endl;
}
}

View File

@ -44,6 +44,10 @@ static lg::log_domain log_enginerefac("enginerefac");
#define LOG_RG LOG_STREAM(info, log_enginerefac)
#define ERR_RG LOG_STREAM(err, log_enginerefac)
static lg::log_domain log_mp("mp/main");
#define DBG_MP LOG_STREAM(debug, log_mp)
namespace {
const SDL_Rect leader_pane_position = {-260,-370,260,370};
@ -237,6 +241,7 @@ void wait::join_game(bool observe)
{
const bool download_res = download_level_data();
if (!download_res) {
DBG_MP << "mp wait: could not download level data, quitting...";
set_result(QUIT);
return;
} else if (!get_scenario()["allow_new_game"].to_bool(true) && !level_.child_or_empty("multiplayer")["savegame"].to_bool(false)) {
@ -303,6 +308,8 @@ void wait::join_game(bool observe)
int side_num = -1, nb_sides = 0;
BOOST_FOREACH(const config &sd, get_scenario().child_range("side"))
{
DBG_MP << "*** side " << nb_sides << "***\n" << sd.debug() << "***\n";
if (sd["controller"] == "reserved" && sd["current_player"] == preferences::login())
{
side_choice = &sd;
@ -324,6 +331,11 @@ void wait::join_game(bool observe)
++nb_sides;
}
if (!side_choice) {
size_t count = 0;
for(config::child_itors its = get_scenario().child_range("side"); its.second != its.first; ++its.first) {
++count;
}
DBG_MP << "could not find a side, all " << count << " sides were unsuitable\n";
set_result(QUIT);
return;
}
@ -660,6 +672,7 @@ bool wait::has_level_data() const
bool wait::download_level_data()
{
DBG_MP << "download_level_data()\n";
if (!first_scenario_) {
// Ask for the next scenario data.
network::send_data(config("load_next_scenario"), 0);
@ -670,6 +683,7 @@ bool wait::download_level_data()
disp(), _("Getting game data..."), level_);
if (!data_res) {
DBG_MP << "download_level_data bad results\n";
return false;
}
check_response(data_res, level_);
@ -683,6 +697,8 @@ bool wait::download_level_data()
level_ = cfg;
}
DBG_MP << "download_level_data() success.\n";
return true;
}