Merge lp:~widelands-dev/widelands/bug-1615826-constructionsite-help into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8642
Proposed branch: lp:~widelands-dev/widelands/bug-1615826-constructionsite-help
Merge into: lp:widelands
Diff against target: 86 lines (+25/-2)
3 files modified
src/wui/buildingwindow.cc (+10/-1)
src/wui/buildingwindow.h (+14/-0)
src/wui/constructionsitewindow.cc (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1615826-constructionsite-help
Reviewer Review Type Date Requested Status
Klaus Halfmann review, compile, testplay Approve
Review via email: mp+342705@code.launchpad.net

Commit message

Constructionsites' help button now points to the help for the building being built.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3344. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/362501908.
Appveyor build 3150. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1615826_constructionsite_help-3150.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

I had the very same idea once upon a while.

Code Review is fine, no objections herer.

will check this with some testplay.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

All fine.

@bunnybot merge

review: Approve (review, compile, testplay)

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 2017-11-30 13:07:13 +0000
3+++ src/wui/buildingwindow.cc 2018-04-05 07:28:01 +0000
4@@ -48,11 +48,13 @@
5 BuildingWindow::BuildingWindow(InteractiveGameBase& parent,
6 UI::UniqueWindow::Registry& reg,
7 Widelands::Building& b,
8+ const Widelands::BuildingDescr& descr,
9 bool avoid_fastclick)
10 : UI::UniqueWindow(&parent, "building_window", &reg, Width, 0, b.descr().descname()),
11 is_dying_(false),
12 parent_(&parent),
13 building_(&b),
14+ building_descr_for_help_(descr),
15 building_position_(b.get_position()),
16 showing_workarea_(false),
17 avoid_fastclick_(avoid_fastclick),
18@@ -61,6 +63,13 @@
19 [this](const Widelands::NoteBuilding& note) { on_building_note(note); });
20 }
21
22+BuildingWindow::BuildingWindow(InteractiveGameBase& parent,
23+ UI::UniqueWindow::Registry& reg,
24+ Widelands::Building& b,
25+ bool avoid_fastclick)
26+ : BuildingWindow(parent, reg, b, b.descr(), avoid_fastclick) {
27+}
28+
29 BuildingWindow::~BuildingWindow() {
30 hide_workarea();
31 }
32@@ -340,7 +349,7 @@
33 if (building_in_lambda == nullptr) {
34 return;
35 }
36- new UI::BuildingHelpWindow(igbase(), registry, building_in_lambda->descr(),
37+ new UI::BuildingHelpWindow(igbase(), registry, building_descr_for_help_,
38 building_in_lambda->owner().tribe(), &parent_->egbase().lua());
39 };
40
41
42=== modified file 'src/wui/buildingwindow.h'
43--- src/wui/buildingwindow.h 2017-12-02 08:04:31 +0000
44+++ src/wui/buildingwindow.h 2018-04-05 07:28:01 +0000
45@@ -43,6 +43,16 @@
46 Width = 4 * 34 // 4 normally sized buttons
47 };
48
49+protected:
50+ // This constructor allows setting a building description for the help button independent of the
51+ // base building
52+ BuildingWindow(InteractiveGameBase& parent,
53+ UI::UniqueWindow::Registry& reg,
54+ Widelands::Building&,
55+ const Widelands::BuildingDescr&,
56+ bool avoid_fastclick);
57+
58+public:
59 BuildingWindow(InteractiveGameBase& parent,
60 UI::UniqueWindow::Registry& reg,
61 Widelands::Building&,
62@@ -93,8 +103,12 @@
63
64 InteractiveGameBase* parent_;
65
66+ // The building that this window belongs to
67 Widelands::OPtr<Widelands::Building> building_;
68
69+ // The building description that will be used for the help button
70+ const Widelands::BuildingDescr& building_descr_for_help_;
71+
72 // We require this to unregister overlays when we are closed. Since the
73 // building might have been destroyed by then we have to keep a copy of its
74 // position around.
75
76=== modified file 'src/wui/constructionsitewindow.cc'
77--- src/wui/constructionsitewindow.cc 2017-12-01 09:17:44 +0000
78+++ src/wui/constructionsitewindow.cc 2018-04-05 07:28:01 +0000
79@@ -31,7 +31,7 @@
80 UI::UniqueWindow::Registry& reg,
81 Widelands::ConstructionSite& cs,
82 bool avoid_fastclick)
83- : BuildingWindow(parent, reg, cs, avoid_fastclick), construction_site_(&cs), progress_(nullptr) {
84+ : BuildingWindow(parent, reg, cs, cs.building(), avoid_fastclick), construction_site_(&cs), progress_(nullptr) {
85 init(avoid_fastclick);
86 }
87

Subscribers

People subscribed via source and target branches

to status/vote changes: