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

2013-07-25 Thread Teppo Mäenpää
About trainingsites: How should these options differ?

Currently, there is an option regarding whether the trainingsite attempts to 
train least-trained guy or most-trained guy, if there are more than one tha 
could be trained in a step. There is no UI for that.

Also, it would be relatively easy to switch on/off the whole premature 
soldier-layoff feature.
-- 
https://code.launchpad.net/~widelands-dev/widelands/soldierselect_radiobutton/+merge/176784
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/soldierselect_radiobutton.

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

2013-07-27 Thread Teppo Mäenpää
I agree that the new buttons look really good, and that their placement is good 
as well.

However, start and stop buttons have now appeared to the lower left corner. 
Those should not be present in militarysites. Without this check, "Stop" and 
"Continue" buttons are not presented. The patch should not remove that check as 
it does now.
-- 
https://code.launchpad.net/~widelands-dev/widelands/soldierselect_radiobutton/+merge/176784
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/soldierselect_radiobutton.

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

2013-07-27 Thread Teppo Mäenpää
typo: "Without this check" -> "Without this patch"
-- 
https://code.launchpad.net/~widelands-dev/widelands/soldierselect_radiobutton/+merge/176784
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/soldierselect_radiobutton.

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

2013-07-27 Thread Teppo Mäenpää
Clarifying myself further: I would change soldierselect_radiobutton/6667 like 
below. This is a bit ugly, but I somehow just lost the attach-file button..:

