widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #13885
[Merge] lp:~widelands-dev/widelands/bug-1619402-port-work-area-on-expedition into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1619402-port-work-area-on-expedition into lp:widelands.
Commit message:
Redesigned and fixed the showing of workarea overlays
- While placing a building, the overlays are now always on
- Removed the global "Show workarea preview" option
- When a new building window is opened, the workarea overlay is off
by default
- When a wanted window is created, the state of its predecessor is remembered
- Hide overlays for dismantlesites
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1619402 in widelands: "Port's work area lights up on expedition event"
https://bugs.launchpad.net/widelands/+bug/1619402
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1619402-port-work-area-on-expedition/+merge/349594
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1619402-port-work-area-on-expedition into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/workarea_info.h'
--- src/logic/map_objects/tribes/workarea_info.h 2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/tribes/workarea_info.h 2018-07-14 11:32:06 +0000
@@ -36,7 +36,7 @@
* that can be upgraded like a Fortress, and will have a bigger
* workarea then.
*
- * See LuaBuildingDescription::get_workarea_radius, InteractiveBase::show_work_area
+ * See LuaBuildingDescription::get_workarea_radius, InteractiveBase::show_workarea
*/
// TODO(Hasi50): We could just use a unit8 as base for the map? We should
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2018-05-13 07:15:39 +0000
+++ src/ui_fsmenu/options.cc 2018-07-14 11:32:06 +0000
@@ -208,7 +208,6 @@
// Game options
auto_roadbuild_mode_(
&box_game_, Vector2i::zero(), _("Start building road after placing a flag")),
- show_workarea_preview_(&box_game_, Vector2i::zero(), _("Show buildings area preview")),
transparent_chat_(
&box_game_, Vector2i::zero(), _("Show in-game chat with transparent background"), "", 0),
@@ -275,7 +274,6 @@
// Game
box_game_.add(&auto_roadbuild_mode_);
- box_game_.add(&show_workarea_preview_);
box_game_.add(&transparent_chat_);
box_game_.add(&single_watchwin_);
@@ -347,7 +345,6 @@
// Game options
auto_roadbuild_mode_.set_state(opt.auto_roadbuild_mode);
- show_workarea_preview_.set_state(opt.show_warea);
transparent_chat_.set_state(opt.transparent_chat);
single_watchwin_.set_state(opt.single_watchwin);
@@ -590,7 +587,6 @@
// Game options
os_.auto_roadbuild_mode = auto_roadbuild_mode_.get_state();
- os_.show_warea = show_workarea_preview_.get_state();
os_.transparent_chat = transparent_chat_.get_state();
os_.single_watchwin = single_watchwin_.get_state();
@@ -651,7 +647,6 @@
// Game options
opt.auto_roadbuild_mode = opt_section_.get_bool("auto_roadbuild_mode", true);
- opt.show_warea = opt_section_.get_bool("workareapreview", true);
opt.transparent_chat = opt_section_.get_bool("transparent_chat", true);
opt.single_watchwin = opt_section_.get_bool("single_watchwin", false);
@@ -693,7 +688,6 @@
// Game options
opt_section_.set_bool("auto_roadbuild_mode", opt.auto_roadbuild_mode);
- opt_section_.set_bool("workareapreview", opt.show_warea);
opt_section_.set_bool("transparent_chat", opt.transparent_chat);
opt_section_.set_bool("single_watchwin", opt.single_watchwin);
=== modified file 'src/ui_fsmenu/options.h'
--- src/ui_fsmenu/options.h 2018-04-27 06:11:05 +0000
+++ src/ui_fsmenu/options.h 2018-07-14 11:32:06 +0000
@@ -69,7 +69,6 @@
// Game options
bool auto_roadbuild_mode;
- bool show_warea;
bool transparent_chat;
bool single_watchwin;
@@ -156,7 +155,6 @@
// Game options
UI::Checkbox auto_roadbuild_mode_;
- UI::Checkbox show_workarea_preview_;
UI::Checkbox transparent_chat_;
UI::Checkbox single_watchwin_;
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2018-07-07 19:20:22 +0000
+++ src/wlapplication.cc 2018-07-14 11:32:06 +0000
@@ -744,7 +744,6 @@
s.get_bool("single_watchwin");
s.get_bool("auto_roadbuild_mode");
// Undocumented on command line, appears in game options
- s.get_bool("workareapreview");
s.get_bool("nozip");
s.get_bool("snap_windows_only_when_overlapping");
s.get_bool("dock_windows_to_edges");
=== modified file 'src/wui/actionconfirm.cc'
--- src/wui/actionconfirm.cc 2018-04-27 06:11:05 +0000
+++ src/wui/actionconfirm.cc 2018-07-14 11:32:06 +0000
@@ -247,6 +247,7 @@
if (building && iaplayer().can_act(building->owner().player_number()) &&
(building->get_playercaps() & Widelands::Building::PCap_Dismantle)) {
game.send_player_dismantle(*todismantle);
+ iaplayer().hide_workarea(building->get_position());
}
die();
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2018-04-27 06:11:05 +0000
+++ src/wui/buildingwindow.cc 2018-07-14 11:32:06 +0000
@@ -58,6 +58,7 @@
building_position_(b.get_position()),
showing_workarea_(false),
avoid_fastclick_(avoid_fastclick),
+ is_warping_(false),
expeditionbtn_(nullptr) {
buildingnotes_subscriber_ = Notifications::subscribe<Widelands::NoteBuilding>(
[this](const Widelands::NoteBuilding& note) { on_building_note(note); });
@@ -71,7 +72,9 @@
}
BuildingWindow::~BuildingWindow() {
- hide_workarea();
+ if (!is_warping_) {
+ hide_workarea();
+ }
}
void BuildingWindow::on_building_note(const Widelands::NoteBuilding& note) {
@@ -80,12 +83,13 @@
// The building's state has changed
case Widelands::NoteBuilding::Action::kChanged:
if (!is_dying_) {
- init(true);
+ init(true, showing_workarea_);
}
break;
// The building is no more. Next think() will call die().
case Widelands::NoteBuilding::Action::kStartWarp:
igbase()->add_wanted_building_window(building_position_, get_pos(), is_minimal());
+ is_warping_ = true;
break;
default:
break;
@@ -93,7 +97,7 @@
}
}
-void BuildingWindow::init(bool avoid_fastclick) {
+void BuildingWindow::init(bool avoid_fastclick, bool workarea_preview_wanted) {
capscache_player_number_ = 0;
capsbuttons_ = nullptr;
capscache_ = 0;
@@ -115,13 +119,16 @@
set_center_panel(vbox_.get());
set_thinks(true);
set_fastclick_panel(this);
- show_workarea();
+ if (workarea_preview_wanted) {
+ show_workarea();
+ } else {
+ hide_workarea();
+ }
}
// Stop everybody from thinking to avoid segfaults
void BuildingWindow::die() {
is_dying_ = true;
- hide_workarea();
set_thinks(false);
vbox_.reset(nullptr);
UniqueWindow::die();
@@ -385,8 +392,10 @@
void BuildingWindow::act_dismantle() {
Widelands::Building* building = building_.get(parent_->egbase());
if (SDL_GetModState() & KMOD_CTRL) {
- if (building->get_playercaps() & Widelands::Building::PCap_Dismantle)
+ if (building->get_playercaps() & Widelands::Building::PCap_Dismantle) {
igbase()->game().send_player_dismantle(*building);
+ hide_workarea();
+ }
} else {
show_dismantle_confirm(dynamic_cast<InteractivePlayer&>(*igbase()), *building);
}
@@ -480,7 +489,7 @@
if (workarea_info->empty()) {
return;
}
- igbase()->show_work_area(*workarea_info, building_position_);
+ igbase()->show_workarea(*workarea_info, building_position_);
showing_workarea_ = true;
configure_workarea_button();
@@ -491,7 +500,7 @@
*/
void BuildingWindow::hide_workarea() {
if (showing_workarea_) {
- igbase()->hide_work_area(building_position_);
+ igbase()->hide_workarea(building_position_);
showing_workarea_ = false;
configure_workarea_button();
}
=== modified file 'src/wui/buildingwindow.h'
--- src/wui/buildingwindow.h 2018-04-27 06:11:05 +0000
+++ src/wui/buildingwindow.h 2018-07-14 11:32:06 +0000
@@ -69,7 +69,7 @@
void think() override;
protected:
- virtual void init(bool avoid_fastclick);
+ virtual void init(bool avoid_fastclick, bool workarea_preview_wanted);
void die() override;
UI::TabPanel* get_tabs() {
@@ -129,6 +129,7 @@
bool showing_workarea_;
bool avoid_fastclick_;
+ bool is_warping_;
UI::Button* expeditionbtn_;
std::unique_ptr<Notifications::Subscriber<Widelands::NoteExpeditionCanceled>>
=== modified file 'src/wui/constructionsitewindow.cc'
--- src/wui/constructionsitewindow.cc 2018-04-27 06:11:05 +0000
+++ src/wui/constructionsitewindow.cc 2018-07-14 11:32:06 +0000
@@ -29,18 +29,18 @@
ConstructionSiteWindow::ConstructionSiteWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::ConstructionSite& cs,
- bool avoid_fastclick)
+ bool avoid_fastclick, bool workarea_preview_wanted)
: BuildingWindow(parent, reg, cs, cs.building(), avoid_fastclick),
construction_site_(&cs),
progress_(nullptr) {
- init(avoid_fastclick);
+ init(avoid_fastclick, workarea_preview_wanted);
}
-void ConstructionSiteWindow::init(bool avoid_fastclick) {
+void ConstructionSiteWindow::init(bool avoid_fastclick, bool workarea_preview_wanted) {
Widelands::ConstructionSite* construction_site = construction_site_.get(igbase()->egbase());
assert(construction_site != nullptr);
- BuildingWindow::init(avoid_fastclick);
+ BuildingWindow::init(avoid_fastclick, workarea_preview_wanted);
UI::Box& box = *new UI::Box(get_tabs(), 0, 0, UI::Box::Vertical);
// Add the progress bar
=== modified file 'src/wui/constructionsitewindow.h'
--- src/wui/constructionsitewindow.h 2018-04-07 16:59:00 +0000
+++ src/wui/constructionsitewindow.h 2018-07-14 11:32:06 +0000
@@ -31,12 +31,13 @@
ConstructionSiteWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::ConstructionSite&,
- bool avoid_fastclick);
+ bool avoid_fastclick,
+ bool workarea_preview_wanted);
void think() override;
protected:
- void init(bool avoid_fastclick) override;
+ void init(bool avoid_fastclick, bool workarea_preview_wanted) override;
private:
Widelands::OPtr<Widelands::ConstructionSite> construction_site_;
=== modified file 'src/wui/dismantlesitewindow.cc'
--- src/wui/dismantlesitewindow.cc 2018-04-27 06:11:05 +0000
+++ src/wui/dismantlesitewindow.cc 2018-07-14 11:32:06 +0000
@@ -28,14 +28,14 @@
Widelands::DismantleSite& ds,
bool avoid_fastclick)
: BuildingWindow(parent, reg, ds, avoid_fastclick), dismantle_site_(&ds), progress_(nullptr) {
- init(avoid_fastclick);
+ init(avoid_fastclick, false);
}
-void DismantleSiteWindow::init(bool avoid_fastclick) {
+void DismantleSiteWindow::init(bool avoid_fastclick, bool workarea_preview_wanted) {
Widelands::DismantleSite* dismantle_site = dismantle_site_.get(igbase()->egbase());
assert(dismantle_site != nullptr);
- BuildingWindow::init(avoid_fastclick);
+ BuildingWindow::init(avoid_fastclick, workarea_preview_wanted);
UI::Box& box = *new UI::Box(get_tabs(), 0, 0, UI::Box::Vertical);
// Add the progress bar
=== modified file 'src/wui/dismantlesitewindow.h'
--- src/wui/dismantlesitewindow.h 2018-04-07 16:59:00 +0000
+++ src/wui/dismantlesitewindow.h 2018-07-14 11:32:06 +0000
@@ -36,7 +36,7 @@
void think() override;
private:
- void init(bool avoid_fastclick) override;
+ void init(bool avoid_fastclick, bool workarea_preview_wanted) override;
Widelands::OPtr<Widelands::DismantleSite> dismantle_site_;
UI::ProgressBar* progress_;
=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc 2018-04-27 06:11:05 +0000
+++ src/wui/fieldaction.cc 2018-07-14 11:32:06 +0000
@@ -257,7 +257,7 @@
FieldActionWindow::~FieldActionWindow() {
if (showing_workarea_preview_)
- ibase().hide_work_area(node_);
+ ibase().hide_workarea(node_);
ibase().set_sel_freeze(false);
delete attack_box_;
}
@@ -684,16 +684,16 @@
void FieldActionWindow::building_icon_mouse_out(Widelands::DescriptionIndex) {
if (showing_workarea_preview_) {
- ibase().hide_work_area(node_);
+ ibase().hide_workarea(node_);
showing_workarea_preview_ = false;
}
}
void FieldActionWindow::building_icon_mouse_in(const Widelands::DescriptionIndex idx) {
- if (ibase().show_workarea_preview_ && !showing_workarea_preview_) {
+ if (!showing_workarea_preview_) {
const WorkareaInfo& workarea_info =
player_->tribe().get_building_descr(Widelands::DescriptionIndex(idx))->workarea_info();
- ibase().show_work_area(workarea_info, node_);
+ ibase().show_workarea(workarea_info, node_);
showing_workarea_preview_ = true;
}
}
=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc 2018-05-13 07:15:39 +0000
+++ src/wui/interactive_base.cc 2018-07-14 11:32:06 +0000
@@ -92,7 +92,6 @@
InteractiveBase::InteractiveBase(EditorGameBase& the_egbase, Section& global_s)
: UI::Panel(nullptr, 0, 0, g_gr->get_xres(), g_gr->get_yres()),
- show_workarea_preview_(global_s.get_bool("workareapreview", true)),
buildhelp_(false),
map_view_(this, the_egbase.map(), 0, 0, g_gr->get_xres(), g_gr->get_yres()),
// Initialize chatoveraly before the toolbar so it is below
@@ -203,6 +202,10 @@
return nullptr;
}
+bool InteractiveBase::has_workarea_preview(const Widelands::Coords& coords) const {
+ return workarea_previews_.count(coords) == 1;
+}
+
UniqueWindowHandler& InteractiveBase::unique_windows() {
return *unique_window_handler_;
}
@@ -298,14 +301,14 @@
}
// Show the given workareas at the given coords and returns the overlay job id associated
-void InteractiveBase::show_work_area(const WorkareaInfo& workarea_info, Widelands::Coords coords) {
- work_area_previews_[coords] = &workarea_info;
+void InteractiveBase::show_workarea(const WorkareaInfo& workarea_info, Widelands::Coords coords) {
+ workarea_previews_[coords] = &workarea_info;
}
std::map<Coords, const Image*>
-InteractiveBase::get_work_area_overlays(const Widelands::Map& map) const {
+InteractiveBase::get_workarea_overlays(const Widelands::Map& map) const {
std::map<Coords, const Image*> result;
- for (const auto& pair : work_area_previews_) {
+ for (const auto& pair : workarea_previews_) {
const Coords& coords = pair.first;
const WorkareaInfo* workarea_info = pair.second;
WorkareaInfo::size_type wa_index;
@@ -343,8 +346,8 @@
return result;
}
-void InteractiveBase::hide_work_area(const Widelands::Coords& coords) {
- work_area_previews_.erase(coords);
+void InteractiveBase::hide_workarea(const Widelands::Coords& coords) {
+ workarea_previews_.erase(coords);
}
/**
=== modified file 'src/wui/interactive_base.h'
--- src/wui/interactive_base.h 2018-05-16 05:30:22 +0000
+++ src/wui/interactive_base.h 2018-07-14 11:32:06 +0000
@@ -86,10 +86,8 @@
return egbase_;
}
- // TODO(sirver): This should be private.
- bool show_workarea_preview_;
- void show_work_area(const WorkareaInfo& workarea_info, Widelands::Coords coords);
- void hide_work_area(const Widelands::Coords& coords);
+ void show_workarea(const WorkareaInfo& workarea_info, Widelands::Coords coords);
+ void hide_workarea(const Widelands::Coords& coords);
// point of view for drawing
virtual Widelands::Player* get_player() const = 0;
@@ -219,7 +217,7 @@
// Returns the current overlays for the work area previews.
std::map<Widelands::Coords, const Image*>
- get_work_area_overlays(const Widelands::Map& map) const;
+ get_workarea_overlays(const Widelands::Map& map) const;
// Returns the 'BuildhelpOverlay' for 'caps' or nullptr if there is no help
// to be displayed on this field.
@@ -229,6 +227,9 @@
return road_building_overlays_;
}
+ /// Returns true if there is a workarea preview being shown at the given coordinates
+ bool has_workarea_preview(const Widelands::Coords& coords) const;
+
private:
int32_t stereo_position(Widelands::Coords position_map);
void resize_chat_overlay();
@@ -268,7 +269,7 @@
// The currently enabled work area previews. They are keyed by the
// coordinate that the building that shows the work area is positioned.
- std::map<Widelands::Coords, const WorkareaInfo*> work_area_previews_;
+ std::map<Widelands::Coords, const WorkareaInfo*> workarea_previews_;
RoadBuildingOverlays road_building_overlays_;
=== modified file 'src/wui/interactive_gamebase.cc'
--- src/wui/interactive_gamebase.cc 2018-04-29 09:20:29 +0000
+++ src/wui/interactive_gamebase.cc 2018-07-14 11:32:06 +0000
@@ -69,11 +69,12 @@
if (upcast(
Widelands::Building const, building, game().objects().get_object(note.serial))) {
const Widelands::Coords coords = building->get_position();
- // Check whether the window is wanted
- if (wanted_building_windows_.count(coords.hash()) == 1) {
- UI::UniqueWindow* building_window = show_building_window(coords, true);
- building_window->set_pos(wanted_building_windows_.at(coords.hash()).first);
- if (wanted_building_windows_.at(coords.hash()).second) {
+ // Register the building serial if the window is wanted
+ if (is_building_window_wanted(coords) == 1) {
+ const WantedBuildingWindow& wanted_building_window = *wanted_building_windows_.at(coords.hash()).get();
+ UI::UniqueWindow* building_window = show_building_window(coords, true, wanted_building_window.show_workarea);
+ building_window->set_pos(wanted_building_window.window_position);
+ if (wanted_building_window.minimize) {
building_window->minimize();
}
wanted_building_windows_.erase(coords.hash());
@@ -176,11 +177,15 @@
const Vector2i point,
bool was_minimal) {
wanted_building_windows_.insert(
- std::make_pair(coords.hash(), std::make_pair(point, was_minimal)));
+ std::make_pair(coords.hash(), std::unique_ptr<WantedBuildingWindow>(new WantedBuildingWindow(point, was_minimal, has_workarea_preview(coords)))));
+}
+bool InteractiveGameBase::is_building_window_wanted(const Widelands::Coords& coords) const {
+ return wanted_building_windows_.count(coords.hash()) == 1;
}
UI::UniqueWindow* InteractiveGameBase::show_building_window(const Widelands::Coords& coord,
- bool avoid_fastclick) {
+ bool avoid_fastclick,
+ bool workarea_preview_wanted) {
Widelands::BaseImmovable* immovable = game().map().get_immovable(coord);
upcast(Widelands::Building, building, immovable);
assert(building);
@@ -189,40 +194,40 @@
switch (building->descr().type()) {
case Widelands::MapObjectType::CONSTRUCTIONSITE:
- registry.open_window = [this, ®istry, building, avoid_fastclick] {
+ registry.open_window = [this, ®istry, building, avoid_fastclick, workarea_preview_wanted] {
new ConstructionSiteWindow(*this, registry,
*dynamic_cast<Widelands::ConstructionSite*>(building),
- avoid_fastclick);
+ avoid_fastclick, workarea_preview_wanted);
};
break;
case Widelands::MapObjectType::DISMANTLESITE:
- registry.open_window = [this, ®istry, building, avoid_fastclick] {
+ registry.open_window = [this, ®istry, building, avoid_fastclick, workarea_preview_wanted] {
new DismantleSiteWindow(
*this, registry, *dynamic_cast<Widelands::DismantleSite*>(building), avoid_fastclick);
};
break;
case Widelands::MapObjectType::MILITARYSITE:
- registry.open_window = [this, ®istry, building, avoid_fastclick] {
+ registry.open_window = [this, ®istry, building, avoid_fastclick, workarea_preview_wanted] {
new MilitarySiteWindow(
- *this, registry, *dynamic_cast<Widelands::MilitarySite*>(building), avoid_fastclick);
+ *this, registry, *dynamic_cast<Widelands::MilitarySite*>(building), avoid_fastclick, workarea_preview_wanted);
};
break;
case Widelands::MapObjectType::PRODUCTIONSITE:
- registry.open_window = [this, ®istry, building, avoid_fastclick] {
+ registry.open_window = [this, ®istry, building, avoid_fastclick, workarea_preview_wanted] {
new ProductionSiteWindow(
- *this, registry, *dynamic_cast<Widelands::ProductionSite*>(building), avoid_fastclick);
+ *this, registry, *dynamic_cast<Widelands::ProductionSite*>(building), avoid_fastclick, workarea_preview_wanted);
};
break;
case Widelands::MapObjectType::TRAININGSITE:
- registry.open_window = [this, ®istry, building, avoid_fastclick] {
+ registry.open_window = [this, ®istry, building, avoid_fastclick, workarea_preview_wanted] {
new TrainingSiteWindow(
- *this, registry, *dynamic_cast<Widelands::TrainingSite*>(building), avoid_fastclick);
+ *this, registry, *dynamic_cast<Widelands::TrainingSite*>(building), avoid_fastclick, workarea_preview_wanted);
};
break;
case Widelands::MapObjectType::WAREHOUSE:
- registry.open_window = [this, ®istry, building, avoid_fastclick] {
+ registry.open_window = [this, ®istry, building, avoid_fastclick, workarea_preview_wanted] {
new WarehouseWindow(
- *this, registry, *dynamic_cast<Widelands::Warehouse*>(building), avoid_fastclick);
+ *this, registry, *dynamic_cast<Widelands::Warehouse*>(building), avoid_fastclick, workarea_preview_wanted);
};
break;
// TODO(sirver,trading): Add UI for market.
=== modified file 'src/wui/interactive_gamebase.h'
--- src/wui/interactive_gamebase.h 2018-04-28 06:16:07 +0000
+++ src/wui/interactive_gamebase.h 2018-07-14 11:32:06 +0000
@@ -85,7 +85,8 @@
void add_wanted_building_window(const Widelands::Coords& coords,
const Vector2i point,
bool was_minimal);
- UI::UniqueWindow* show_building_window(const Widelands::Coords& coords, bool avoid_fastclick);
+ bool is_building_window_wanted(const Widelands::Coords& coords) const;
+ UI::UniqueWindow* show_building_window(const Widelands::Coords& coords, bool avoid_fastclick, bool workarea_preview_wanted);
bool try_show_ship_window();
void show_ship_window(Widelands::Ship* ship);
bool is_multiplayer() {
@@ -110,8 +111,15 @@
private:
void on_buildhelp_changed(const bool value) override;
+ struct WantedBuildingWindow {
+ explicit WantedBuildingWindow (const Vector2i& pos, bool was_minimized, bool was_showing_workarea) :
+ window_position(pos), minimize(was_minimized), show_workarea(was_showing_workarea) {}
+ const Vector2i window_position;
+ const bool minimize;
+ const bool show_workarea;
+ };
// Building coordinates, window position, whether the window was minimized
- std::map<uint32_t, std::pair<const Vector2i, bool>> wanted_building_windows_;
+ std::map<uint32_t, std::unique_ptr<WantedBuildingWindow>> wanted_building_windows_;
std::unique_ptr<Notifications::Subscriber<Widelands::NoteBuilding>> buildingnotes_subscriber_;
};
=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc 2018-05-16 05:26:18 +0000
+++ src/wui/interactive_player.cc 2018-07-14 11:32:06 +0000
@@ -289,7 +289,7 @@
auto* fields_to_draw = given_map_view->draw_terrain(gbase, dst);
const auto& road_building = road_building_overlays();
- const std::map<Widelands::Coords, const Image*> work_area_overlays = get_work_area_overlays(map);
+ const std::map<Widelands::Coords, const Image*> workarea_overlays = get_workarea_overlays(map);
for (size_t idx = 0; idx < fields_to_draw->size(); ++idx) {
auto* f = fields_to_draw->mutable_field(idx);
@@ -338,8 +338,8 @@
// Draw work area previews.
{
- const auto it = work_area_overlays.find(f->fcoords);
- if (it != work_area_overlays.end()) {
+ const auto it = workarea_overlays.find(f->fcoords);
+ if (it != workarea_overlays.end()) {
blit_overlay(it->second, Vector2i(it->second->width() / 2, it->second->height() / 2));
}
}
@@ -394,7 +394,7 @@
// Special case for buildings
if (upcast(Building, building, map.get_immovable(node_and_triangle.node)))
if (can_see(building->owner().player_number())) {
- show_building_window(node_and_triangle.node, false);
+ show_building_window(node_and_triangle.node, false, false);
return;
}
=== modified file 'src/wui/interactive_spectator.cc'
--- src/wui/interactive_spectator.cc 2018-05-16 05:30:22 +0000
+++ src/wui/interactive_spectator.cc 2018-07-14 11:32:06 +0000
@@ -121,7 +121,7 @@
const uint32_t gametime = the_game.get_gametime();
const auto text_to_draw = get_text_to_draw();
- const std::map<Widelands::Coords, const Image*> work_area_overlays = get_work_area_overlays(map);
+ const std::map<Widelands::Coords, const Image*> workarea_overlays = get_workarea_overlays(map);
for (size_t idx = 0; idx < fields_to_draw->size(); ++idx) {
const FieldsToDraw::Field& field = fields_to_draw->at(idx);
@@ -145,8 +145,8 @@
};
// Draw work area previews.
- const auto it = work_area_overlays.find(field.fcoords);
- if (it != work_area_overlays.end()) {
+ const auto it = workarea_overlays.find(field.fcoords);
+ if (it != workarea_overlays.end()) {
const Image* pic = it->second;
blit_overlay(pic, Vector2i(pic->width() / 2, pic->height() / 2));
}
@@ -210,7 +210,7 @@
void InteractiveSpectator::node_action(const Widelands::NodeAndTriangle<>& node_and_triangle) {
// Special case for buildings
if (is_a(Widelands::Building, egbase().map().get_immovable(node_and_triangle.node))) {
- show_building_window(node_and_triangle.node, false);
+ show_building_window(node_and_triangle.node, false, false);
return;
}
=== modified file 'src/wui/militarysitewindow.cc'
--- src/wui/militarysitewindow.cc 2018-04-27 06:11:05 +0000
+++ src/wui/militarysitewindow.cc 2018-07-14 11:32:06 +0000
@@ -28,15 +28,15 @@
MilitarySiteWindow::MilitarySiteWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::MilitarySite& ms,
- bool avoid_fastclick)
+ bool avoid_fastclick, bool workarea_preview_wanted)
: BuildingWindow(parent, reg, ms, avoid_fastclick), military_site_(&ms) {
- init(avoid_fastclick);
+ init(avoid_fastclick, workarea_preview_wanted);
}
-void MilitarySiteWindow::init(bool avoid_fastclick) {
+void MilitarySiteWindow::init(bool avoid_fastclick, bool workarea_preview_wanted) {
Widelands::MilitarySite* military_site = military_site_.get(igbase()->egbase());
assert(military_site != nullptr);
- BuildingWindow::init(avoid_fastclick);
+ BuildingWindow::init(avoid_fastclick, workarea_preview_wanted);
get_tabs()->add("soldiers", g_gr->images().get(pic_tab_military),
create_soldier_list(*get_tabs(), *igbase(), *military_site), _("Soldiers"));
think();
=== modified file 'src/wui/militarysitewindow.h'
--- src/wui/militarysitewindow.h 2018-04-07 16:59:00 +0000
+++ src/wui/militarysitewindow.h 2018-07-14 11:32:06 +0000
@@ -30,10 +30,11 @@
MilitarySiteWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::MilitarySite&,
- bool avoid_fastclick);
+ bool avoid_fastclick,
+ bool workarea_preview_wanted);
private:
- void init(bool avoid_fastclick) override;
+ void init(bool avoid_fastclick, bool workarea_preview_wanted) override;
Widelands::OPtr<Widelands::MilitarySite> military_site_;
=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc 2018-04-27 06:11:05 +0000
+++ src/wui/productionsitewindow.cc 2018-07-14 11:32:06 +0000
@@ -40,7 +40,8 @@
ProductionSiteWindow::ProductionSiteWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::ProductionSite& ps,
- bool avoid_fastclick)
+ bool avoid_fastclick,
+ bool workarea_preview_wanted)
: BuildingWindow(parent, reg, ps, avoid_fastclick),
production_site_(&ps),
worker_table_(nullptr),
@@ -64,14 +65,14 @@
}
}
});
- init(avoid_fastclick);
+ init(avoid_fastclick, workarea_preview_wanted);
}
-void ProductionSiteWindow::init(bool avoid_fastclick) {
+void ProductionSiteWindow::init(bool avoid_fastclick, bool workarea_preview_wanted) {
Widelands::ProductionSite* production_site = production_site_.get(igbase()->egbase());
assert(production_site != nullptr);
- BuildingWindow::init(avoid_fastclick);
+ BuildingWindow::init(avoid_fastclick, workarea_preview_wanted);
const std::vector<Widelands::InputQueue*>& inputqueues = production_site->inputqueues();
if (inputqueues.size()) {
=== modified file 'src/wui/productionsitewindow.h'
--- src/wui/productionsitewindow.h 2018-04-07 16:59:00 +0000
+++ src/wui/productionsitewindow.h 2018-07-14 11:32:06 +0000
@@ -30,11 +30,12 @@
ProductionSiteWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::ProductionSite&,
- bool avoid_fastclick);
+ bool avoid_fastclick,
+ bool workarea_preview_wanted);
protected:
void think() override;
- void init(bool avoid_fastclick) override;
+ void init(bool avoid_fastclick, bool workarea_preview_wanted) override;
void evict_worker();
private:
=== modified file 'src/wui/trainingsitewindow.cc'
--- src/wui/trainingsitewindow.cc 2018-04-27 06:11:05 +0000
+++ src/wui/trainingsitewindow.cc 2018-07-14 11:32:06 +0000
@@ -31,15 +31,16 @@
TrainingSiteWindow::TrainingSiteWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::TrainingSite& ts,
- bool avoid_fastclick)
- : ProductionSiteWindow(parent, reg, ts, avoid_fastclick), training_site_(&ts) {
- init(avoid_fastclick);
+ bool avoid_fastclick,
+ bool workarea_preview_wanted)
+ : ProductionSiteWindow(parent, reg, ts, avoid_fastclick, workarea_preview_wanted), training_site_(&ts) {
+ init(avoid_fastclick, workarea_preview_wanted);
}
-void TrainingSiteWindow::init(bool avoid_fastclick) {
+void TrainingSiteWindow::init(bool avoid_fastclick, bool workarea_preview_wanted) {
Widelands::ProductionSite* training_site = training_site_.get(igbase()->egbase());
assert(training_site != nullptr);
- ProductionSiteWindow::init(avoid_fastclick);
+ ProductionSiteWindow::init(avoid_fastclick, workarea_preview_wanted);
get_tabs()->add("soldiers", g_gr->images().get(pic_tab_military),
create_soldier_list(*get_tabs(), *igbase(), *training_site),
_("Soldiers in training"));
=== modified file 'src/wui/trainingsitewindow.h'
--- src/wui/trainingsitewindow.h 2018-04-07 16:59:00 +0000
+++ src/wui/trainingsitewindow.h 2018-07-14 11:32:06 +0000
@@ -31,10 +31,11 @@
TrainingSiteWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::TrainingSite&,
- bool avoid_fastclick);
+ bool avoid_fastclick,
+ bool workarea_preview_wanted);
private:
- void init(bool avoid_fastclick) override;
+ void init(bool avoid_fastclick, bool workarea_preview_wanted) override;
Widelands::OPtr<Widelands::TrainingSite> training_site_;
=== modified file 'src/wui/warehousewindow.cc'
--- src/wui/warehousewindow.cc 2018-04-27 06:11:05 +0000
+++ src/wui/warehousewindow.cc 2018-07-14 11:32:06 +0000
@@ -174,15 +174,16 @@
WarehouseWindow::WarehouseWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::Warehouse& wh,
- bool avoid_fastclick)
+ bool avoid_fastclick,
+ bool workarea_preview_wanted)
: BuildingWindow(parent, reg, wh, avoid_fastclick), warehouse_(&wh) {
- init(avoid_fastclick);
+ init(avoid_fastclick, workarea_preview_wanted);
}
-void WarehouseWindow::init(bool avoid_fastclick) {
+void WarehouseWindow::init(bool avoid_fastclick, bool workarea_preview_wanted) {
Widelands::Warehouse* warehouse = warehouse_.get(igbase()->egbase());
assert(warehouse != nullptr);
- BuildingWindow::init(avoid_fastclick);
+ BuildingWindow::init(avoid_fastclick, workarea_preview_wanted);
get_tabs()->add(
"wares", g_gr->images().get(pic_tab_wares),
new WarehouseWaresPanel(get_tabs(), Width, *igbase(), *warehouse, Widelands::wwWARE),
=== modified file 'src/wui/warehousewindow.h'
--- src/wui/warehousewindow.h 2018-04-07 16:59:00 +0000
+++ src/wui/warehousewindow.h 2018-07-14 11:32:06 +0000
@@ -30,10 +30,11 @@
WarehouseWindow(InteractiveGameBase& parent,
UI::UniqueWindow::Registry& reg,
Widelands::Warehouse&,
- bool avoid_fastclick);
+ bool avoid_fastclick,
+ bool workarea_preview_wanted);
private:
- void init(bool avoid_fastclick) override;
+ void init(bool avoid_fastclick, bool workarea_preview_wanted) override;
Widelands::OPtr<Widelands::Warehouse> warehouse_;
References