← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~mxsscott/widelands/984197 into lp:widelands

 

Mark Scott has proposed merging lp:~mxsscott/widelands/984197 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~mxsscott/widelands/984197/+merge/143601

Added check for Ctrl key before showing confirmation window regarding destruction of building that will result from ripping a flag.
-- 
https://code.launchpad.net/~mxsscott/widelands/984197/+merge/143601
Your team Widelands Developers is requested to review the proposed merge of lp:~mxsscott/widelands/984197 into lp:widelands.
=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc	2012-12-14 20:09:35 +0000
+++ src/wui/fieldaction.cc	2013-01-16 21:56:41 +0000
@@ -20,6 +20,7 @@
 #include "fieldaction.h"
 
 #include "attack_box.h"
+#include "buildingconfirm.h"
 #include "logic/attackable.h"
 #include "logic/cmd_queue.h"
 #include "economy/economy.h"
@@ -163,7 +164,8 @@
 
 ==============================================================================
 */
-struct FieldActionWindow : public UI::UniqueWindow {
+class FieldActionWindow : public UI::UniqueWindow {
+public:
 	FieldActionWindow
 		(Interactive_Base           * ibase,
 		 Widelands::Player          * plr,
@@ -763,11 +765,18 @@
 	Widelands::Editor_Game_Base & egbase = ibase().egbase();
 	if (upcast(Widelands::Flag, flag, m_node.field->get_immovable())) {
 		if (Building * const building = flag->get_building()) {
-			if (building->get_playercaps() & Building::PCap_Bulldoze)
-				show_bulldoze_confirm
-					(ref_cast<Interactive_Player, Interactive_Base>(ibase()),
-					 *building,
-					 flag);
+			if (building->get_playercaps() & Building::PCap_Bulldoze) {
+				if (get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL)) {
+					ref_cast<Game, Editor_Game_Base>(egbase).send_player_bulldoze
+						(*flag);
+				}
+				else {
+					show_bulldoze_confirm
+						(ref_cast<Interactive_Player, Interactive_Base>(ibase()),
+						 *building,
+						 flag);
+				}
+			}
 		} else {
 			ref_cast<Game, Editor_Game_Base>(egbase).send_player_bulldoze
 					(*flag, get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL));

=== modified file 'src/wui/fieldaction.h'
--- src/wui/fieldaction.h	2012-02-15 21:25:34 +0000
+++ src/wui/fieldaction.h	2013-01-16 21:56:41 +0000
@@ -36,10 +36,4 @@
 	 Widelands::Player          * player,
 	 UI::UniqueWindow::Registry * registry);
 
-// building_ui.cc
-void show_bulldoze_confirm
-	(Interactive_Player         & parent,
-	 Widelands::Building        & building,
-	 Widelands::PlayerImmovable * const todestroy);
-
 #endif