← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/ship_DBG_window into lp:widelands

 

TiborB has proposed merging lp:~widelands-dev/widelands/ship_DBG_window into lp:widelands.

Requested reviews:
  GunChleoc (gunchleoc)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/ship_DBG_window/+merge/289110

Added DBG (debug) window to a ship
-- 
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ship_DBG_window.
=== modified file 'src/wui/shipwindow.cc'
--- src/wui/shipwindow.cc	2016-02-15 23:26:42 +0000
+++ src/wui/shipwindow.cc	2016-03-15 20:59:08 +0000
@@ -28,6 +28,7 @@
 #include "logic/player.h"
 #include "ui_basic/box.h"
 #include "wui/actionconfirm.h"
+#include "wui/game_debug_ui.h"
 #include "wui/interactive_gamebase.h"
 #include "wui/interactive_player.h"
 #include "wui/itemwaresdisplay.h"
@@ -35,6 +36,7 @@
 static const char pic_goto[] = "images/wui/ship/menu_ship_goto.png";
 static const char pic_destination[] = "images/wui/ship/menu_ship_destination.png";
 static const char pic_sink[]     = "images/wui/ship/menu_ship_sink.png";
+static const char pic_debug[]     = "images/wui/fieldaction/menu_debug.png";
 static const char pic_cancel_expedition[] = "images/wui/ship/menu_ship_cancel_expedition.png";
 static const char pic_explore_cw[]  = "images/wui/ship/ship_explore_island_cw.png";
 static const char pic_explore_ccw[] = "images/wui/ship/ship_explore_island_ccw.png";
@@ -67,6 +69,7 @@
 	void act_goto();
 	void act_destination();
 	void act_sink();
+	void act_debug();
 	void act_cancel_expedition();
 	void act_scout_towards(WalkingDir);
 	void act_construct_port();
@@ -79,6 +82,7 @@
 	UI::Button * m_btn_goto;
 	UI::Button * m_btn_destination;
 	UI::Button * m_btn_sink;
+	UI::Button * m_btn_debug;
 	UI::Button * m_btn_cancel_expedition;
 	UI::Button * m_btn_explore_island_cw;
 	UI::Button * m_btn_explore_island_ccw;
@@ -187,6 +191,7 @@
 		make_button
 			(buttons, "sink", _("Sink the ship"), pic_sink, boost::bind(&ShipWindow::act_sink, this));
 	buttons->add(m_btn_sink, UI::Align::kLeft, false);
+
 	if (m_ship.state_is_expedition()) {
 		m_btn_cancel_expedition =
 			make_button
@@ -194,6 +199,16 @@
 				boost::bind(&ShipWindow::act_cancel_expedition, this));
 		buttons->add(m_btn_cancel_expedition, UI::Align::kLeft, false);
 	}
+
+	if (m_igbase.get_display_flag(InteractiveBase::dfDebug)) {
+		m_btn_debug =
+			make_button
+				(buttons, "debug", _("Show Debug Window"), pic_debug,
+				boost::bind(&ShipWindow::act_debug, this));
+		m_btn_debug->set_enabled(true);
+		buttons->add
+			(m_btn_debug, UI::Align::kLeft, false);
+	}
 	set_center_panel(vbox);
 	set_thinks(true);
 
@@ -299,6 +314,12 @@
 	}
 }
 
+/// Show debug info
+void ShipWindow::act_debug()
+{
+	show_mapobject_debug(m_igbase, m_ship);
+}
+
 /// Cancel expedition if confirmed
 void ShipWindow::act_cancel_expedition()
 {


Follow ups