← Back to team overview

widelands-dev team mailing list archive

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

 

cghislai has proposed merging lp:~widelands-dev/widelands/bug1204171 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1204171 in widelands: "Can't select ware in ware statistics window"
  https://bugs.launchpad.net/widelands/+bug/1204171

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

This fixes another regression in which a callback function was not called on ware selection. It was visible in the ware statistics menu.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug1204171/+merge/176426
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug1204171 into lp:widelands.
=== modified file 'src/wui/waresdisplay.cc'
--- src/wui/waresdisplay.cc	2013-07-17 11:15:29 +0000
+++ src/wui/waresdisplay.cc	2013-07-23 16:38:26 +0000
@@ -402,6 +402,8 @@
 
 	m_selected[ware] = true;
 	update();
+	if (m_callback_function)
+			m_callback_function(ware, true);
 }
 
 void AbstractWaresDisplay::unselect_ware(Widelands::Ware_Index ware)
@@ -411,6 +413,8 @@
 
 	m_selected[ware] = false;
 	update();
+	if (m_callback_function)
+			m_callback_function(ware, false);
 }
 
 bool AbstractWaresDisplay::ware_selected(Widelands::Ware_Index ware) {

=== modified file 'src/wui/waresdisplay.h'
--- src/wui/waresdisplay.h	2013-07-21 14:36:52 +0000
+++ src/wui/waresdisplay.h	2013-07-23 16:38:26 +0000
@@ -63,14 +63,6 @@
 	void select_ware(Widelands::Ware_Index);
 	void unselect_ware(Widelands::Ware_Index);
 	bool ware_selected(Widelands::Ware_Index);
-	void toggle_ware(Widelands::Ware_Index ware) {
-		if (ware_selected(ware))
-			unselect_ware(ware);
-		else
-			select_ware(ware);
-		if (m_callback_function)
-			m_callback_function(ware, ware_selected(ware));
-	}
 
 	// Wares may be hidden
 	void hide_ware(Widelands::Ware_Index);


Follow ups