Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1826669-mp-map-b20 into lp:widelands/build20

2019-04-29 Thread Klaus Halfmann
Review: Approve compile / test

OK, tested this again, works as intended.

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1826669-mp-map-b20/+merge/366619
Your team Widelands Developers is subscribed to branch lp:widelands/build20.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/overlapping_workareas into lp:widelands

2019-04-29 Thread Benedikt Straub
Implemented some of your diff comments and replied to the others

Diff comments:

> 
> === modified file 'src/logic/widelands_geometry.h'
> --- src/logic/widelands_geometry.h2019-03-11 14:45:04 +
> +++ src/logic/widelands_geometry.h2019-04-28 16:58:57 +
> @@ -157,6 +156,25 @@
>  };
>  }  // namespace Widelands
>  
> -using Workareas = std::set, uint8_t>>;
> +struct WorkareaPreviewData {
> + WorkareaPreviewData(Widelands::TCoords<> c, uint8_t i)
> + : coords(c), index(i), use_special_coloring(false), 
> special_coloring(0) {
> + }
> + WorkareaPreviewData(Widelands::TCoords<> c, uint8_t i, uint32_t col)
> + : coords(c), index(i), use_special_coloring(true), 
> special_coloring(col) {
> + }
> + WorkareaPreviewData()
> + : coords(Widelands::TCoords<>(Widelands::Coords::null(), 
> Widelands::TriangleIndex::D)),
> +   index(0), use_special_coloring(false), special_coloring(0) {
> + }
> + WorkareaPreviewData& operator=(const WorkareaPreviewData&) = default;
> +
> + Widelands::TCoords<> coords;
> + uint8_t index;
> + bool use_special_coloring;

I´ll add a comment to explain what makes it special

> + uint32_t special_coloring;
> +};
> +using WorkareasEntry = std::vector;
> +using Workareas = std::vector;
>  
>  #endif  // end of include guard: WL_LOGIC_WIDELANDS_GEOMETRY_H
> 
> === modified file 'src/wui/fieldaction.cc'
> --- src/wui/fieldaction.cc2019-02-23 11:00:49 +
> +++ src/wui/fieldaction.cc2019-04-28 16:58:57 +
> @@ -683,17 +695,99 @@
>  
>  void FieldActionWindow::building_icon_mouse_out(Widelands::DescriptionIndex) 
> {
>   if (showing_workarea_preview_) {
> - ibase().hide_workarea(node_);
> + ibase().hide_workarea(node_, false);
> + clear_overlapping_workareas();
>   showing_workarea_preview_ = false;
>   }
>  }
>  
>  void FieldActionWindow::building_icon_mouse_in(const 
> Widelands::DescriptionIndex idx) {
>   if (!showing_workarea_preview_) {
> - const WorkareaInfo& workarea_info =
> -
> player_->tribe().get_building_descr(Widelands::DescriptionIndex(idx))->workarea_info();
> + assert(overlapping_workareas_.empty());
> + const Widelands::BuildingDescr& descr = 
> *player_->tribe().get_building_descr(idx);
> + const WorkareaInfo& workarea_info = descr.workarea_info();
>   ibase().show_workarea(workarea_info, node_);
>   showing_workarea_preview_ = true;
> +
> + const Widelands::Map& map = ibase().egbase().map();
> + uint32_t workarea_radius = 0;
> + for (const auto& pair : workarea_info) {
> + workarea_radius = std::max(workarea_radius, pair.first);
> + }
> + if (workarea_radius == 0) {
> + return;
> + }
> + std::set> main_region = 
> map.triangles_in_region(
> + map.to_set(Widelands::Area<>(node_, 
> workarea_radius)));
> +
> + Widelands::MapRegion> 
> mr(map, Widelands::Area(
> + node_, workarea_radius + 
> ibase().egbase().tribes().get_largest_workarea()));
> + do {
> + if (player_->vision(map.get_index(mr.location())) > 1) {
> + if (Widelands::BaseImmovable* imm = 
> mr.location().field->get_immovable()) {
> + const Widelands::MapObjectType imm_type 
> = imm->descr().type();
> + if (imm_type < 
> Widelands::MapObjectType::BUILDING) {
> + // We are not interested in 
> trees and pebbles
> + continue;
> + }
> + const Widelands::BuildingDescr* d = 
> nullptr;
> + if (descr.type() == 
> Widelands::MapObjectType::PRODUCTIONSITE) {
> + if (imm->get_owner() != 
> player_) {
> + continue;
> + }
> + if (imm_type != 
> Widelands::MapObjectType::PRODUCTIONSITE) {

The checks to run if imm_type is a constructionsite depend on descr().type(), 
so we´d need an inner if anyway

> + if (imm_type != 
> Widelands::MapObjectType::CONSTRUCTIONSITE) {
> + continue;
> + }
> + 
> upcast(Widelands::ConstructionSite, cs, imm);
> + d = 
> cs->get_info().becomes;
> +   

[Widelands-dev] [Merge] lp:~widelands-dev/widelands/expedition_portspace_indicator into lp:widelands

2019-04-29 Thread Benedikt Straub
Benedikt Straub has proposed merging 
lp:~widelands-dev/widelands/expedition_portspace_indicator into lp:widelands.

Commit message:
Show a port icon on the field where an expedition ship can build a port

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1826655 in widelands: "Highlight where expedition ship will build port"
  https://bugs.launchpad.net/widelands/+bug/1826655

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/expedition_portspace_indicator/+merge/366640
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/expedition_portspace_indicator into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/ship.cc'
--- src/logic/map_objects/tribes/ship.cc	2019-04-26 20:38:39 +
+++ src/logic/map_objects/tribes/ship.cc	2019-04-29 10:21:04 +
@@ -48,6 +48,7 @@
 #include "logic/widelands_geometry_io.h"
 #include "map_io/map_object_loader.h"
 #include "map_io/map_object_saver.h"
+#include "wui/interactive_base.h"
 
 namespace Widelands {
 
@@ -435,6 +436,16 @@
 			 "images/wui/editor/fsel_editor_set_port_space.png");
 		}
 	}
+
+	if (InteractiveBase* ibase = game.get_ibase()) {
+		if (ibase->get_player() == get_owner()) {
+			if (ship_state_ == ShipStates::kExpeditionPortspaceFound) {
+ibase->show_expedition_port_space(this, expedition_->seen_port_buildspaces.front());
+			} else {
+ibase->hide_expedition_port_space(this);
+			}
+		}
+	}
 }
 
 void Ship::ship_update_idle(Game& game, Bob::State& state) {

=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc	2019-04-25 06:31:33 +
+++ src/wui/interactive_base.cc	2019-04-29 10:21:04 +
@@ -304,6 +304,28 @@
 void InteractiveBase::on_buildhelp_changed(bool /* value */) {
 }
 
+void InteractiveBase::show_expedition_port_space(Widelands::Ship* ship, const Widelands::Coords& coords) {
+	expedition_port_spaces_.emplace(std::make_pair(ship, coords));
+}
+
+void InteractiveBase::hide_expedition_port_space(Widelands::Ship* ship) {
+	for (auto it = expedition_port_spaces_.begin(); it != expedition_port_spaces_.end(); ++it) {
+		if (it->first == ship) {
+			expedition_port_spaces_.erase(it);
+			return;
+		}
+	}
+}
+
+bool InteractiveBase::has_expedition_port_space(const Widelands::Coords& coords) const {
+	for (const auto& pair : expedition_port_spaces_) {
+		if (pair.second == coords) {
+			return true;
+		}
+	}
+	return false;
+}
+
 // Show the given workareas at the given coords and returns the overlay job id associated
 void InteractiveBase::show_workarea(const WorkareaInfo& workarea_info, Widelands::Coords coords) {
 	workarea_previews_[coords] = &workarea_info;

=== modified file 'src/wui/interactive_base.h'
--- src/wui/interactive_base.h	2019-04-25 06:31:33 +
+++ src/wui/interactive_base.h	2019-04-29 10:21:04 +
@@ -86,6 +86,10 @@
 	void show_workarea(const WorkareaInfo& workarea_info, Widelands::Coords coords);
 	void hide_workarea(const Widelands::Coords& coords);
 
+	void show_expedition_port_space(Widelands::Ship*, const Widelands::Coords&);
+	void hide_expedition_port_space(Widelands::Ship*);
+	bool has_expedition_port_space(const Widelands::Coords&) const;
+
 	//  point of view for drawing
 	virtual Widelands::Player* get_player() const = 0;
 
@@ -291,6 +295,8 @@
 	// coordinate that the building that shows the work area is positioned.
 	std::map workarea_previews_;
 
+	std::map expedition_port_spaces_;
+
 	RoadBuildingOverlays road_building_overlays_;
 
 	std::unique_ptr>

=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc	2019-04-25 06:31:33 +
+++ src/wui/interactive_player.cc	2019-04-29 10:21:04 +
@@ -339,8 +339,10 @@
 
 		if (f->vision > 0) {
 			// Draw build help.
-			if (buildhelp()) {
-const auto* overlay = get_buildhelp_overlay(plr.get_buildcaps(f->fcoords));
+			bool show_port_space = has_expedition_port_space(f->fcoords);
+			if (show_port_space || buildhelp()) {
+const auto* overlay = get_buildhelp_overlay(show_port_space ?
+		f->fcoords.field->maxcaps() : plr.get_buildcaps(f->fcoords));
 if (overlay != nullptr) {
 	blit_field_overlay(dst, *f, overlay->pic, overlay->hotspot, scale);
 }

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/per-level-soldier-anims into lp:widelands

2019-04-29 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4832. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/525833878.
Appveyor build 4613. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_per_level_soldier_anims-4613.
-- 
https://code.launchpad.net/~widelands-dev/widelands/per-level-soldier-anims/+merge/354929
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/per-level-soldier-anims into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/overlapping_workareas into lp:widelands

2019-04-29 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4834. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/525875233.
Appveyor build 4615. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_overlapping_workareas-4615.
-- 
https://code.launchpad.net/~widelands-dev/widelands/overlapping_workareas/+merge/366623
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/overlapping_workareas into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/overlapping_workareas into lp:widelands

2019-04-29 Thread GunChleoc
Some replies

Diff comments:

> 
> === modified file 'src/wui/fieldaction.cc'
> --- src/wui/fieldaction.cc2019-02-23 11:00:49 +
> +++ src/wui/fieldaction.cc2019-04-28 16:58:57 +
> @@ -683,17 +695,99 @@
>  
>  void FieldActionWindow::building_icon_mouse_out(Widelands::DescriptionIndex) 
> {
>   if (showing_workarea_preview_) {
> - ibase().hide_workarea(node_);
> + ibase().hide_workarea(node_, false);
> + clear_overlapping_workareas();
>   showing_workarea_preview_ = false;
>   }
>  }
>  
>  void FieldActionWindow::building_icon_mouse_in(const 
> Widelands::DescriptionIndex idx) {
>   if (!showing_workarea_preview_) {
> - const WorkareaInfo& workarea_info =
> -
> player_->tribe().get_building_descr(Widelands::DescriptionIndex(idx))->workarea_info();
> + assert(overlapping_workareas_.empty());
> + const Widelands::BuildingDescr& descr = 
> *player_->tribe().get_building_descr(idx);
> + const WorkareaInfo& workarea_info = descr.workarea_info();
>   ibase().show_workarea(workarea_info, node_);
>   showing_workarea_preview_ = true;
> +
> + const Widelands::Map& map = ibase().egbase().map();
> + uint32_t workarea_radius = 0;
> + for (const auto& pair : workarea_info) {
> + workarea_radius = std::max(workarea_radius, pair.first);
> + }
> + if (workarea_radius == 0) {
> + return;
> + }
> + std::set> main_region = 
> map.triangles_in_region(
> + map.to_set(Widelands::Area<>(node_, 
> workarea_radius)));
> +
> + Widelands::MapRegion> 
> mr(map, Widelands::Area(
> + node_, workarea_radius + 
> ibase().egbase().tribes().get_largest_workarea()));
> + do {
> + if (player_->vision(map.get_index(mr.location())) > 1) {
> + if (Widelands::BaseImmovable* imm = 
> mr.location().field->get_immovable()) {
> + const Widelands::MapObjectType imm_type 
> = imm->descr().type();
> + if (imm_type < 
> Widelands::MapObjectType::BUILDING) {
> + // We are not interested in 
> trees and pebbles
> + continue;
> + }
> + const Widelands::BuildingDescr* d = 
> nullptr;
> + if (descr.type() == 
> Widelands::MapObjectType::PRODUCTIONSITE) {
> + if (imm->get_owner() != 
> player_) {
> + continue;
> + }
> + if (imm_type != 
> Widelands::MapObjectType::PRODUCTIONSITE) {

You're doing it for the remaining building types again below though - If I see 
it from the diff here correctly, the only difference is the owner check. So, 
only do the owner check here and do the common checks below?

> + if (imm_type != 
> Widelands::MapObjectType::CONSTRUCTIONSITE) {
> + continue;
> + }
> + 
> upcast(Widelands::ConstructionSite, cs, imm);
> + d = 
> cs->get_info().becomes;
> + if (d->type() != 
> Widelands::MapObjectType::PRODUCTIONSITE) {
> + continue;
> + }
> + }
> + } else if (descr.type() == 
> Widelands::MapObjectType::WAREHOUSE ||
> + descr.type() == 
> Widelands::MapObjectType::MILITARYSITE) {
> + if (imm_type != 
> Widelands::MapObjectType::MILITARYSITE &&
> + imm_type != 
> Widelands::MapObjectType::WAREHOUSE) {
> + if (imm_type != 
> Widelands::MapObjectType::CONSTRUCTIONSITE) {
> + continue;
> + }
> + 
> upcast(Widelands::ConstructionSite, cs, imm);
> + d = 
> cs->get_info().becomes;
> + if (d->type() != 
> Widelands::MapObjectTy

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1826669-mp-map-b20 into lp:widelands/build20

2019-04-29 Thread GunChleoc
Excellent, thanks for testing!

I'll port the fix to trunk.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1826669-mp-map-b20/+merge/366619
Your team Widelands Developers is subscribed to branch lp:widelands/build20.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/overlapping_workareas into lp:widelands

2019-04-29 Thread Benedikt Straub
Ah, I misunderstood the point about fieldaction.cc. Implemented your comments.
-- 
https://code.launchpad.net/~widelands-dev/widelands/overlapping_workareas/+merge/366623
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/overlapping_workareas into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/expedition_portspace_indicator into lp:widelands

2019-04-29 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4835. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/525916562.
Appveyor build 4616. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_expedition_portspace_indicator-4616.
-- 
https://code.launchpad.net/~widelands-dev/widelands/expedition_portspace_indicator/+merge/366640
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/expedition_portspace_indicator into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands

2019-04-29 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4836. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/526029169.
Appveyor build 4617. State: failed. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_ferry-4617.
-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ferry.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bridges into lp:widelands

2019-04-29 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4838. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/526055823.
Appveyor build 4619. State: failed. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bridges-4619.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bridges/+merge/364318
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ferry.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1826669-mp-map-b20 into lp:widelands/build20

2019-04-29 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/bug-1826669-mp-map-b20 into 
lp:widelands/build20 has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1826669-mp-map-b20/+merge/366619
-- 
Your team Widelands Developers is subscribed to branch lp:widelands/build20.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/overlapping_workareas into lp:widelands

2019-04-29 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4840. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/526107870.
Appveyor build 4621. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_overlapping_workareas-4621.
-- 
https://code.launchpad.net/~widelands-dev/widelands/overlapping_workareas/+merge/366623
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/overlapping_workareas into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp