This adds some debug output i found useful when tackling bugs.

This commit is contained in:
Jörg Hinrichs 2008-02-29 23:45:56 +00:00
parent af4b15dd0a
commit 07ed7c6b0f
2 changed files with 14 additions and 1 deletions

View file

@ -432,9 +432,11 @@ void display::create_buttons()
{
std::vector<gui::button> work;
DBG_DP << "creating buttons...\n";
const std::vector<theme::menu>& buttons = theme_.menus();
for(std::vector<theme::menu>::const_iterator i = buttons.begin(); i != buttons.end(); ++i) {
gui::button b(screen_,i->title(),string_to_button_type(i->type()),i->image());
DBG_DP << "drawing button " << i->get_id() << "\n";
b.set_id(i->get_id());
const SDL_Rect& loc = i->location(screen_area());
b.set_location(loc.x,loc.y);
@ -452,6 +454,7 @@ void display::create_buttons()
}
buttons_.swap(work);
DBG_DP << "buttons created\n";
}
gui::button::TYPE display::string_to_button_type(std::string type)
@ -767,10 +770,16 @@ void display::update_display()
static void draw_panel(CVideo& video, const theme::panel& panel, std::vector<gui::button>& buttons)
{
//log_scope("draw panel");
DBG_DP << "drawing panel " << panel.get_id() << "\n";
surface surf(image::get_image(panel.image()));
const SDL_Rect screen = screen_area();
SDL_Rect& loc = panel.location(screen);
DBG_DP << "panel location: x=" << loc.x << ", y=" << loc.y
<< ", w=" << loc.w << ", h=" << loc.h << "\n";
if(!surf.null()) {
if(surf->w != loc.w || surf->h != loc.h) {
surf.assign(scale_surface(surf,loc.w,loc.h));

View file

@ -1173,9 +1173,12 @@ bool do_replay_handle(game_display& disp, const gamemap& map, const game_data& g
replay::throw_error("illegal defender weapon type in attack\n");
}
DBG_REPLAY << "Attacker XP (before attack): " << u->second.experience() << "\n";;
DELAY_END_LEVEL(delayed_exception, attack(disp, map, teams, src, dst, weapon_num, def_weapon_num, units, state, gameinfo, !get_replay_source().is_skipping()));
DBG_REPLAY << "Attacker XP (after attack): " << u->second.experience() << "\n";;
u = units.find(src);
tgt = units.find(dst);
@ -1183,6 +1186,7 @@ bool do_replay_handle(game_display& disp, const gamemap& map, const game_data& g
advancing_units.push_back(u->first);
}
DBG_REPLAY << "advancing_units.size: " << advancing_units.size() << "\n";
if(tgt != units.end() && tgt->second.advances()) {
advancing_units.push_back(tgt->first);
}
@ -1215,7 +1219,7 @@ bool do_replay_handle(game_display& disp, const gamemap& map, const game_data& g
} else {
if(! cfg->child("checksum")) {
replay::throw_error("unrecognized action\n");
replay::throw_error("unrecognized action:\n" + cfg->debug());
} else {
check_checksums(disp,units,*cfg);
}