=== modified file 'src/wui/buildingwindow.cc'
--- old/src/wui/buildingwindow.cc   2013-07-24 20:52:13 +
+++ new/src/wui/buildingwindow.cc   2013-07-27 08:48:17 +
@@ -196,7 +196,8 @@
}
}
else
-   if (upcast(const Widelands::ProductionSite, productionsite, 
&m_building)) {
+   if (upcast(const Widelands::ProductionSite, productionsite, 
&m_building))
+   if (not dynamic_cast(productionsite)) {
const bool is_stopped = productionsite->is_stopped();
UI::Button * stopbtn =
new UI::Button

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

___
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/fix-bug-1208130 into lp:widelands

2013-08-08 Thread Teppo Mäenpää
Review: Resubmit

Hi, I have now merged trunk/6711 to this branch for a re-review.

About the merge conflict:
There was a line saying" if ( !workarea_info.size()  ) return ; 
show_workarea();"
code checker complained about it.
I had changed that to  " if (  workarea_info.empty() ) return ; 
show_workarea();"
In trunk it was changed to " if ( !workarea_info.empty() ) return ; 
show_workarea();"
As these two modifications applied to the same line were not the same, there 
was a conflict.

I prefer my fix in the conflicting line better, as in current trunk the 
workarea is shown only when there is no workarea, while here it works, as 
before. Of course, my view could be biased.

Do you see it a bad thing, if people like me piggy-back some 
compiler/codechecker warning fixes to other fixes?

=

What was changed:

- Removed dead code from buildingwindow (methods void act_prefer_rookies() and 
act_prefer_heroes() )
- Changed the soldier list so that only player can click the preference button
- Changed the soldier to use the command relay function instead of directly 
changing the militarysite, to avoid desyncs in multiplayer games.
- Something I did not do, presumably Charly also figured out to keep the 
preference-tab up-to-date for observers ?

-- 
https://code.launchpad.net/~widelands-dev/widelands/fix-bug-1208130/+merge/179293
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/fix-bug-1208130.

___
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/fix-bug-1208130 into lp:widelands

2013-08-08 Thread Teppo Mäenpää
About the last bullet in the list of changes above: Yes, the preference stays 
in synch now -- I forgot to fix that line in my comment. It takes me about one 
hour to compile widelands, so I wrote the above text while waiting for miracles 
to happen.. SirVer, please re-review this branch, and merge if you find it OK.
-- 
https://code.launchpad.net/~widelands-dev/widelands/fix-bug-1208130/+merge/179293
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/fix-bug-1208130.

___
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/fix-bug-1208130 into lp:widelands

2013-08-08 Thread Teppo Mäenpää
Widelands is the most heavy-weight application I have ever used (off-work, that 
is), by a wide margin. My computer is just slow, CPU-wise. It only hurts when 
working with widelands, in all other cases I prefer my 
no-moving-parts-except-in-the-keyboard approach. It is faster than 
raspberrypi.. Normal computers make horrible sounds. To be honest, I have 
considered buying a normal computer just to speed WL (both game and 
compilation) up.

I do not think that any software solutions can overcome that. Turning some 
optimizations off in debug builds might help.
-- 
https://code.launchpad.net/~widelands-dev/widelands/fix-bug-1208130/+merge/179293
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/fix-bug-1208130.

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

2013-09-11 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/map_revision_data into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1210892 in widelands: "Map files should have a version number"
  https://bugs.launchpad.net/widelands/+bug/1210892

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

Adds version data to map files.

not done yet:
- Bundled maps would not have version information, yet. 
- Associated code with Widelands web page not even started yet.
- Version data is not displayed to the player anywhere.

See the bug discussion thread for more info.
-- 
https://code.launchpad.net/~widelands-dev/widelands/map_revision_data/+merge/184940
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/map_revision_data into lp:widelands.
=== modified file 'src/logic/map.cc'
--- src/logic/map.cc	2013-09-03 18:46:02 +
+++ src/logic/map.cc	2013-09-11 07:04:55 +
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include "build_info.h"
 #include "economy/flag.h"
 #include "economy/road.h"
 #include "editor/tools/editor_increase_resources_tool.h"
@@ -44,7 +45,6 @@
 #include "wui/overlay_manager.h"
 
 
-
 namespace Widelands {
 
 
@@ -71,9 +71,16 @@
 m_starting_pos   (0),
 m_fields (0),
 m_overlay_manager(0),
-m_pathfieldmgr   (new PathfieldManager)
+m_pathfieldmgr   (new PathfieldManager),
+m_map_version_major(0),
+m_map_version_minor(0)
 {
 	m_worldname[0] = '\0';
+	m_map_source_url.clear();
+	m_map_source_release.clear();
+	m_map_creator_version_original = build_id();
+	m_map_creator_version_latest = build_id();
+	m_map_version_timestamp = static_cast(time(NULL));
 }
 
 

=== modified file 'src/logic/map.h'
--- src/logic/map.h	2013-07-26 20:19:36 +
+++ src/logic/map.h	2013-09-11 07:04:55 +
@@ -124,6 +124,7 @@
 	friend struct WL_Map_Loader;
 	friend struct Map_Elemental_Data_Packet;
 	friend struct Map_Extradata_Data_Packet;
+	friend struct Map_Version_Data_Packet;
 	friend class Editor;
 	friend struct Main_Menu_New_Map;
 	friend struct MapGenerator;
@@ -433,6 +434,16 @@
 		void find_reachable(Area, const CheckStep &, functorT &);
 
 	template void find(const Area, functorT &) const;
+
+	// Map version information. Details in widelands_map_version_data_packet.cc
+	std::string m_map_source_url;
+	std::string m_map_source_release;
+	std::string m_map_creator_version_original;
+	std::string m_map_creator_version_latest;
+	int32_t m_map_version_major;
+	int32_t m_map_version_minor;
+	uint32_tm_map_version_timestamp;
+
 };
 
 

=== modified file 'src/map_io/widelands_map_loader.cc'
--- src/map_io/widelands_map_loader.cc	2013-07-26 20:19:36 +
+++ src/map_io/widelands_map_loader.cc	2013-09-11 07:04:55 +
@@ -52,6 +52,7 @@
 #include "map_io/widelands_map_roaddata_data_packet.h"
 #include "map_io/widelands_map_scripting_data_packet.h"
 #include "map_io/widelands_map_terrain_data_packet.h"
+#include "map_io/widelands_map_version_data_packet.h"
 #include "map_io/widelands_map_ware_data_packet.h"
 #include "map_io/widelands_map_waredata_data_packet.h"
 #include "warning.h"
@@ -198,6 +199,11 @@
 	{Map_Extradata_Data_Packet  p; p.Read(m_fs, egbase, !scenario, *m_mol);}
 	log("done!\n ");
 
+	log("Reading Map Version Data ... ");
+	{Map_Version_Data_Packet  p; p.Read(m_fs, egbase, !scenario, *m_mol);}
+	log("done!\n ");
+
+
 	log("Reading Allowed Worker Types Data ... ");
 	{
 		Map_Allowed_Worker_Types_Data_Packet p;

=== modified file 'src/map_io/widelands_map_saver.cc'
--- src/map_io/widelands_map_saver.cc	2013-07-26 20:19:36 +
+++ src/map_io/widelands_map_saver.cc	2013-09-11 07:04:55 +
@@ -49,6 +49,7 @@
 #include "map_io/widelands_map_roaddata_data_packet.h"
 #include "map_io/widelands_map_scripting_data_packet.h"
 #include "map_io/widelands_map_terrain_data_packet.h"
+#include "map_io/widelands_map_version_data_packet.h"
 #include "wexception.h"
 
 namespace Widelands {
@@ -114,6 +115,12 @@
 	{Map_Extradata_Data_Packet   p; p.Write(m_fs, m_egbase, *m_mos);}
 	log("done!\n ");
 
+	log("Writing Map Version ... ");
+	{Map_Version_Data_Packet   p; p.Write(m_fs, m_egbase, *m_mos);}
+	log("done!\n ");
+
+
+
 	const Map & map = m_egbase.map();
 
 	Player_Number const nr_players = map.get_nrplayers();

=== added file 'src/map_io/widelands_map_version_data_packet.cc'
--- src/map_io/widelands_map_version_data_packet.cc	1970-01-01 00:00:00 +
+++ src/map_io/widelands_map_version_data_packet.cc	2013-09-11 07:04:55 +
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2002-2004, 2006-20

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

2013-09-13 Thread Teppo Mäenpää
The _compatibility is needed for forward compatibility. If one would, for 
example, add a compelete history to map revision (suggestion of yours), in a 
way where the latest is store as before, then the older versions of the program 
could still read the map.

The alternative would lead to maps that cannot be loaded because of revision 
history. People downloading maps for their latest release would be less happy. 
I of course cannot know, but I would guess that people making maps also are 
more likely to download development snapshots than those just playing 
downloaded maps.
-- 
https://code.launchpad.net/~widelands-dev/widelands/map_revision_data/+merge/184940
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/map_revision_data.

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

2013-09-14 Thread Teppo Mäenpää
Review: Resubmit

I tested yesterday's changes. No obvious errors popped up..
-- 
https://code.launchpad.net/~widelands-dev/widelands/map_revision_data/+merge/184940
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/map_revision_data.

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

2013-09-14 Thread Teppo Mäenpää
I had only this version file and the worries of SirVer, expressed in the bug 
discusssion, in mind while making the _compatibility flag.

I agree that a global forward compatibility handling would be useful, even for 
savegames, but that would require one additional processing layer to saving and 
loading. Since slowing down saving harms playing experience, I won't even start 
anything like that despite I in a way would like to.

Maybe the discussion should continue in bug #1210892 page?
-- 
https://code.launchpad.net/~widelands-dev/widelands/map_revision_data/+merge/184940
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/map_revision_data.

___
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-1236538-minimalfix into lp:widelands

2013-10-08 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/bug-1236538-minimalfix into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1236538 in widelands: "Too many soldiers are created"
  https://bugs.launchpad.net/widelands/+bug/1236538

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1236538-minimalfix/+merge/189864

minimal invasive fix to bug 1236538
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1236538-minimalfix/+merge/189864
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1236538-minimalfix into lp:widelands.
=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc	2013-07-26 20:19:36 +
+++ src/economy/economy.cc	2013-10-08 14:22:45 +
@@ -30,6 +30,7 @@
 #include "economy/warehousesupply.h"
 #include "logic/game.h"
 #include "logic/player.h"
+#include "logic/soldier.h"
 #include "logic/tribe.h"
 #include "logic/warehouse.h"
 #include "upcast.h"
@@ -794,6 +795,9 @@
 		_start_request_timer(rsps.nexttimer);
 }
 
+
+std::unique_ptr Economy::m_soldier_prototype = nullptr; // minimal invasive fix of bug 1236538
+
 /**
  * Check whether there is a supply for the given request. If the request is a
  * worker request without supply, attempt to create a new worker in a warehouse.
@@ -802,6 +806,26 @@
 {
 	unsigned demand = 0;
 
+	bool soldier_level_check;
+	const Tribe_Descr & tribe = owner().tribe();
+	const Worker_Descr & w_desc = *tribe.get_worker_descr(index);
+
+	// Make a dummy soldier, which should never be assigned to any economy
+	// Minimal invasive fix of bug 1236538
+	if (is_a(Soldier_Descr, &w_desc))
+	{
+		if (nullptr == m_soldier_prototype)
+		{
+			upcast(Soldier_Descr const, s_desc, &w_desc);
+			Soldier* test_rookie = static_cast (&(s_desc->create_object()));
+			m_soldier_prototype = static_cast> (test_rookie);
+		}
+		soldier_level_check = true;
+	}
+	else
+		soldier_level_check = false;
+
+
 	container_iterate_const(RequestList, m_requests, j) {
 		const Request & req = **j.current;
 
@@ -813,17 +837,24 @@
 		if (m_supplies.have_supplies(game, req))
 			continue;
 
+		// Requests for heroes should not trigger the creation of more rookies
+		if (soldier_level_check)
+		{
+			if (not (req.get_requirements().check(*m_soldier_prototype)))
+continue;
+		}
+
+
 		demand += req.get_open_count();
 	}
 
 	if (!demand)
 		return;
 
+
 	// We have worker demand that is not fulfilled by supplies
 	// Find warehouses where we can create the required workers,
 	// and collect stats about existing build prerequisites
-	const Tribe_Descr & tribe = owner().tribe();
-	const Worker_Descr & w_desc = *tribe.get_worker_descr(index);
 	const Worker_Descr::Buildcost & cost = w_desc.buildcost();
 	std::vector total_available;
 	uint32_t total_planned = 0;

=== modified file 'src/economy/economy.h'
--- src/economy/economy.h	2013-07-26 20:19:36 +
+++ src/economy/economy.h	2013-10-08 14:22:45 +
@@ -20,6 +20,7 @@
 #ifndef ECONOMY_H
 #define ECONOMY_H
 
+#include 
 #include 
 #include 
 
@@ -27,6 +28,7 @@
 #include 
 
 #include "logic/instances.h"
+#include "logic/soldier.h"
 #include "logic/warelist.h"
 #include "logic/wareworker.h"
 #include "economy/supply_list.h"
@@ -225,6 +227,9 @@
 	 * excessive calls to the request/supply balancing logic.
 	 */
 	uint32_t m_request_timerid;
+
+	static std::unique_ptr m_soldier_prototype;
+
 };
 
 }

=== modified file 'src/logic/soldier.h'
--- src/logic/soldier.h	2013-09-14 14:52:25 +
+++ src/logic/soldier.h	2013-10-08 14:22:45 +
@@ -39,6 +39,7 @@
 #define HP_FRAMECOLOR RGBColor(255, 255, 255)
 
 struct Soldier_Descr : public Worker_Descr {
+	friend class Economy;
 	Soldier_Descr
 		(char const * const _name, char const * const _descname,
 		 const std::string & directory, Profile &, Section & global_s,

___
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-bug-1235562-fix into lp:widelands

2013-10-15 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/bug-bug-1235562-fix into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1235562 in widelands: "Green player cannot expand in "Rendez-Vous" map"
  https://bugs.launchpad.net/widelands/+bug/1235562

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-bug-1235562-fix/+merge/191335

Unless somebody knows the author of "Rendez-vous" map, and assigns the bug 
report to him, I think we should fix the map to release the green player from 
his cage.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-bug-1235562-fix/+merge/191335
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-bug-1235562-fix into lp:widelands.
=== modified file 'maps/Rendez-Vous.wmf/binary/heights'
Binary files maps/Rendez-Vous.wmf/binary/heights	2010-04-23 11:05:57 + and maps/Rendez-Vous.wmf/binary/heights	2013-10-16 05:20:33 + differ
___
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/feature-loudylobby into lp:widelands

2014-02-22 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/feature-loudylobby into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1278026 in widelands: "Waiting for participants in the metaserver lobby 
is not fun."
  https://bugs.launchpad.net/widelands/+bug/1278026

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/feature-loudylobby/+merge/207819

This adds two sounds to the internet lobby: One when a new person enters the 
lobby, another one when somebody posts a message there.
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-loudylobby/+merge/207819
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/feature-loudylobby into lp:widelands.
=== added file 'sound/message_chat_00.ogg'
Binary files sound/message_chat_00.ogg	1970-01-01 00:00:00 + and sound/message_chat_00.ogg	2014-02-23 07:26:47 + differ
=== added file 'sound/message_freshmen_00.ogg'
Binary files sound/message_freshmen_00.ogg	1970-01-01 00:00:00 + and sound/message_freshmen_00.ogg	2014-02-23 07:26:47 + differ
=== modified file 'src/sound/sound_handler.cc'
--- src/sound/sound_handler.cc	2014-02-22 18:04:02 +
+++ src/sound/sound_handler.cc	2014-02-23 07:26:47 +
@@ -213,6 +213,8 @@
 	load_fx_if_needed("sound", "message", "sound/message");
 	load_fx_if_needed("sound/military", "under_attack", "sound/military/under_attack");
 	load_fx_if_needed("sound/military", "site_occupied", "sound/military/site_occupied");
+	load_fx_if_needed("sound", "message_chat", "sound/message_chat");
+	load_fx_if_needed("sound", "message_freshmen", "sound/message_freshmen");
 }
 
 /** Load a sound effect. One sound effect can consist of several audio files

=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc	2014-02-22 18:04:02 +
+++ src/ui_basic/panel.cc	2014-02-23 07:26:47 +
@@ -815,6 +815,15 @@
 {
 	g_sound_handler.play_fx("sound/click", 128, PRIO_ALWAYS_PLAY);
 }
+void Panel::play_new_chat_message()
+{
+	g_sound_handler.play_fx("sound/message_chat", 128, PRIO_ALWAYS_PLAY);
+}
+void Panel::play_new_chat_member()
+{
+	g_sound_handler.play_fx("sound/message_freshmen", 128, PRIO_ALWAYS_PLAY);
+}
+
 
 /**
  * Recursively walk the panel tree, killing panels that are marked for death

=== modified file 'src/ui_basic/panel.h'
--- src/ui_basic/panel.h	2013-10-14 07:20:46 +
+++ src/ui_basic/panel.h	2014-02-23 07:26:47 +
@@ -241,6 +241,8 @@
 	virtual void update_desired_size();
 
 	static void play_click();
+	static void play_new_chat_member();
+	static void play_new_chat_message();
 
 	static bool draw_tooltip(RenderTarget &, const std::string & text);
 

=== modified file 'src/ui_fsmenu/internet_lobby.cc'
--- src/ui_fsmenu/internet_lobby.cc	2014-02-22 18:04:02 +
+++ src/ui_fsmenu/internet_lobby.cc	2014-02-23 07:26:47 +
@@ -43,6 +43,7 @@
 	m_buth (get_h() * 19 / 400),
 	m_lisw (get_w() * 623 / 1000),
 	m_fs   (fs_small()),
+	m_prev_clientlist_len(1000),
 	m_fn   (ui_fn()),
 
 // Text labels
@@ -295,6 +296,14 @@
 continue;
 		}
 	}
+
+	// If a new player joins the lobby, play a sound.
+	if (clients.size() != m_prev_clientlist_len)
+	{
+		if (clients.size() > m_prev_clientlist_len)
+			play_new_chat_member();
+		m_prev_clientlist_len = clients.size();
+	}
 }
 
 

=== modified file 'src/ui_fsmenu/internet_lobby.h'
--- src/ui_fsmenu/internet_lobby.h	2014-02-22 18:04:02 +
+++ src/ui_fsmenu/internet_lobby.h	2014-02-23 07:26:47 +
@@ -52,6 +52,7 @@
 	uint32_t m_buth;
 	uint32_t m_lisw;
 	uint32_t m_fs;
+	uint32_t m_prev_clientlist_len;
 	std::string m_fn;
 	UI::Textarea title, m_clients, m_opengames;
 	UI::Textarea m_servername;

=== modified file 'src/wui/gamechatpanel.cc'
--- src/wui/gamechatpanel.cc	2013-09-21 15:24:24 +
+++ src/wui/gamechatpanel.cc	2014-02-23 07:26:47 +
@@ -31,7 +31,8 @@
 	UI::Panel(parent, x, y, w, h),
 	m_chat   (chat),
 	chatbox  (this, 0, 0, w, h - 25, "", UI::Align_Left, 1),
-	editbox  (this, 0, h - 20, w,  20)
+	editbox  (this, 0, h - 20, w,  20),
+	chat_message_counter(0)
 {
 	chatbox.set_scrollmode(UI::Multiline_Textarea::ScrollLog);
 	editbox.ok.connect(boost::bind(&GameChatPanel::keyEnter, this));
@@ -62,6 +63,20 @@
 	str += "";
 
 	chatbox.set_text(str);
+
+	// If there are new messages, play a sound
+	if (msgs.size() > chat_message_counter)
+	{
+		// computer generated ones are ignored
+		// Note: if many messages arrive simultaneously,
+		// the latest is a system message and some others
+		// are not, then this act wrong!
+		if (not msgs . back() . sender . empty())
+			// Alert me!
+			play_new_chat_message();

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

2014-04-02 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/feature-loudylobby into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1278026 in widelands: "Waiting for participants in the metaserver lobby 
is not fun."
  https://bugs.launchpad.net/widelands/+bug/1278026

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/feature-loudylobby/+merge/213784

This silences the IRC messages at lobby. Messages still appear, just the sound 
goes away.
More about the bridge at https://wl.widelands.org/forum/topic/1468/

Good:
- Very simple change. Improves the use experience in my opinion.

Bad:
- Hard-coded string constants are ugly.
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-loudylobby/+merge/213784
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/feature-loudylobby into lp:widelands.
=== modified file 'src/wui/gamechatpanel.cc'
--- src/wui/gamechatpanel.cc	2014-03-30 14:05:24 +
+++ src/wui/gamechatpanel.cc	2014-04-02 09:03:50 +
@@ -65,15 +65,21 @@
 	chatbox.set_text(str);
 
 	// If there are new messages, play a sound
-	if (msgs.size() > chat_message_counter)
+	if (msgs.size() != chat_message_counter)
 	{
 		// computer generated ones are ignored
 		// Note: if many messages arrive simultaneously,
 		// the latest is a system message and some others
 		// are not, then this act wrong!
 		if (!msgs.back().sender.empty() && !m_chat.sound_off())
+		{
 			// The latest message is not a system message
-			play_new_chat_message();
+			if (std::string::npos == msgs.back().sender.find("(IRC)"))
+// The latest message was not relayed from IRC.
+// The above built-in string constant should match
+// that of the IRC bridge.
+play_new_chat_message();
+		}
 		chat_message_counter = msgs . size();
 
 	}

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

2014-04-06 Thread Teppo Mäenpää
> Should there not be a checkbox

Is the IRC bridge now frozen or is it still evolving?

If I was the project dictator, I would either disable IRC-lobby by default: 
Only messages addressed to IRC bridge would be shown. If I want to be alerted 
when there are interesting IRC discussions, then consulting the IRC client 
would be the way to proceed. The current combination just does not work right.

I am not sure whether the checkbox would improve things or cause more 
confision. If people at IRC assume that people at lobby see what they write, 
that could cause confusion when some don't. Also if there are >1 people at the 
lobby, and one of them responds to IRC messages, the other at lobby with 
filtering might misinterpret those words.

In short, think that this one-liner is better, and that it depends on how the 
IRC bridge evolves. I would just do this now and return to the issue later.
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-loudylobby/+merge/213784
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/feature-loudylobby 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/feature-1478-stone-mine-streamline into lp:widelands

2014-04-08 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline into 
lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/feature-1478-stone-mine-streamline/+merge/214822

This removes the second program from Empire's marble mine.

The reason is to allow miner training after resources have exhausted. See forum 
thread 1478 for more verbose discussion.


I playtested this briefly, and did not notice problems.
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-1478-stone-mine-streamline/+merge/214822
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline into 
lp:widelands.
=== modified file 'tribes/empire/marblemine/conf'
--- tribes/empire/marblemine/conf	2014-03-17 17:23:26 +
+++ tribes/empire/marblemine/conf	2014-04-08 19:09:05 +
@@ -23,34 +23,17 @@
 wine=6
 
 [programs]
-mine_marble=_Mine marble
-mine_stone=_Mine stone
 work=_Work
 
-[mine_marble]
-sleep=2
-consume=wine ration
-animate=working 2
-mine=granit 2 50 5
-produce=marble:2
-animate=working 2
-mine=granit 2 50 5
-produce=marble stone
-
-[mine_stone]
+[work]
 sleep=2
 consume=ration wine
 animate=working 2
 mine=granit 2 50 5
-produce=stone marble
-animate=working 2
-mine=granit 2 50 5
 produce=stone:2
-
-[work]
-call=mine_marble
-call=mine_stone
-return=skipped
+animate=working 2
+mine=granit 2 50 5
+produce=marble:2
 
 [idle]
 pics=marblemine_i_??.png

___
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/feature-1478-stone-mine-streamline into lp:widelands

2014-04-08 Thread Teppo Mäenpää
https://wl.widelands.org/forum/topic/1478/
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-1478-stone-mine-streamline/+merge/214822
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline 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/feature-1478-stone-mine-streamline into lp:widelands

2014-04-08 Thread Teppo Mäenpää
Review: Needs Fixing

The training problem is present in other shallow empire mines. too.
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-1478-stone-mine-streamline/+merge/214822
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline.

___
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/feature-1478-stone-mine-streamline into lp:widelands

2014-04-13 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline into 
lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/feature-1478-stone-mine-streamline/+merge/215594

For background, see discussion in forum thread 1478 (About empty mines).

This merge would lead to miners gaining experience with a small probability, 
when they are trying to extract something out of an empty mine. The "small 
probability" is configurable, currently (branch revision 6939) there is a 
1-in-6 change of gaining experience.

-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-1478-stone-mine-streamline/+merge/215594
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline into 
lp:widelands.
=== modified file 'src/logic/production_program.cc'
--- src/logic/production_program.cc	2014-03-16 20:55:15 +
+++ src/logic/production_program.cc	2014-04-14 04:13:39 +
@@ -1119,6 +1119,16 @@
 			char * endp;
 			unsigned long long int const value = strtoull(parameters, &endp, 0);
 			m_chance = value;
+			if (*endp != ' ' or value < 1 or 100 < value)
+throw game_data_error
+	("expected %s but found \"%s\"",
+	 "percentage", parameters);
+			parameters = endp;
+		}
+		{
+			char * endp;
+			unsigned long long int const value = strtoull(parameters, &endp, 0);
+			m_training = value;
 			if (*endp or value < 1 or 100 < value)
 throw game_data_error
 	("expected %s but found \"%s\"",
@@ -1240,6 +1250,10 @@
 			snprintf
 (ps.m_result_buffer, sizeof(ps.m_result_buffer),
  _("Can’t find any more resources!"));
+			// Gain experience
+			if (m_training >= game.logic_rand() % 100) {
+			  ps.train_workers(game);
+			}
 			return ps.program_end(game, Failed);
 		}
 	}

=== modified file 'src/logic/production_program.h'
--- src/logic/production_program.h	2014-02-22 18:04:02 +
+++ src/logic/production_program.h	2014-04-14 04:13:39 +
@@ -427,9 +427,10 @@
 		virtual void informPlayer(Game &, ProductionSite &) const;
 	private:
 		Resource_Index m_resource;
-		uint8_tm_distance;
-		uint8_tm_max;
-		uint8_tm_chance;
+		uint8_tm_distance; // width/radius of mine
+		uint8_tm_max;  // Can work up to this percent (of total mountain resources)
+		uint8_tm_chance; // odds of finding resources from empty mine
+		uint8_tm_training; // probability of training in _empty_ mines
 	};
 
 	struct ActCheck_Soldier : public Action {

=== modified file 'src/logic/productionsite.cc'
--- src/logic/productionsite.cc	2014-03-16 21:41:57 +
+++ src/logic/productionsite.cc	2014-04-14 04:13:39 +
@@ -856,10 +856,8 @@
 		m_statistics.erase(m_statistics.begin(), m_statistics.begin() + 1);
 		m_statistics.push_back(result == Completed);
 		if (result == Completed) {
-			for (uint32_t i = descr().nr_working_positions(); i;)
-m_working_positions[--i].worker->gain_experience(game);
+			train_workers(game);
 			m_result_buffer[0] = '\0';
-			Building::workers_changed();
 		}
 		calc_statistics();
 		break;
@@ -876,6 +874,14 @@
 	m_program_time = schedule_act(game, m_post_timer);
 }
 
+void ProductionSite::train_workers(Game & game)
+{
+	for (uint32_t i = descr().nr_working_positions(); i;)
+		m_working_positions[--i].worker->gain_experience(game);
+	Building::workers_changed();
+}
+
+
 /// Changes the default anim string to \li anim
 void ProductionSite::set_default_anim(std::string anim)
 {

=== modified file 'src/logic/productionsite.h'
--- src/logic/productionsite.h	2014-04-06 10:50:39 +
+++ src/logic/productionsite.h	2014-04-14 04:13:39 +
@@ -211,6 +211,7 @@
 
 	void program_start(Game &, const std::string & program_name);
 	virtual void program_end(Game &, Program_Result);
+	virtual void train_workers(Game &);
 
 	void calc_statistics();
 	void try_start_working(Game &);

=== modified file 'tribes/atlanteans/coalmine/conf'
--- tribes/atlanteans/coalmine/conf	2014-03-17 17:23:26 +
+++ tribes/atlanteans/coalmine/conf	2014-04-14 04:13:39 +
@@ -30,13 +30,13 @@
 consume=smoked_fish,smoked_meat:2 bread:2
 sleep=45000
 animate=working 2
-mine=coal 4 100 5
-produce=coal:2
-animate=working 2
-mine=coal 4 100 5
-produce=coal:2
-animate=working 2
-mine=coal 4 100 5
+mine=coal 4 100 5 2
+produce=coal:2
+animate=working 2
+mine=coal 4 100 5 2
+produce=coal:2
+animate=working 2
+mine=coal 4 100 5 2
 produce=coal:3
 
 [idle]

=== modified file 'tribes/atlanteans/crystalmine/conf'
--- tribes/atlanteans/crystalmine/conf	2014-03-17 17:23:26 +
+++ tribes/atlanteans/crystalmine/conf	2014-04-14 04:13:39 +
@@ -35,16

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline into lp:widelands

2014-04-15 Thread Teppo Mäenpää
> Is that not enough?

No, it is not enough, at least not in my opinion. Please let me clarify:

>So there is always the chance that something is produced and that will level 
>the worker.

The probability to get stuff out of an empty mine is 5%.

In case of Empire's marble mine (and some other mines), mining must be 
successful twice in a row, before the worker can gain experience. Five percent 
squared is two and half per mill or 1/400.

In practice, if the player has an empty mine lacks, say, five experience 
points, he needs to deliver 2000 wine bottles and rations to the mine before 
upgrading. That is a really long wait. In my opinion, this makes the wait time 
tolerable while keeping it annoying.

Direct link to the referred forum discussion: 
https://wl.widelands.org/forum/topic/1478/
and a direct link to the post which triggered this branch: 
https://wl.widelands.org/forum/post/10804/
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-1478-stone-mine-streamline/+merge/215594
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline 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/feature-1478-stone-mine-streamline into lp:widelands

2014-04-15 Thread Teppo Mäenpää
Current program:
1) Eat&Drink
2) Draw mountain resources
3) Produce output wares
4) Draw mountain resources
5) Produce output wares
6) (implicit: gain experience)

Streamlining-like solution 1:
If I would remove step four, the training issue would be gone. However, Empire 
mines would last twice as long as previously. Is this what was wanted?

Streamlining-like solution 2:
If I would remove steps 4 and 5, the training issue would be solved, but the 
amout of wares/food would be halved. Is this what was wanted?

Streamlining-like solution 3:
If I would remove steps 4 and 5, double the amount of foodstuff brewery, winery 
and tavern produce, and tune the amount of training points needed, all would be 
fine except that road traffic would be larger than previously. I do not think 
this would be a major handicap, but since the goal was to solve a small 
training issue in case of empty mines, not rock the boat.

This merge request only touches the amount of experience when mining an 
exhausted mine, leaving everything else work just as before. The only penalty 
is few lines of additional code, plus one more parameter to the mine command. 
Which of the alternatives do you see superior to what I suggest here?
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-1478-stone-mine-streamline/+merge/215594
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/feature-1478-stone-mine-streamline 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/bug-1304638-firstfix into lp:widelands

2014-04-15 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/bug-1304638-firstfix into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1304638 in widelands: "Wrong sound played"
  https://bugs.launchpad.net/widelands/+bug/1304638

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1304638-firstfix/+merge/215932

This fixes the bug 1304638. I think.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1304638-firstfix/+merge/215932
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1304638-firstfix into lp:widelands.
=== renamed file 'sound/message_chat_00.ogg' => 'sound/lobby_chat_00.ogg'
=== renamed file 'sound/message_freshmen_00.ogg' => 'sound/lobby_freshmen_00.ogg'
=== modified file 'src/sound/sound_handler.cc'
--- src/sound/sound_handler.cc	2014-03-27 06:29:50 +
+++ src/sound/sound_handler.cc	2014-04-15 18:22:03 +
@@ -215,8 +215,8 @@
 	load_fx_if_needed("sound", "message", "sound/message");
 	load_fx_if_needed("sound/military", "under_attack", "sound/military/under_attack");
 	load_fx_if_needed("sound/military", "site_occupied", "sound/military/site_occupied");
-	load_fx_if_needed("sound", "message_chat", "sound/message_chat");
-	load_fx_if_needed("sound", "message_freshmen", "sound/message_freshmen");
+	load_fx_if_needed("sound", "lobby_chat", "sound/lobby_chat");
+	load_fx_if_needed("sound", "lobby_freshmen", "sound/lobby_freshmen");
 }
 
 /** Load a sound effect. One sound effect can consist of several audio files

=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc	2014-03-09 10:28:39 +
+++ src/ui_basic/panel.cc	2014-04-15 18:22:03 +
@@ -843,11 +843,11 @@
 }
 void Panel::play_new_chat_message()
 {
-	g_sound_handler.play_fx("sound/message_chat", 128, PRIO_ALWAYS_PLAY);
+	g_sound_handler.play_fx("sound/lobby_chat", 128, PRIO_ALWAYS_PLAY);
 }
 void Panel::play_new_chat_member()
 {
-	g_sound_handler.play_fx("sound/message_freshmen", 128, PRIO_ALWAYS_PLAY);
+	g_sound_handler.play_fx("sound/lobby_freshmen", 128, PRIO_ALWAYS_PLAY);
 }
 
 

=== modified file 'src/wui/gamechatpanel.cc'
--- src/wui/gamechatpanel.cc	2014-04-07 01:51:56 +
+++ src/wui/gamechatpanel.cc	2014-04-15 18:22:03 +
@@ -32,7 +32,7 @@
 	m_chat   (chat),
 	chatbox  (this, 0, 0, w, h - 25, "", UI::Align_Left, 1),
 	editbox  (this, 0, h - 20, w,  20),
-	chat_message_counter(0)
+	chat_message_counter(-1) // uint, setting to maximum value
 {
 	chatbox.set_scrollmode(UI::Multiline_Textarea::ScrollLog);
 	editbox.ok.connect(boost::bind(&GameChatPanel::keyEnter, this));
@@ -65,7 +65,7 @@
 	chatbox.set_text(str);
 
 	// If there are new messages, play a sound
-	if (msgs.size() != chat_message_counter)
+	if (0 < msgs.size() && msgs.size() != chat_message_counter)
 	{
 		// computer generated ones are ignored
 		// Note: if many messages arrive simultaneously,
@@ -74,7 +74,7 @@
 		if (!msgs.back().sender.empty() && !m_chat.sound_off())
 		{
 			// The latest message is not a system message
-			if (std::string::npos == msgs.back().sender.find("(IRC)"))
+			if (std::string::npos == msgs.back().sender.find("(IRC)") && chat_message_counter < msgs.size())
 			{
 // The latest message was not relayed from IRC.
 // The above built-in string constant should match

___
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-1292828-cleanup into lp:widelands

2014-04-22 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/bug-1292828-cleanup into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1292828 in widelands: 
"src/map_io/widelands_map_buildingdata_data_packet.cc has a variable rel17comp 
which can be removed"
  https://bugs.launchpad.net/widelands/+bug/1292828

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1292828-cleanup/+merge/216705

removed few no-longer-needed lines of code.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1292828-cleanup/+merge/216705
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1292828-cleanup into lp:widelands.
=== modified file 'src/map_io/widelands_map_buildingdata_data_packet.cc'
--- src/map_io/widelands_map_buildingdata_data_packet.cc	2014-04-21 10:47:03 +
+++ src/map_io/widelands_map_buildingdata_data_packet.cc	2014-04-22 12:20:24 +
@@ -744,10 +744,7 @@
 {
 	try {
 		uint16_t const packet_version = fr.Unsigned16();
-		bool rel17comp = false;
-		if (3 == packet_version and 4 == CURRENT_MILITARYSITE_PACKET_VERSION)
-			rel17comp = true;
-		if (packet_version == CURRENT_MILITARYSITE_PACKET_VERSION or rel17comp)
+		if (packet_version == CURRENT_MILITARYSITE_PACKET_VERSION)
 		{
 			read_productionsite(militarysite, fr, game, mol);
 
@@ -765,9 +762,6 @@
 			else
 militarysite.m_normal_soldier_request.reset();
 
-			if (rel17comp) // compatibility with release 17 savegames
-militarysite.m_upgrade_soldier_request.reset();
-			else
 			if (fr.Unsigned8())
 			{
 militarysite.m_upgrade_soldier_request.reset
@@ -803,26 +797,14 @@
 			//  capacity (modified by user)
 			militarysite.m_capacity = fr.Unsigned8();
 			militarysite.m_nexthealtime = fr.Signed32();
-			if (not (rel17comp)) // compatibility with release 17 savegames
-			{
 
-uint16_t reqmin = fr.Unsigned16();
-uint16_t reqmax = fr.Unsigned16();
-militarysite.m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax);
-militarysite.m_soldier_preference = static_cast(fr.Unsigned8());
-militarysite.m_next_swap_soldiers_time = fr.Signed32();
-militarysite.m_soldier_upgrade_try = 0 != fr.Unsigned8() ? true : false;
-militarysite.m_doing_upgrade_request = 0 != fr.Unsigned8() ? true : false;
-			}
-			else // Release 17 compatibility branch. Some safe values.
-			{
-militarysite.m_soldier_preference = MilitarySite::kPrefersRookies;
-if (2 < militarysite.m_capacity)
-	militarysite.m_soldier_preference = MilitarySite::kPrefersHeroes;
-militarysite.m_next_swap_soldiers_time = militarysite.m_nexthealtime;
-militarysite.m_soldier_upgrade_try = false;
-militarysite.m_doing_upgrade_request = false;
-			}
+			uint16_t reqmin = fr.Unsigned16();
+			uint16_t reqmax = fr.Unsigned16();
+			militarysite.m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax);
+			militarysite.m_soldier_preference = static_cast(fr.Unsigned8());
+			militarysite.m_next_swap_soldiers_time = fr.Signed32();
+			militarysite.m_soldier_upgrade_try = 0 != fr.Unsigned8() ? true : false;
+			militarysite.m_doing_upgrade_request = 0 != fr.Unsigned8() ? true : false;
 
 		} else
 			throw game_data_error
@@ -1086,11 +1068,7 @@
 	try {
 		uint16_t const trainingsite_packet_version = fr.Unsigned16();
 
-		bool rel17comp = false; // compatibility with release 17
-		if (4 == CURRENT_TRAININGSITE_PACKET_VERSION && 3 == trainingsite_packet_version)
-			rel17comp = true;
-
-		if (trainingsite_packet_version == CURRENT_TRAININGSITE_PACKET_VERSION or rel17comp)
+		if (trainingsite_packet_version == CURRENT_TRAININGSITE_PACKET_VERSION)
 		{
 			read_productionsite(trainingsite, fr, game, mol);
 
@@ -1127,20 +1105,17 @@
 	fr.Signed32();
 }
 			}
-			// load premature kick-out state, was not in release 17..
-			if (not rel17comp)
+
+			uint16_t mapsize = fr.Unsigned16(); // map of training levels (not _the_ map)
+			while (mapsize)
 			{
-uint16_t mapsize = fr.Unsigned16();
-while (mapsize)
-{
-	uint16_t traintype  = fr.Unsigned16();
-	uint16_t trainlevel = fr.Unsigned16();
-	uint16_t trainstall = fr.Unsigned16();
-	uint16_t spresence  = fr.Unsigned8();
-	mapsize--;
-	std::pair t = std::make_pair(trainstall, spresence);
-	trainingsite.training_failure_count[std::make_pair(traintype, trainlevel)] = t;
-}
+uint16_t traintype  = fr.Unsigned16();
+uint16_t trainlevel = fr.Unsigned16();
+uint16_t trainstall = fr.Unsigned16();
+uint16_t spresence  = fr.Unsigned8();
+mapsize--;
+std::pair t = std::make_pair(trainstall, spresence);
+trainingsite.training_failure_count[std::make_pair(traintype, trainlevel)] = t;
 			}
 		} else
 			throw game_data_error

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : wi

Re: [Widelands-dev] [Merge] lp:~tiborb95/widelands/tiborb-ai into lp:widelands

2014-05-16 Thread Teppo Mäenpää
>or do I need just merge trunk to my branch?

That is one good way to ensure that if you mess up, trunk remains clean.
-- 
https://code.launchpad.net/~tiborb95/widelands/tiborb-ai/+merge/219750
Your team Widelands Developers is requested to review the proposed merge of 
lp:~tiborb95/widelands/tiborb-ai 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/cmake-reworked into lp:widelands

2014-06-21 Thread Teppo Mäenpää
=== Long answer (shorter below) ===

command target_include_directories ( found in src/CMakeLists.txt:62 ) is not 
supported by cmake 2.8.9, which is what debian wheezy (=current stable) uses.

The next Debian release, which ships a new-enough cmake, is planned in early 
2015.

So-called "backports" repository of Wheezy contains cmake 2.8.11, which 
recognizes target_include_directories, but does not handle the SYSTEM 
command ( src/CMakeLists.txt:66, for example)

At the moment of writing, there is a work-around: compiling cmake 2.8.12 (or 
newer) from a so-called testing repository. However, from time to time Debian 
as made forward-incompatible changes to packages of future releases. If that 
would happen again, then this work-around would go away.

=== Short answer ===

Does not compile in Debian stable. If we plan another release this year, this 
might be an issue.

-fext-numeric-literals flag was introduced in gcc-4.8.0 (Wheezy ships with 
gcc-4.7.2)
-Wpedantic is called -pedantic in gcc-4.7.2

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

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

2014-07-13 Thread Teppo Mäenpää
> another layer of compatibility code, which I'd rather avoid.

Could this be in one of those cases where polishing the English should be done 
at Widelands-to British/American/whatever translations instead of the Widelands 
code itself?


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

___
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/bug-1348800-forester_adds_weight into lp:widelands

2015-01-12 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~kxq/widelands/bug-1348800-forester_adds_weight into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1348800 in widelands: "Parameters for terrain affinity need tweaking"
  https://bugs.launchpad.net/widelands/+bug/1348800

For more details, see:
https://code.launchpad.net/~kxq/widelands/bug-1348800-forester_adds_weight/+merge/246209

Forester now favours the most suitable tree(s).


-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~kxq/widelands/bug-1348800-forester_adds_weight into lp:widelands.
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc	2014-12-28 16:45:37 +
+++ src/logic/worker.cc	2015-01-12 18:29:14 +
@@ -843,8 +843,24 @@
 	}
 
 	// Randomly pick one of the immovables to be planted.
-	const uint32_t idx = game.logic_rand() % best_suited_immovables_index.size();
-	state.ivar2 = std::get<1>(*std::next(best_suited_immovables_index.begin(), idx));
+
+	// Each candidate is weighted by its probability to grow.
+	double total_weight = 0.0;
+	for (auto bsii : best_suited_immovables_index)
+	{
+		double weight = std::get<0>(bsii)
+		total_weight += weight * weight;
+	}
+
+	double choice = logic_rand_as_double(&game) * total_weight;
+
+	for (auto bsii : best_suited_immovables_index)
+	if (0 < choice)
+	{
+		double weight = std::get<0>(bsii)
+		state.ivar2 = std::get<1>(bsii);
+		choice -= weight * weight;
+	}
 
 	Immovable& newimm =
 	   game.create_immovable(pos, state.ivar2, state.svar1 == "tribe" ? &descr().tribe() : nullptr);

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

2015-01-31 Thread Teppo Mäenpää
About one year ago, when the refactoring of strings was supposed to be ready, 
the Finnish translation of Empire was complete. Now about 30% of the strings 
are "untranslated", despite that hardly anything has changed in the tribe. 
Other text packages have deteoriated at similar pace. This is not motivating at 
all.

Can somebody ensure, that these strings do not need retranslation just because 
of somebody did minor touches on the English originals?

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

___
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-1451078-fix into lp:widelands

2015-05-03 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging lp:~widelands-dev/widelands/bug-1451078-fix 
into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1451078 in widelands: "labyrinth malfunctions full report"
  https://bugs.launchpad.net/widelands/+bug/1451078

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1451078-fix/+merge/258118

Fixed a simple bug (changed a break-statement into a continue-statement in the 
loop where trainingsite checks which soldiers may stay further).


-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1451078-fix into lp:widelands.
=== modified file 'src/logic/trainingsite.cc'
--- src/logic/trainingsite.cc	2014-11-30 18:49:38 +
+++ src/logic/trainingsite.cc	2015-05-03 09:34:51 +
@@ -483,28 +483,27 @@
 		}
 		else
 		{
-			std::vector::iterator it = m_upgrades.begin();
-			for (; it != m_upgrades.end(); ++it)
+			for (const Upgrade& it: m_upgrades)
 			if  (! this_soldier_is_safe)
 			{
 // Soldier is safe, if he:
 //  - is below maximum, and
 //  - is not in a stalled state
 // Check done separately for each art.
-int32_t level = m_soldiers[i]->get_level(it->attribute);
+int32_t level = m_soldiers[i]->get_level(it.attribute);
 
  // Below maximum -check
-if (level > it->max)
+if (level > it.max)
 {
-	break;
+	continue;
 }
 
-TypeAndLevel train_tl(it->attribute, level);
+TypeAndLevel train_tl(it.attribute, level);
 TrainFailCount::iterator tstep = training_failure_count.find(train_tl);
 if (tstep ==  training_failure_count.end())
 	{
 		log("\nTrainingSite::drop_stalled_soldiers: ");
-		log("training step %d,%d not found in this school!\n", it->attribute, level);
+		log("training step %d,%d not found in this school!\n", it.attribute, level);
 		break;
 	}
 

___
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-1451078-fix into lp:widelands

2015-05-03 Thread Teppo Mäenpää
I did not remove the check.

Previously, if the soldier was at a too high level, it was assumed that he/she 
should be let go. In the linked bug, the problem was that soldier was full 
trained in defense and health but not evade.

After this change, the code merely proceeds to next check, which was the 
original intention. Please note that the routine takes a default-unsafe 
approach, where soldiers are whitelisted if a reason to keep them in is found.

I still think that this fixes the problem. Soldiers will be kicked out after 
this change, too. I tested that much, though of course it is possible that I 
accidentally tested a wrong binary, sans this fix :-(

Regarding the other note.

I do not mind variable names, and gladly change it to something else. Changing 
to range loop was not necessary; the old style just hurt my eyes, and I did not 
see clear reasons why not to do it.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1451078-fix/+merge/258118
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1451078-fix 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/bug-1451078-fix into lp:widelands

2015-05-03 Thread Teppo Mäenpää
I am not sure if I was speaking clearly.

here, both break (old way) and continue (new way) skip the rest of the test. As 
a result of this, the soldier is not declared trainable in either case. 
However, the old way caused the code to skip subsequent arts, which was bad if 
those trainings were not complete yet.

Old way: Health training complete, evade training not complete: soldier is not 
declared trainable and might be kicked out, if the status of evade is 
considered after health.

New way: Soldier stays in.

Anyway, thanks for the quick comments.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1451078-fix/+merge/258118
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1451078-fix 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/bug-1451078-fix into lp:widelands

2015-05-03 Thread Teppo Mäenpää
I am really sorry, but do not see the benefit of adding more booleans. In my 
opinion the bug is now fixed, unless you or somebody else explain the remaining 
problems in so simple words that even I understand. Hopefully all the extra 
typing won't give you joint pains.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1451078-fix/+merge/258118
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1451078-fix 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/bug-1442869 into lp:widelands

2015-05-06 Thread Teppo Mäenpää
I did not trace long enough to ensure that "state.ip" remains zero when 
program_act calls program_end, but my feeling is that the code would work that 
way.

If if does, then this looks just right to me.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1442869/+merge/258203
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1442869 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/bug-1442869 into lp:widelands

2015-05-06 Thread Teppo Mäenpää
The proposal to merge lp:~widelands-dev/widelands/bug-1442869 into lp:widelands 
has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1442869/+merge/258203
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1442869 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, &imm))
+		{
+			return &ms->owner() != &player;
+		}
+	return false;
+}
 
 bool FindImmovableByDescr::accept(const BaseImmovable& baseimm) const {
 	if (upcast(const Immovable, imm, &baseimm)) {

=== 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 sco

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 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


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1574379-forester-wit into lp:widelands

2018-01-13 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/bug-1574379-forester-wit into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1574379 in widelands: "Forester plants trees where probability to grow 
is nearly zero"
  https://bugs.launchpad.net/widelands/+bug/1574379

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068

Previously, forester picked a random free spot at his work area, and attempted 
to plant a tree there.

After the change, the forester picks n free slots (the number n can be selected 
separately for each tribe), and plants a tree to the spot which is best suited 
for the three that grows best at that spot.

In short: foresters favor areas which are suitable for forestation.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1574379-forester-wit into lp:widelands.
=== modified file 'data/tribes/workers/atlanteans/forester/init.lua'
--- data/tribes/workers/atlanteans/forester/init.lua	2017-02-12 09:10:57 +
+++ data/tribes/workers/atlanteans/forester/init.lua	2018-01-13 09:57:39 +
@@ -41,7 +41,7 @@
 
programs = {
   plant = {
- "findspace size:any radius:5 avoid:field",
+ "findspace size:any radius:5 avoid:field saplingsearches:12",
  "walk coords",
  "animation dig 2000", -- Play a planting animation
  "animation planting 1000", -- Play a planting animation

=== modified file 'data/tribes/workers/barbarians/ranger/init.lua'
--- data/tribes/workers/barbarians/ranger/init.lua	2017-02-12 09:10:57 +
+++ data/tribes/workers/barbarians/ranger/init.lua	2018-01-13 09:57:39 +
@@ -41,7 +41,7 @@
 
programs = {
   plant = {
- "findspace size:any radius:5 avoid:field",
+ "findspace size:any radius:5 avoid:field saplingsearches:5",
  "walk coords",
  "animation dig 2000",
  "animation planting 1000",

=== modified file 'data/tribes/workers/empire/forester/init.lua'
--- data/tribes/workers/empire/forester/init.lua	2017-02-12 09:10:57 +
+++ data/tribes/workers/empire/forester/init.lua	2018-01-13 09:57:39 +
@@ -41,7 +41,7 @@
 
programs = {
   plant = {
- "findspace size:any radius:5 avoid:field",
+ "findspace size:any radius:5 avoid:field saplingsearches:8",
  "walk coords",
  "animation dig 2000",
  "animation planting 1000",

=== modified file 'src/logic/game.h'
--- src/logic/game.h	2017-12-19 07:12:18 +
+++ src/logic/game.h	2018-01-13 09:57:39 +
@@ -251,6 +251,10 @@
 	void accept_trade(int trade_id);
 	void cancel_trade(int trade_id);
 
+	// TODO(kxq): The lifetime of game-instance is okay for this, but is this the right spot?
+	// TODO(kxq): I should find the place where LUA changes map, and clear this whenever that happens.
+	std::vector forester_cache_;
+
 private:
 	void sync_reset();
 

=== 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	2018-01-13 09:57:39 +
@@ -419,6 +419,82 @@
 }
 
 /**
+ * findspace_helper_for_forester
+ *
+ * Making the run_findspace routine shorter, by putting one special case into its own function.
+ * This gets called many times each time the forester searches for a place for a sapling.
+ * Since this already contains three nested for-loops, I dedided to cache the values for a
+ * cpu/memory tradeoff (hint: Widelands is pretty heavy on my oldish PC).
+ * Since the implementation details of double could vary between platforms, I decided to
+ * quantize the terrain goodness into int16_t. This lowers the footprint of the caching,
+ * and also makes desyncs caused by different floats horribly unlikely.
+ *
+ * At the moment of writing, map changing is really infrequent (only in two scenarios)
+ * and even those do not affect this. However, since map changes are possible, this
+ * checks the reliability of the cached value with a small probability (~1%), If a
+ * disparency is found, the entire cache is nuked.
+ *
+ * If somebody in the future makes a scenario, where the land first is barren, and then
+ * spots of eden show up, the foresters will not immediately notice (because of the cache).
+ * They will eventually notice, and since the instance is shared between tribes,
+ * all foresters notice this at the same moment. I hope this is okay.
+ *
+ */
+
+int16_t Worker::findspace_helper_for_forester(const Coords& pos, const Map& map, Game& game) {
+
+	const MapIndex mi = map.get_index(pos, map.get_width());
+	const FCoords fpos = map.get_fcoords(pos);
+	const unsigned vecsize

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1574379-forester-wit into lp:widelands

2018-01-13 Thread Teppo Mäenpää
This is quite simple implementation, and seems to work OK in most cases.

There are some things which I am not perfectly happy with:
- There are quite many nested loops. I worked around by a cache, but that 
spawns other issues:
-- If the map is changes during a game, via LUA scripting, the forester might 
not immediately realize this. It would be more civilized if the cache would be 
invalidated in those cases. This quirk does not harm anything now.
-- The cache is physically located in game.h. This is probably not the best 
place. What is?

If the cache was done right, it could also be benefitted while working on the 
forestability tooltip into editor. Not really in scope, but still.



Remark, should be actually added to comments. The forester considers six best 
suited trees while planting, but only the best suited three while searching for 
spots. This is approximately okay, but could in some situations cause the 
forester/ranger to prefer next-best locations.

Example.

There is terrain where the growth probabilities for the six best trees are:
a => 0.9, 1e-5, 1e-5, 1e-5, 1e-5, 1e-5
b => 1.0, 0.5,  0.5,  0.5,  0.5,  0.5

The goodness of spot a is 0.9 during search, and goodness of spot b is 1.0. 
Therefore the forester/ranger select option b.

While planting, in spot b there are non-negligible changes that the forester 
picks one of the fifty-percent trees (56% of the time). Average tree growth 
thus happens ~72% of the time.

If the forester would have picked slot a, he would practically always have 
chosen the best-suited tree, with ~90% growth success rate.

This is of course an exaggerated example, and IMO should be left like this. 
Feel free to disagree.

=

Now, the Atlantean forester considers most spots, Barbarian ranger least. This 
was requested in the comments of one of the duplicate bugs. The new constants 
(number of slots to consider per plantation) are not well thought-of. If you 
playtest, give feedback.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1574379-forester-wit 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/bug-1574379-forester-wit into lp:widelands

2018-01-13 Thread Teppo Mäenpää
Hello, 

Thanks for the comments.

The key name "saplingsearches" is silly, and should be replaced by ... hmm, 
what? Any English-speaking people here?

The larger the saplingsearches-number is, the smaller the odds that the 
forester plants the tree to marginal land. This becomes important when the area 
where trees grow well is very small. If there is a borderline of two poor 
terrains, and the terrain property merging algorithm happens to make the 
borderline itself okay for something, you want many dozens of attempts to pick 
that line.

Should we go there? If a significant fraction of all available spots will often 
be inspected by the forester, then we could consider removing the 
already-instanced slots from the "list" of run_findspace in worker.cc. I do not 
think we want the forester to work this way.



I agree, that making the saplingsearches-numbers unequal can change balance 
somewhere. We do not have to use that possibility, or use only modest 
differences.

I am not sure if I understood your comment right. The cache must not survive 
from one game to other. Else there is a (small but still) possibility that the 
one player's cached values are from a different but same size map, and 
multiplayer game desyncs before it is catched. Therefore "game" seems like 
logical place, and it cannot be a static class member. If I make it extern and 
instantiate in dot-cc, effectively same problem appears. Where did I get it 
wrong?
Also, I did not understand the "should be const" remark. Values are added to 
the vector, so the vector itself is not constant. Integers are constant by 
definition, the value of one remains one.

Apart from that, I liked what you wrote.



If you feel like trying this out: Thanks for the feedback! No particular reason 
to hurry -- we are not close to any deadlines AFAIK.

-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1574379-forester-wit 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/bug-1574379-forester-wit into lp:widelands

2018-01-13 Thread Teppo Mäenpää
Klaus: I did not quite get the first sentence either: If you build on fertile 
land, there will be less fertile land for the forest. This has not changed. The 
fertile land is now used more effectively than previously, but that was the 
whole point of this ticket, I guess?

No messages were requested in the bug description.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1574379-forester-wit 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/bug-1574379-forester-wit into lp:widelands

2018-01-14 Thread Teppo Mäenpää
Hello, Klaus,

Since you asked: Does the line like "return forester_cache[mi] = correct_val;" 
bring any performance benefits? I know it is valid and all, but the old way 
(separate assignment and returning) is more intuitive. Not everybody reading 
the source are professionals, especially C/C++ professionals. Apart from that, 
the changes improve. I have a bad habit of dropping magic numbers in.

About magical constants: The comparison (cache_entry > kInvalidForesterEntry) 
looks weird. It makes sense when one knows that the numeric value of the 
constant is -1. Would inequality comparison look better? No other negative 
values should be around.

Thanks for the review.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-19 Thread Teppo Mäenpää
I currently mostly write code using language, where single equal sign is a 
comparison instead of assignment. A side-effect is that "return a = b" looks 
very boolean to my eyes..

About the cache_entry > kInvalidForesterEntry: You are right, this is more 
robust, even if it looks weird. I'll add a comment there.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-20 Thread Teppo Mäenpää
Tried to get the assert for ~2 hours, without success.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
Played more. No problems. IMO, merge-quality again.

Side note: WuiPlotArea::register_plot_data leaks memory according to valgrind, 
is this known?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
I have been pretty unlucky with Travis and appveyor. A new commit just to merge 
trunk sounds scary already.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
Side note: Yes, it is gone.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
The proposal to merge lp:~widelands-dev/widelands/bug-1574379-forester-wit into 
lp:widelands has been updated.

Commit Message changed to:

Forester prefers good soil for planting. Fixes bug #1574379.

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
The proposal to merge lp:~widelands-dev/widelands/bug-1574379-forester-wit into 
lp:widelands has been updated.

Commit Message changed to:

Forester prefers good soil for planting. Fixes but #1574379.

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
The proposal to merge lp:~widelands-dev/widelands/bug-1574379-forester-wit into 
lp:widelands has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
The proposal to merge lp:~widelands-dev/widelands/bug-1574379-forester-wit into 
lp:widelands has been updated.

Commit Message changed to:



For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
The proposal to merge lp:~widelands-dev/widelands/bug-1574379-forester-wit into 
lp:widelands has been updated.

Status: Approved => Needs review

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-21 Thread Teppo Mäenpää
Got the random error, again. I guess bunnybot will not merge now.

If we cannot alter the way the infra works, would it be possible to work around?

What do the scripts look like ? If the errors are truly random, one could try
command || (sleep 10 && command) || $(sleep 10 && command)

or, in this case, 
git clone $ADDR || (rm -Rf $repodir || true ; sleep 10 && git clone $ADDR )) 


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-24 Thread Teppo Mäenpää
intended to say "comment" in the above.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-27 Thread Teppo Mäenpää
I understood the Jan14th comments so that it is okay to merge this.

@bunnybot merge

Curious to see what happens.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-27 Thread Teppo Mäenpää
The proposal to merge lp:~widelands-dev/widelands/bug-1574379-forester-wit into 
lp:widelands has been updated.

Commit Message changed to:

Bug 1574379: Forester prefers good soil.

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-27 Thread Teppo Mäenpää
The proposal to merge lp:~widelands-dev/widelands/bug-1574379-forester-wit into 
lp:widelands has been updated.

Commit Message changed to:

Bug 1574379: Forester prefers good soil, and is thus more efficient.

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-27 Thread Teppo Mäenpää
Forgot the commit message. I guess bunnybot is not offended by repeated 
requests.

@bunnybot merge

-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1574379-forester-wit into lp:widelands

2018-01-27 Thread Teppo Mäenpää
I will take note for future. Thanks.

I cannot resist asking: The Google C++ style guide disallows boost, with 
exceptions; lexical_cast is not mentioned in the list of allowed uses. How 
strictly should one follow the style guide?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1574379-forester-wit/+merge/336068
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1574379-forester-wit.

___
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-1746030-scout-assert-failures into lp:widelands

2018-01-29 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/bug-1746030-scout-assert-failures into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1746030 in widelands: "Recent scout improvement has assert failures"
  https://bugs.launchpad.net/widelands/+bug/1746030

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1746030-scout-assert-failures/+merge/336787

Moved an assert statement to its correct location.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1746030-scout-assert-failures into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc	2018-01-27 16:08:55 +
+++ src/logic/map_objects/tribes/worker.cc	2018-01-29 16:31:36 +
@@ -2809,6 +2809,7 @@
 	// Check whether there is still undone work in the queue,
 	// keeping in mind that 1st element of the vector is special
 	if (2 > scouts_worklist.size()) {
+		assert(1 == scouts_worklist.size());
 		// If there was only one entry, worklist has been exhausted. Rebuild it.
 		// Time to find new places worth visiting.
 		Area revealations(map.get_fcoords(get_position()), state.ivar1);
@@ -2822,8 +2823,6 @@
 		// Always push a "go-anywhere" -directive into work list.
 		const PlaceToScout gosomewhere;
 		scouts_worklist.push_back(gosomewhere);
-	} else {
-		assert(1 == scouts_worklist.size());
 	}
 
 	// first get out

___
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-1746030-scout-assert-failures into lp:widelands

2018-01-29 Thread Teppo Mäenpää
Low hanging fruit: It should not take long to conclude that this is an 
improvement ;-)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1746030-scout-assert-failures/+merge/336787
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1746030-scout-assert-failures 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/bug-1746030-scout-assert-failures into lp:widelands

2018-01-29 Thread Teppo Mäenpää
Maybe, this time, we can trust that the if-statement in the preceding line is 
free of any bugs and those two thus have a similar truth table.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1746030-scout-assert-failures/+merge/336787
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1746030-scout-assert-failures 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/bug-1746030-scout-assert-failures into lp:widelands

2018-01-29 Thread Teppo Mäenpää
Many hours of playtesting (self and network), and then trouble with travis and 
all and finally SirVer had to do a manual merge (crisscross).

Guess how stupid it feels when after all this, all related testgames fail 
immediately..
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1746030-scout-assert-failures/+merge/336787
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1746030-scout-assert-failures 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/bug-1746030-scout-assert-failures into lp:widelands

2018-01-29 Thread Teppo Mäenpää
The appveyor build failed after 31 seconds from start, supposing that that was 
unrelated to this.

@bunnybot merge force
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1746030-scout-assert-failures/+merge/336787
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1746030-scout-assert-failures.

___
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-1669230-lastbastion-finetune into lp:widelands

2018-02-02 Thread Teppo Mäenpää
I tried to keep the changes small. However, if this is ever merged, and people 
play network with pre-merge and post-merge versions, there are desyncs. That 
could be avoided by renaming the map (like v2 -> v3). I do not think a rename 
is needed. Using different bzr versions can act like this.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1669230-lastbastion-finetune/+merge/337083
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune 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/bug-1669230-lastbastion-finetune into lp:widelands

2018-02-02 Thread Teppo Mäenpää
The proposal to merge 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune into lp:widelands 
has been updated.

Description changed to:

Last bastion map modified:

The red player now has a way to expand around a tower at 10/57. It is not very 
convenient, but at least the blue can no longer (easily) block the red for good.

Also moved the yellow slot at 26/0 south. Now the players should no longer be 
able to block each other.

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1669230-lastbastion-finetune/+merge/337083
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune 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/bug-1669230-lastbastion-finetune into lp:widelands

2018-02-02 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1669230 in widelands: "Map Last Bastion: enemy fortifications on the 
other side of water make game impassible in some situations"
  https://bugs.launchpad.net/widelands/+bug/1669230

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1669230-lastbastion-finetune/+merge/337083

The red player now has a way to expand around a tower at 10/57. It is not very 
convenient, but at least the blue can no longer (easily) block the red for good.

Also moved the yellow slot at 26/0 south. Now the players should no longer be 
able to block each other.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune into lp:widelands.
=== modified file 'data/maps/Last_Bastion_v2.wmf/binary/heights'
Binary files data/maps/Last_Bastion_v2.wmf/binary/heights	2016-03-21 19:29:24 + and data/maps/Last_Bastion_v2.wmf/binary/heights	2018-02-02 15:36:09 + differ
=== modified file 'data/maps/Last_Bastion_v2.wmf/binary/terrain'
Binary files data/maps/Last_Bastion_v2.wmf/binary/terrain	2016-03-21 19:29:24 + and data/maps/Last_Bastion_v2.wmf/binary/terrain	2018-02-02 15:36:09 + differ
___
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-1669230-lastbastion-finetune into lp:widelands

2018-02-14 Thread Teppo Mäenpää
@GunChleoc: Thanks for spotting, is this okay now?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1669230-lastbastion-finetune/+merge/337083
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune 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/bug-1669230-lastbastion-finetune into lp:widelands

2018-02-17 Thread Teppo Mäenpää
The proposal to merge 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune into lp:widelands 
has been updated.

Commit Message changed to:

Minor fixes to Last Bastion map. See LP bug 1669230 for details.

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1669230-lastbastion-finetune/+merge/337083
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune.

___
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-1669230-lastbastion-finetune into lp:widelands

2018-02-17 Thread Teppo Mäenpää
When may I conclude that bunnybot has, once again, decided not to merge. What 
is the problem this time?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1669230-lastbastion-finetune/+merge/337083
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune.

___
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-1669230-lastbastion-finetune into lp:widelands

2018-02-17 Thread Teppo Mäenpää
Oh, I forgot that you did a merge. We might be waiting for travis and appveyor.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1669230-lastbastion-finetune/+merge/337083
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune.

___
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-1753248-crystalmine-tuning into lp:widelands

2018-03-09 Thread Teppo Mäenpää
Teppo Mäenpää has proposed merging 
lp:~widelands-dev/widelands/bug-1753248-crystalmine-tuning into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1753248 in widelands: "Rework Atlantean Crystal Mine"
  https://bugs.launchpad.net/widelands/+bug/1753248

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1753248-crystalmine-tuning/+merge/341274

Depleted atlantean crystal (and iron) mines work slightly better when depleted.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1753248-crystalmine-tuning into lp:widelands.
=== modified file 'data/tribes/buildings/productionsites/atlanteans/crystalmine/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/crystalmine/init.lua	2017-06-26 19:48:43 +
+++ data/tribes/buildings/productionsites/atlanteans/crystalmine/init.lua	2018-03-10 06:40:35 +
@@ -70,7 +70,7 @@
  -- TRANSLATORS: Completed/Skipped/Did not start mining granite because ...
  descname = _"mining granite",
  actions = {
-"return=skipped unless economy needs granite or economy needs quartz",
+"return=skipped unless economy needs granite",
 "sleep=45000",
 "consume=smoked_fish,smoked_meat:2 atlanteans_bread:2",
 "animate=working 2",
@@ -91,17 +91,17 @@
  -- TRANSLATORS: Completed/Skipped/Did not start mining quartz because ...
  descname = _"mining quartz",
  actions = {
-"return=skipped unless economy needs granite or economy needs quartz",
+"return=skipped unless economy needs quartz",
 "sleep=45000",
 "consume=smoked_fish,smoked_meat:2 atlanteans_bread:2",
 "animate=working 2",
 "mine=stones 4 100 5 2",
-"produce=granite:2",
-"animate=working 2",
-"mine=stones 4 100 5 2",
 "produce=granite quartz",
 "animate=working 2",
 "mine=stones 4 100 5 2",
+"produce=granite:2",
+"animate=working 2",
+"mine=stones 4 100 5 2",
 "produce=quartz:2"
  }
   },
@@ -109,7 +109,7 @@
  -- TRANSLATORS: Completed/Skipped/Did not start mining diamonds because ...
  descname = _"mining diamonds",
  actions = {
-"return=skipped unless economy needs granite or economy needs diamond",
+"return=skipped unless economy needs diamond",
 "sleep=45000",
 "consume=smoked_fish,smoked_meat:2 atlanteans_bread:2",
 "animate=working 2",

=== modified file 'data/tribes/buildings/productionsites/atlanteans/ironmine/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/ironmine/init.lua	2017-09-03 07:59:51 +
+++ data/tribes/buildings/productionsites/atlanteans/ironmine/init.lua	2018-03-10 06:40:35 +
@@ -62,12 +62,12 @@
 "consume=smoked_fish,smoked_meat:2 atlanteans_bread:2",
 "animate=working 2",
 "mine=iron 4 100 5 2",
+"produce=iron_ore:2",
+"animate=working 2",
+"mine=iron 4 100 5 2",
 "produce=iron_ore",
 "animate=working 2",
 "mine=iron 4 100 5 2",
-"produce=iron_ore:2",
-"animate=working 2",
-"mine=iron 4 100 5 2",
 "produce=iron_ore:2"
  }
   },

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

2018-08-03 Thread Teppo Mäenpää
I get a compiler error on 8780:

../src/logic/map_objects/tribes/ferry.cc: In member function ‘void 
Widelands::Ferry::start_task_row(Widelands::Game&, Widelands::Waterway*)’:
../src/logic/map_objects/tribes/ferry.cc:106:17: error: invalid conversion from 
‘const value_type*’ {aka ‘const Widelands::Coords*’} to ‘Widelands::Coords*’ 
[-fpermissive]
  destination_ = &(CoordPath(game.map(), 
ww->get_path()).get_coords()[ww->get_idle_index()]);

-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/ferry 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/ferry into lp:widelands

2018-08-03 Thread Teppo Mäenpää
Now I got it, thanks.
-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/ferry 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