[Widelands-dev] [Merge] lp:~kxq/widelands/feature-1656664-scout-improvement into lp:widelands

2017-12-16 Thread bunnybot
Continuous integration builds have changed state:

Travis build 2964. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/317414123.
Appveyor build 2773. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_kxq_widelands_feature_1656664_scout_improvement-2773.
-- 
https://code.launchpad.net/~kxq/widelands/feature-1656664-scout-improvement/+merge/335284
Your team Widelands Developers is requested to review the proposed merge of 
lp:~kxq/widelands/feature-1656664-scout-improvement 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:~kxq/widelands/feature-1656664-scout-improvement into lp:widelands

2017-12-16 Thread Teppo Mäenpää
Actually, revealing the unknown territory might not take that much longer:
- Vision range was increment by one, which speeds up the sweeping efficiency 
quite much;
- Walking near the military sites reveals tiny bits of landscape, too.

-- 
https://code.launchpad.net/~kxq/widelands/feature-1656664-scout-improvement/+merge/335284
Your team Widelands Developers is requested to review the proposed merge of 
lp:~kxq/widelands/feature-1656664-scout-improvement 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:~kxq/widelands/feature-1656664-scout-improvement into lp:widelands

2017-12-16 Thread Teppo Mäenpää
Thanks for the quick reply. Currently (=BZR8529) the scout does random walk 
about something between ~34 and 100% of the time: 100% if no enemy military 
sites are near, and ~34% when there are many enemy military sites nearby.

When the scout is wandering randomly, it prefers unseen places if any are left.

In short, all places are still revealed. It takes somewhat more time, though.

The notice is a good idea. It is, however, not directly related to this.
-- 
https://code.launchpad.net/~kxq/widelands/feature-1656664-scout-improvement/+merge/335284
Your team Widelands Developers is requested to review the proposed merge of 
lp:~kxq/widelands/feature-1656664-scout-improvement 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:~kxq/widelands/feature-1656664-scout-improvement into lp:widelands

2017-12-16 Thread Klaus Halfmann
Thanks for pinking that up that one.

Could it be possible to make the scout prefer parts of the map not visible 
yet? E.G. the scout sometime fails to revela some parts of the map as he
visits the smae, already know place again and again.

And, even Better if a scout fins only places already owned by a player
for say 5 excursion, he may notify the player about this. E.G.
you forgot to tear down a scout whch is now in the middle of your territory.

If this is to complex, we may however do this in some differnt branch.
-- 
https://code.launchpad.net/~kxq/widelands/feature-1656664-scout-improvement/+merge/335284
Your team Widelands Developers is requested to review the proposed merge of 
lp:~kxq/widelands/feature-1656664-scout-improvement 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:~kxq/widelands/feature-1656664-scout-improvement into lp:widelands

2017-12-16 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~kxq/widelands/feature-1656664-scout-improvement into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1656664 in widelands: "Scouts are a sore point of this game."
  https://bugs.launchpad.net/widelands/+bug/1656664

For more details, see:
https://code.launchpad.net/~kxq/widelands/feature-1656664-scout-improvement/+merge/335284

This is a lightweight fix to the issue described verbosely in 
https://wl.widelands.org/forum/topic/2792 and briefly below:

If player can only build small military huts, and the enemy has a large one, 
the large may be unattackable as a result of small vision range and long 
distance. The only way is to use scout to temporarily bring the enemy MS to 
vision. However, that requires a lot of patience because of reasons discussed 
in the forum.

With this modification, the switches between random walking and doing an 
excursion to enemy military sites.

The scout is still in the worker class.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~kxq/widelands/feature-1656664-scout-improvement into lp:widelands.
=== modified file 'data/tribes/workers/atlanteans/scout/init.lua'
--- data/tribes/workers/atlanteans/scout/init.lua	2017-02-12 09:10:57 +
+++ data/tribes/workers/atlanteans/scout/init.lua	2017-12-16 17:12:13 +
@@ -15,7 +15,7 @@
descname = pgettext("atlanteans_worker", "Scout"),
helptext_script = dirname .. "helptexts.lua",
icon = dirname .. "menu.png",
-   vision_range = 2,
+   vision_range = 3,
 
