← Back to team overview

widelands-dev team mailing list archive

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

 

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

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #803284 in widelands: "While building, show range of the building on construction site"
  https://bugs.launchpad.net/widelands/+bug/803284

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

This restore a change that was lost during a merging of trunk in the branch csite_improvement.
This add workarea preview for construction sites - with the button this time
Thanks Hans for pointing this down, i didn't even notice...
-- 
https://code.launchpad.net/~widelands-dev/widelands/workarea_csite/+merge/178220
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/workarea_csite into lp:widelands.
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc	2013-07-27 10:35:55 +0000
+++ src/wui/buildingwindow.cc	2013-08-02 08:25:49 +0000
@@ -296,7 +296,13 @@
 	}
 
 	if (can_see) {
-		if (m_building.descr().m_workarea_info.size()) {
+		Workarea_Info wa_info;
+		if (upcast(Widelands::ConstructionSite, csite, &m_building)) {
+			wa_info = csite->building().m_workarea_info;
+		} else {
+			wa_info = m_building.descr().m_workarea_info;
+		}
+		if (wa_info.size()) {
 			m_toggle_workarea = new UI::Button
 				(capsbuttons, "workarea",
 				 0, 0, 34, 34,
@@ -489,7 +495,15 @@
 	if (m_workarea_job_id) {
 		return; // already shown, nothing to be done
 	}
-	const Workarea_Info & workarea_info = m_building.descr().m_workarea_info;
+	Workarea_Info workarea_info;
+	if (upcast(Widelands::ConstructionSite, csite, &m_building)) {
+		workarea_info = csite->building().m_workarea_info;
+	} else {
+		workarea_info = m_building.descr().m_workarea_info;
+	}
+	if (!workarea_info.size()) {
+		return;
+	}
 	m_workarea_job_id = igbase().show_work_area(workarea_info, m_building.get_position());
 
 	configure_workarea_button();


Follow ups