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

2016-11-22 Thread kaputtnik
merged and committed.

Thanks for the review :-)
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/sitemap/+merge/310261
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
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/ai_seafaring_split into lp:widelands

2016-11-22 Thread TiborB
TiborB has proposed merging lp:~widelands-dev/widelands/ai_seafaring_split into 
lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/ai_seafaring_split/+merge/311544

This moves couple of seafaring functions from defaultai.cc to 
defaultai_seafaring.cc, mainly because of toptopple's request. Defaultaicc is 
too big anyway and this should help administrating DefaultAI struct and give 
toptopple some space to modify seafaring functionality.

However I dont know how standard-compliant such design is - but it works.

@toptopple - is this what you asked for?
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/ai_seafaring_split into lp:widelands.
=== modified file 'src/ai/CMakeLists.txt'
--- src/ai/CMakeLists.txt	2016-01-28 05:24:34 +
+++ src/ai/CMakeLists.txt	2016-11-22 21:08:29 +
@@ -6,6 +6,7 @@
 ai_hints.h
 computer_player.cc
 computer_player.h
+defaultai_seafaring.cc
 defaultai.cc
 defaultai.h
   DEPENDS

=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc	2016-11-19 18:25:49 +
+++ src/ai/defaultai.cc	2016-11-22 21:08:29 +
@@ -36,7 +36,6 @@
 #include "economy/flag.h"
 #include "economy/portdock.h"
 #include "economy/road.h"
-#include "economy/wares_queue.h"
 #include "logic/findbob.h"
 #include "logic/findimmovable.h"
 #include "logic/findnode.h"
@@ -63,18 +62,9 @@
 constexpr int kBuildingMinInterval = 25 * 1000;
 constexpr int kMinBFCheckInterval = 5 * 1000;
 constexpr int kMinMFCheckInterval = 19 * 1000;
-constexpr int kShipCheckInterval = 5 * 1000;
 constexpr int kMarineDecisionInterval = 20 * 1000;
 constexpr int kTrainingSitesCheckInterval = 15 * 1000;
 
-// handfull of constants used for expeditions/colonization
-constexpr int kColonyScanStartArea = 35;
-constexpr int kColonyScanMinArea = 10;
-constexpr int kExpeditionMaxDuration = 120 * 60 * 1000;
-constexpr uint32_t kNoShip = std::numeric_limits::max();
-constexpr uint32_t kNever = std::numeric_limits::max();
-constexpr uint32_t kNoExpedition = 0;
-
 // following two are used for roads management, for creating shortcuts and dismantling dispensable
 // roads
 constexpr int32_t kSpotsTooLittle = 15;
@@ -83,10 +73,6 @@
 // this is intended for map developers, by default should be off
 constexpr bool kPrintStats = false;
 
-constexpr int8_t kUncalculated = -1;
-constexpr uint8_t kFalse = 0;
-constexpr uint8_t kTrue = 1;
-
 // duration of military campaign
 constexpr int kCampaignDuration = 15 * 60 * 1000;
 
@@ -3490,283 +3476,6 @@
 	return false;
 }
 