buildcost = {
   atlanteans_carrier = 1

=== modified file 'data/tribes/workers/barbarians/scout/init.lua'
--- data/tribes/workers/barbarians/scout/init.lua	2017-02-12 09:10:57 +
+++ data/tribes/workers/barbarians/scout/init.lua	2017-12-16 17:12:13 +
@@ -17,7 +17,7 @@
descname = pgettext("barbarians_worker", "Scout"),
helptext_script = dirname .. "helptexts.lua",
icon = dirname .. "menu.png",
-   vision_range = 2,
+   vision_range = 3,
 
buildcost = {
   barbarians_carrier = 1

=== modified file 'data/tribes/workers/empire/scout/init.lua'
--- data/tribes/workers/empire/scout/init.lua	2017-02-12 09:10:57 +
+++ data/tribes/workers/empire/scout/init.lua	2017-12-16 17:12:13 +
@@ -17,7 +17,7 @@
descname = pgettext("empire_worker", "Scout"),
helptext_script = dirname .. "helptexts.lua",
icon = dirname .. "menu.png",
-   vision_range = 2,
+   vision_range = 3,
 
buildcost = {
   empire_carrier = 1

=== modified file 'src/logic/findimmovable.cc'
--- src/logic/findimmovable.cc	2017-05-20 22:42:49 +
+++ src/logic/findimmovable.cc	2017-12-16 17:12:13 +
@@ -21,6 +21,7 @@
 
 #include "base/macros.h"
 #include "economy/flag.h"
+#include "logic/map.h"
 #include "logic/map_objects/immovable.h"
 #include "logic/map_objects/tribes/militarysite.h"
 
@@ -66,6 +67,14 @@
 	}
 	return false;
 }
+// Enemy military sites that cannot be attacked (for scout)
+bool FindForeignMsite::accept(const BaseImmovable& imm) const {
+	if (upcast(MilitarySite const, ms, ))
+		{
+			return >owner() != 
+		}
+	return false;
+}
 
 bool FindImmovableByDescr::accept(const BaseImmovable& baseimm) const {
 	if (upcast(const Immovable, imm, )) {

=== modified file 'src/logic/findimmovable.h'
--- src/logic/findimmovable.h	2017-08-18 16:29:43 +
+++ src/logic/findimmovable.h	2017-12-16 17:12:13 +
@@ -138,6 +138,13 @@
 
 	bool accept(const BaseImmovable&) const;
 };
+struct FindForeignMsite {
+	explicit FindForeignMsite(const Player& init_player) : player(init_player) {
+	}
+	bool accept(const BaseImmovable&) const;
+	const Player& player;
+};
+
 struct FindImmovableByDescr {
 	explicit FindImmovableByDescr(const ImmovableDescr& init_descr) : descr(init_descr) {
 	}

=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc	2017-11-12 08:59:45 +
+++ src/logic/map_objects/tribes/worker.cc	2017-12-16 17:12:13 +
@@ -2551,6 +2551,141 @@
 	state.ivar1 = radius;
 	state.ivar2 = game.get_gametime() + time;
 
+	// Enemy military sites cannot be attacked, if those are not visible.
+	// However, Widelands workers are still somewhat aware of their presence. For example,
+	// Player does not acquire ownership of land, even if a militarysite blocking it is
+	// invisible. Therefore, it is IMO okay for the scout to be aware of those as well.
+	// Scout occasionally pays special attention to enemy military sites, to give the player
+	// an opportunity to attack. This is important, if the player can only build small huts
+	// and the enemy has one of the bigggest ones: without scout, the player has no way of attacking.
+	// The following block switches between two modes of operation:
+	// - Random walk
+	// - Lurking near an enemy military site.
+	// The code keeps track if interesting military sites, so that they all are visited.
+	// When the list of unvisited potential attack