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

Proposed by cghislai on 2013-08-02
Status: Merged
Merged at revision: 6696
Proposed branch: lp:~widelands-dev/widelands/workarea_csite
Merge into: lp:widelands
Diff against target: 35 lines (+16/-2)
1 file modified
src/wui/buildingwindow.cc (+16/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/workarea_csite
Reviewer Review Type Date Requested Status
SirVer 2013-08-02 Approve on 2013-08-05
Review via email: mp+178220@code.launchpad.net

Description of the change

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...

To post a comment you must log in.
SirVer (sirver) wrote :

Looks good. Merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/buildingwindow.cc'
2--- src/wui/buildingwindow.cc 2013-07-27 10:35:55 +0000
3+++ src/wui/buildingwindow.cc 2013-08-02 08:25:49 +0000
4@@ -296,7 +296,13 @@
5 }
6
7 if (can_see) {
8- if (m_building.descr().m_workarea_info.size()) {
9+ Workarea_Info wa_info;
10+ if (upcast(Widelands::ConstructionSite, csite, &m_building)) {
11+ wa_info = csite->building().m_workarea_info;
12+ } else {
13+ wa_info = m_building.descr().m_workarea_info;
14+ }
15+ if (wa_info.size()) {
16 m_toggle_workarea = new UI::Button
17 (capsbuttons, "workarea",
18 0, 0, 34, 34,
19@@ -489,7 +495,15 @@
20 if (m_workarea_job_id) {
21 return; // already shown, nothing to be done
22 }
23- const Workarea_Info & workarea_info = m_building.descr().m_workarea_info;
24+ Workarea_Info workarea_info;
25+ if (upcast(Widelands::ConstructionSite, csite, &m_building)) {
26+ workarea_info = csite->building().m_workarea_info;
27+ } else {
28+ workarea_info = m_building.descr().m_workarea_info;
29+ }
30+ if (!workarea_info.size()) {
31+ return;
32+ }
33 m_workarea_job_id = igbase().show_work_area(workarea_info, m_building.get_position());
34
35 configure_workarea_button();