-// This function scans current situation with shipyards, ports, ships, ongoing expeditions
-// and makes two decisions:
-// - build a ship
-// - start preparation for expedition
-bool DefaultAI::marine_main_decisions() {
-
-	if (!seafaring_economy) {
-		set_taskpool_task_time(kNever, SchedulerTaskId::KMarineDecisions);
-		return false;
-	}
-
-	// getting some base statistics
-	player_ = game().get_player(player_number());
-	uint16_t ports_count = 0;
-	uint16_t shipyards_count = 0;
-	uint16_t expeditions_in_prep = 0;
-	uint16_t expeditions_in_progress = 0;
-	bool idle_shipyard_stocked = false;
-
-	// goes over all warehouses (these includes ports)
-	for (const WarehouseSiteObserver& wh_obs : warehousesites) {
-		if (wh_obs.bo->is_port) {
-			ports_count += 1;
-			if (Widelands::PortDock* pd = wh_obs.site->get_portdock()) {
-if (pd->expedition_started()) {
-	expeditions_in_prep += 1;
-}
-			}
-		}
-	}
-
-	// goes over productionsites and gets status of shipyards
-	for (const ProductionSiteObserver& ps_obs : productionsites) {
-		if (ps_obs.bo->is_shipyard) {
-			shipyards_count += 1;
-
-			// counting stocks
-			uint8_t stocked_wares = 0;
-			std::vector const warequeues = ps_obs.site->warequeues();
-			size_t const nr_warequeues = warequeues.size();
-			for (size_t i = 0; i < nr_warequeues; ++i) {
-stocked_wares += warequeues[i]->get_filled();
-			}
-			if (stocked_wares == 16 && ps_obs.site->is_stopped() && ps_obs.site->can_start_working()) {
-idle_shipyard_stocked = true;
-			}
-		}
-	}
-
-	// and now over ships
-	for (std::list::iterator sp_iter = allships.begin(); sp_iter != allships.end();
-	 ++sp_iter) {
-		if (sp_iter->ship->state_is_expedition()) {
-			expeditions_in_progress += 1;
-		}
-	}
-
-	assert(allships.size() >= expeditions_in_progress);
-	bool ship_free = allships.size() - expeditions_in_progress > 0;
-
-	enum class FleetStatus : uint8_t { kNeedShip = 0, kEnoughShips = 1, kDoNothing = 2 };
-
-	// now we decide whether we have enough ships or need to build another
-	// three values: kDoNothing, kNeedShip, kEnoughShips
-	FleetStatus enough_ships = FleetStatus::kDoNothing;
-	if (ports_count > 0 && shipyards_count > 0 && idle_shipyard_stocked) {
-
-		// we always need at least one ship in transport mode
-		if (!ship_free) {
-			enough_ships = 

[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-863185-census-on-destroyed-building into lp:widelands

2016-11-22 Thread noreply
The proposal to merge 
lp:~widelands-dev/widelands/bug-863185-census-on-destroyed-building into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-863185-census-on-destroyed-building/+merge/309818
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-863185-census-on-destroyed-building.

___
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/bug-863185-census-on-destroyed-building into lp:widelands

2016-11-22 Thread GunChleoc
@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-863185-census-on-destroyed-building/+merge/309818
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-863185-census-on-destroyed-building.

___
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/animation_scaling into lp:widelands

2016-11-22 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/animation_scaling into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/animation_scaling/+merge/310718
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/animation_scaling.

___
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/animation_scaling into lp:widelands

2016-11-22 Thread GunChleoc
@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/animation_scaling/+merge/310718
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/animation_scaling.

___
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/bug-863185-census-on-destroyed-building into lp:widelands

2016-11-22 Thread SirVer
Review: Approve

lgtm. minor nits inlined.

Diff comments:

> 
> === modified file 'src/logic/map_objects/immovable.cc'
> --- src/logic/map_objects/immovable.cc2016-11-03 07:37:58 +
> +++ src/logic/map_objects/immovable.cc2016-11-17 08:29:59 +
> @@ -340,8 +344,9 @@
>  ==
>  */
>  
> -Immovable::Immovable(const ImmovableDescr& imm_descr)
> +Immovable::Immovable(const ImmovableDescr& imm_descr, const 
> Widelands::Building* former_building)
> : BaseImmovable(imm_descr),
> + former_building_(former_building ? _building->descr() : nullptr),

rename: former_building_descr_

>   anim_(0),
>   animstart_(0),
>   program_(nullptr),
> @@ -349,6 +354,9 @@
>   anim_construction_total_(0),
>   anim_construction_done_(0),
>   program_step_(0) {
> + if (former_building) {

nit: != nullptr. Implicit casts to bool make me nervous and I find it enforces 
the type of the variable. your call.

> + set_owner(former_building->get_owner());
> + }
>  }
>  
>  Immovable::~Immovable() {


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-863185-census-on-destroyed-building/+merge/309818
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-863185-census-on-destroyed-building.

___
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-website/sitemap into lp:widelands-website

2016-11-22 Thread SirVer
Review: Approve

code lgtm. not tested. 

Diff comments:

> 
> === added file 'sitemap_urls.py'
> --- sitemap_urls.py   1970-01-01 00:00:00 +
> +++ sitemap_urls.py   2016-11-18 15:44:53 +
> @@ -0,0 +1,28 @@
> +from django.conf.urls import *
> +
> +from mainpage.views import mainpage
> +from django.contrib.sitemaps.views import sitemap
> +from static_sitemap import StaticViewSitemap
> +from wiki.sitemap import *
> +from news.sitemap import *
> +from pybb.sitemap import *
> +from wlhelp.sitemap import *
> +from sphinxdoc.sitemap  import *
> +
> +sitemaps = {
> +'static': StaticViewSitemap,
> +'docs': DocumentationSitemap,
> +'news': NewsSitemap,
> +'wiki': WikiSitemap,
> +'forum': ForumSitemap,
> +'wlhelptribe': WlHelpTribeSitemap,
> +'wlhelpware': WlHelpWareSitemap,
> +'wlhelpworker': WlHelpWorkerSitemap,
> +'wlhelpbuildings': WlHelpBuildingSitemap,
> +}
> +

consistency: you use two empty lines for top level elements below.

> +urlpatterns = [
> +# Creating a sitemap.xml
> +url(r'^$', sitemap, {'sitemaps': sitemaps},
> +name='django.contrib.sitemaps.views.sitemap')
> +]


-- 
https://code.launchpad.net/~widelands-dev/widelands-website/sitemap/+merge/310261
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
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/animation_scaling into lp:widelands

2016-11-22 Thread SirVer
Review: Approve

height(): ack. 

the other answered inline.

Diff comments:

> 
> === modified file 'src/graphic/animation.h'
> --- src/graphic/animation.h   2016-10-25 08:14:28 +
> +++ src/graphic/animation.h   2016-11-18 17:52:33 +
> @@ -57,8 +58,17 @@
>   }
>  
>   /// The dimensions of this animation.
> - virtual uint16_t width() const = 0;
> - virtual uint16_t height() const = 0;
> + virtual float height() const = 0;
> +
> + /// The size of the animation source images. Use 'percent_from_bottom' 
> to crop the animation.

Sorry, I meant the units from the returned Rectangle. 'scale' seems fine.

> + virtual Rectf source_rectangle(int percent_from_bottom) const = 0;
> +
> + /// Calculates the destination rectangle for blitting the animation.
> + /// 'position' is where the top left corner of the animation will end 
> up,
> + /// 'source_rect' is the rectangle calculated by source_rectangle,
> + /// 'scale' is the zoom scale.
> + virtual Rectf
> + destination_rectangle(const Vector2f& position, const Rectf& 
> source_rect, float scale) const = 0;
>  
>   /// The number of animation frames of this animation.
>   virtual uint16_t nr_frames() const = 0;


-- 
https://code.launchpad.net/~widelands-dev/widelands/animation_scaling/+merge/310718
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/animation_scaling.

___
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:~hjd/widelands/merge-b19-packaging into lp:widelands

2016-11-22 Thread GunChleoc
get-orig-source target: to obtain the most recent version of the original 
source package from an upstream archive. (Optional)

More detailed description:

https://wiki.debian.org/onlyjob/get-orig-source


The appdata file is now necessary for the software centers - applications that 
don't have it won't be listed. Think of it as a modern addition to .desktop. I 
had been wondering recently why so much stuff disappeared from the Ubuntu 
Software Center, and this is why - application developers still have to catch 
up to the new format.
-- 
https://code.launchpad.net/~hjd/widelands/merge-b19-packaging/+merge/311346
Your team Widelands Developers is requested to review the proposed merge of 
lp:~hjd/widelands/merge-b19-packaging 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/toolbar_cleanup into lp:widelands

2016-11-22 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/toolbar_cleanup into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/toolbar_cleanup/+merge/35
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar_cleanup.

___
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/toolbar_cleanup into lp:widelands

2016-11-22 Thread GunChleoc
I'm not really sure at this point in time if there will be a general toolbar 
object at all - in the end, interactive_base will be the only object who has 
one, if I can turn the other potential toolbars into dropdown menus instead. I 
have started working on a draft mockup in 
https://bugs.launchpad.net/widelands/+bug/1643563

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar_cleanup/+merge/35
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar_cleanup.

___
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/animation_scaling into lp:widelands

2016-11-22 Thread GunChleoc
Yep, I'm not really happy with it either, but I don't have a better idea.

I added 2 replies to your comment, please have a look.

Diff comments:

> 
> === modified file 'src/graphic/animation.h'
> --- src/graphic/animation.h   2016-10-25 08:14:28 +
> +++ src/graphic/animation.h   2016-11-18 17:52:33 +
> @@ -57,8 +58,17 @@
>   }
>  
>   /// The dimensions of this animation.
> - virtual uint16_t width() const = 0;
> - virtual uint16_t height() const = 0;
> + virtual float height() const = 0;

This is used by Soldiers to position their health bar etc.

> +
> + /// The size of the animation source images. Use 'percent_from_bottom' 
> to crop the animation.

The unit is %, as the variable name says. I don't know what the unit for scale 
is, shall we rename it to zoom_scale?

> + virtual Rectf source_rectangle(int percent_from_bottom) const = 0;
> +
> + /// Calculates the destination rectangle for blitting the animation.
> + /// 'position' is where the top left corner of the animation will end 
> up,
> + /// 'source_rect' is the rectangle calculated by source_rectangle,
> + /// 'scale' is the zoom scale.
> + virtual Rectf
> + destination_rectangle(const Vector2f& position, const Rectf& 
> source_rect, float scale) const = 0;
>  
>   /// The number of animation frames of this animation.
>   virtual uint16_t nr_frames() const = 0;


-- 
https://code.launchpad.net/~widelands-dev/widelands/animation_scaling/+merge/310718
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/animation_scaling.

___
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