widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #09804
Re: [Merge] lp:~widelands-dev/widelands/notifications_buildingwindows into lp:widelands
Thanks for the review!
The coordinates from std::map wanted_building_windows_ are used - I have marked up the line.
I also fixed the window warping for both construction sites and dismantle sites in all cases - having the window stay open is only 2 lines of code, so we might as well do it in this branch.
Now I'll go hunt the segfault.
Diff comments:
>
> === modified file 'src/wui/interactive_gamebase.cc'
> --- src/wui/interactive_gamebase.cc 2017-02-24 08:07:50 +0000
> +++ src/wui/interactive_gamebase.cc 2017-02-27 16:52:58 +0000
> @@ -56,6 +62,28 @@
> chat_provider_(nullptr),
> multiplayer_(multiplayer),
> playertype_(pt) {
> + buildingnotes_subscriber_ = Notifications::subscribe<Widelands::NoteBuilding>(
> + [this](const Widelands::NoteBuilding& note) {
> + switch (note.action) {
> + case Widelands::NoteBuilding::Action::kFinishWarp: {
> + 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(std::get<1>(wanted_building_windows_.at(coords.hash())));
The coordinates from std::map wanted_building_windows_ are used here.
> + if (std::get<2>(wanted_building_windows_.at(coords.hash()))) {
> + building_window->minimize();
> + }
> + wanted_building_windows_.erase(coords.hash());
> + }
> + }
> + } break;
> + default:
> + break;
> + }
> + });
> }
>
> /// \return a pointer to the running \ref Game instance.
--
https://code.launchpad.net/~widelands-dev/widelands/notifications_buildingwindows/+merge/317264
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/notifications_buildingwindows.
References