widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #12991
[Merge] lp:~widelands-dev/widelands/bug-1615826-constructionsite-help into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1615826-constructionsite-help into lp:widelands.
Commit message:
Constructionsites' help button now points to the help for the building being built.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1615826 in widelands: "Show full encylopedia for buildings under construction"
https://bugs.launchpad.net/widelands/+bug/1615826
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1615826-constructionsite-help/+merge/342705
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1615826-constructionsite-help into lp:widelands.
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2017-11-30 13:07:13 +0000
+++ src/wui/buildingwindow.cc 2018-04-05 07:28:01 +0000
@@ -48,11 +48,13 @@
BuildingWindow::BuildingWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::Building& b,
+ const Widelands::BuildingDescr& descr,
bool avoid_fastclick)
: UI::UniqueWindow(&parent, "building_window", ®, Width, 0, b.descr().descname()),
is_dying_(false),
parent_(&parent),
building_(&b),
+ building_descr_for_help_(descr),
building_position_(b.get_position()),
showing_workarea_(false),
avoid_fastclick_(avoid_fastclick),
@@ -61,6 +63,13 @@
[this](const Widelands::NoteBuilding& note) { on_building_note(note); });
}
+BuildingWindow::BuildingWindow(InteractiveGameBase& parent,
+ UI::UniqueWindow::Registry& reg,
+ Widelands::Building& b,
+ bool avoid_fastclick)
+ : BuildingWindow(parent, reg, b, b.descr(), avoid_fastclick) {
+}
+
BuildingWindow::~BuildingWindow() {
hide_workarea();
}
@@ -340,7 +349,7 @@
if (building_in_lambda == nullptr) {
return;
}
- new UI::BuildingHelpWindow(igbase(), registry, building_in_lambda->descr(),
+ new UI::BuildingHelpWindow(igbase(), registry, building_descr_for_help_,
building_in_lambda->owner().tribe(), &parent_->egbase().lua());
};
=== modified file 'src/wui/buildingwindow.h'
--- src/wui/buildingwindow.h 2017-12-02 08:04:31 +0000
+++ src/wui/buildingwindow.h 2018-04-05 07:28:01 +0000
@@ -43,6 +43,16 @@
Width = 4 * 34 // 4 normally sized buttons
};
+protected:
+ // This constructor allows setting a building description for the help button independent of the
+ // base building
+ BuildingWindow(InteractiveGameBase& parent,
+ UI::UniqueWindow::Registry& reg,
+ Widelands::Building&,
+ const Widelands::BuildingDescr&,
+ bool avoid_fastclick);
+
+public:
BuildingWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::Building&,
@@ -93,8 +103,12 @@
InteractiveGameBase* parent_;
+ // The building that this window belongs to
Widelands::OPtr<Widelands::Building> building_;
+ // The building description that will be used for the help button
+ const Widelands::BuildingDescr& building_descr_for_help_;
+
// We require this to unregister overlays when we are closed. Since the
// building might have been destroyed by then we have to keep a copy of its
// position around.
=== modified file 'src/wui/constructionsitewindow.cc'
--- src/wui/constructionsitewindow.cc 2017-12-01 09:17:44 +0000
+++ src/wui/constructionsitewindow.cc 2018-04-05 07:28:01 +0000
@@ -31,7 +31,7 @@
UI::UniqueWindow::Registry& reg,
Widelands::ConstructionSite& cs,
bool avoid_fastclick)
- : BuildingWindow(parent, reg, cs, avoid_fastclick), construction_site_(&cs), progress_(nullptr) {
+ : BuildingWindow(parent, reg, cs, cs.building(), avoid_fastclick), construction_site_(&cs), progress_(nullptr) {
init(avoid_fastclick);
}
Follow ups