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

2018-09-06 Thread hessenfarmer
The Solution with .get was used in their examples. But I have created an issue 
about that in their github repo 
-- 
https://code.launchpad.net/~widelands-dev/widelands/appveyor_fix/+merge/354160
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/appveyor_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


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

2018-09-06 Thread GunChleoc
GunChleoc has proposed merging lp:~widelands-dev/widelands/windows-logging into 
lp:widelands.

Commit message:
Write Windows log output to homedir instead of the program dir.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1398536 in widelands: "Logging on windows"
  https://bugs.launchpad.net/widelands/+bug/1398536
  Bug #1630110 in widelands: "Widelands crashes on startup when installed into 
C:\Programs"
  https://bugs.launchpad.net/widelands/+bug/1630110

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/windows-logging/+merge/354397
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/windows-logging into lp:widelands.
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt	2018-07-08 10:05:27 +
+++ src/CMakeLists.txt	2018-09-06 14:23:15 +
@@ -45,7 +45,6 @@
   ${WIN32_ICON_O}
 USES_SDL2
 DEPENDS
-  base_log
   base_exceptions
   widelands_ball_of_mud
   build_info
@@ -56,7 +55,6 @@
   main.cc
 USES_SDL2
 DEPENDS
-  base_log
   base_exceptions
   widelands_ball_of_mud
   build_info

=== modified file 'src/base/CMakeLists.txt'
--- src/base/CMakeLists.txt	2017-03-04 12:37:17 +
+++ src/base/CMakeLists.txt	2018-09-06 14:23:15 +
@@ -12,6 +12,7 @@
   DEPENDS
 base_macros
 base_exceptions
+build_info
 )
 
 wl_library(base_exceptions

=== modified file 'src/base/log.cc'
--- src/base/log.cc	2018-04-07 16:59:00 +
+++ src/base/log.cc	2018-09-06 14:23:15 +
@@ -19,10 +19,12 @@
 
 #include "base/log.h"
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #ifdef _WIN32
@@ -31,6 +33,9 @@
 
 #include "base/macros.h"
 #include "base/wexception.h"
+#ifdef _WIN32
+#include "build_info.h"
+#endif
 
 namespace {
 
@@ -38,7 +43,6 @@
 void sdl_logging_func(void* userdata, int, SDL_LogPriority, const char* message);
 
 #ifdef _WIN32
-
 std::string get_output_directory() {
 // This took inspiration from SDL 1.2 logger code.
 #ifdef _WIN32_WCE
@@ -57,12 +61,17 @@
 // This Logger emulates the SDL1.2 behavior of writing a stdout.txt.
 class WindowsLogger {
 public:
-	WindowsLogger() : stdout_filename_(get_output_directory() + "\\stdout.txt") {
+	WindowsLogger(const std::string& dir) : stdout_filename_(dir + "\\stdout.txt") {
 		stdout_.open(stdout_filename_);
 		if (!stdout_.good()) {
-			throw wexception("Unable to initialize logging to stdout.txt");
+			throw wexception("Unable to initialize stdout logging destination: %s", stdout_filename_.c_str());
 		}
 		SDL_LogSetOutputFunction(sdl_logging_func, this);
+		std::cout << "Log output will be written to: " << stdout_filename_ << std::endl;
+
+		// Repeat version info so that we'll have it available in the log file too
+		stdout_ << "This is Widelands Version " << build_id() << " (" << build_type() << ")" << std::endl;
+		stdout_.flush();
 	}
 
 	void log_cstring(const char* buffer) {
@@ -107,23 +116,42 @@
 	static_cast(userdata)->log_cstring(message);
 }
 #endif
-
 }  // namespace
 
 // Default to stdout for logging.
 bool g_verbose = false;
 
+#ifdef _WIN32
+// Start with nullptr so that we won't initialize an empty file in the logging directory
+std::unique_ptr logger(nullptr);
+
+// Set the logging dir to the given homedir
+bool set_logging_dir(const std::string& homedir) {
+	try {
+		logger.reset(new WindowsLogger(homedir));
+	} catch (const std::exception& e) {
+		std::cout << e.what() << std::endl;
+		return false;
+	}
+	return true;
+}
+
+// Set the logging dir to the program's dir. For running test cases where we don't have a homedir.
+void set_logging_dir() {
+	logger.reset(new WindowsLogger(get_output_directory()));
+}
+
+#else
+std::unique_ptr logger(new Logger());
+#endif
+
 void log(const char* const fmt, ...) {
-#ifdef _WIN32
-	static WindowsLogger logger;
-#else
-	static Logger logger;
-#endif
+	assert(logger != nullptr);
+
 	char buffer[2048];
 	va_list va;
-
 	va_start(va, fmt);
 	vsnprintf(buffer, sizeof(buffer), fmt, va);
 	va_end(va);
-	logger.log_cstring(buffer);
+	logger->log_cstring(buffer);
 }

=== modified file 'src/base/log.h'
--- src/base/log.h	2018-04-07 16:59:00 +
+++ src/base/log.h	2018-09-06 14:23:15 +
@@ -28,4 +28,13 @@
 
 extern bool g_verbose;
 
+#ifdef _WIN32
+/** Set the directory that stdout.txt shall be written to.
+ *  This should be the same dir where widelands writes its config file. Returns true on success.
+ */
+bool set_logging_dir(const std::string& homedir);
+// Set the directory that stdout.txt shall be written to to the directory the program is started from. Use this only for test cases.
+void set_logging_dir();
+#endif
+
 #endif  // end of include guard: WL_BASE_LOG_H

=== modified file 'src/economy/test/CMakeLists.txt'
--- src/economy/test/CMakeLists.txt	2017-06-20 12:38:50 +
+++ src/economy/test/CMakeLists.txt	2018-09-06 14:23:15 +
@@ -4,6 +4,7 @@
 test_road.cc
 

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1786613-10s-return-skipped into lp:widelands

2018-09-06 Thread Toni Förster
Doesn't depend on lp:~widelands-dev/widelands/mines-worldsavior anymore, but 
couldn't remove it as a prerequisite.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1786613-10s-return-skipped/+merge/353514
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/mines-worldsavior.

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

2018-09-06 Thread Toni Förster
branched it of from the "new" bug-1786613-10s-return-skipped branch.
-- 
https://code.launchpad.net/~widelands-dev/widelands/shipyard_statistics/+merge/354208
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1786613-10s-return-skipped.

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

2018-09-06 Thread hessenfarmer
The changes creating the problem are the heart of this change, cause they fix a 
lot of weird behaviour in the mines as well as adjusting timings for better 
balance.

Therefore I would vote for having the branch as it is and just adding a note to 
the encyclopedia window and to the release notes that the values for all mined 
products aren't correct. Perhaps we can make the homepage show the correct 
values otherwise we need to find another way to inform the players about this.

For me it seems better to have consistent mines with a lot less issues and have 
an issue with the encyclopedia instead.
-- 
https://code.launchpad.net/~widelands-dev/widelands/mines-worldsavior/+merge/350716
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/mines-worldsavior.

___
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-1786613-10s-return-skipped into lp:widelands

2018-09-06 Thread Toni Förster
I removed the mines_worldsavior-branch and brought it on par with latest trunk.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1786613-10s-return-skipped/+merge/353514
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/mines-worldsavior.

___
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-1786613-10s-return-skipped into lp:widelands

2018-09-06 Thread Toni Förster
Toni Förster has proposed merging 
lp:~widelands-dev/widelands/bug-1786613-10s-return-skipped into lp:widelands.

Commit message:
introduced the return value no_stats for work programs.

Requested reviews:
  hessenfarmer (stephan-lutz)
Related bugs:
  Bug #1786613 in widelands: "production times are 10s longer when 
return=skipped"
  https://bugs.launchpad.net/widelands/+bug/1786613

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1786613-10s-return-skipped/+merge/354381

When the program returns=no_stats it enters the None case. No stats are 
calculated but in case it has been return=skipped before it gets removed from 
the skipped_programs-stack.
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1786613-10s-return-skipped.
=== modified file 'data/campaigns/emp04.wmf/scripting/tribes/farm1.lua'
--- data/campaigns/emp04.wmf/scripting/tribes/farm1.lua	2018-07-31 06:17:07 +
+++ data/campaigns/emp04.wmf/scripting/tribes/farm1.lua	2018-09-06 08:41:46 +
@@ -41,7 +41,7 @@
  actions = {
 "call=plant",
 "call=harvest",
-"return=skipped"
+"return=no_stats"
  }
   },
   plant = {

=== modified file 'data/tribes/buildings/productionsites/atlanteans/armorsmithy/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/armorsmithy/init.lua	2017-09-03 07:59:51 +
+++ data/tribes/buildings/productionsites/atlanteans/armorsmithy/init.lua	2018-09-06 08:41:46 +
@@ -144,7 +144,7 @@
  actions = {
 "call=produce_shield_steel",
 "call=produce_shield_advanced",
-"return=skipped"
+"return=no_stats"
  }
   },
   produce_shield_steel = {

=== modified file 'data/tribes/buildings/productionsites/atlanteans/blackroot_farm/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/blackroot_farm/init.lua	2017-11-18 21:23:09 +
+++ data/tribes/buildings/productionsites/atlanteans/blackroot_farm/init.lua	2018-09-06 08:41:46 +
@@ -49,7 +49,7 @@
  actions = {
 "call=plant",
 "call=harvest",
-"return=skipped"
+"return=no_stats"
  }
   },
   plant = {

=== modified file 'data/tribes/buildings/productionsites/atlanteans/crystalmine/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/crystalmine/init.lua	2018-03-04 14:11:19 +
+++ data/tribes/buildings/productionsites/atlanteans/crystalmine/init.lua	2018-09-06 08:41:46 +
@@ -63,7 +63,7 @@
 "call=mine_granite",
 "call=mine_quartz",
 "call=mine_diamond",
-"return=skipped"
+"return=no_stats"
  }
   },
   mine_granite = {

=== modified file 'data/tribes/buildings/productionsites/atlanteans/farm/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/farm/init.lua	2017-11-18 21:23:09 +
+++ data/tribes/buildings/productionsites/atlanteans/farm/init.lua	2018-09-06 08:41:46 +
@@ -53,7 +53,7 @@
  actions = {
 "call=plant",
 "call=harvest",
-"return=skipped"
+"return=no_stats"
  }
   },
   plant = {

=== modified file 'data/tribes/buildings/productionsites/atlanteans/mill/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/mill/init.lua	2017-11-18 17:57:00 +
+++ data/tribes/buildings/productionsites/atlanteans/mill/init.lua	2018-09-06 08:41:46 +
@@ -57,7 +57,7 @@
  actions = {
 "call=produce_cornmeal",
 "call=produce_blackroot_flour",
-"return=skipped"
+"return=no_stats"
  }
   },
   produce_cornmeal = {

=== modified file 'data/tribes/buildings/productionsites/atlanteans/quarry/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/quarry/init.lua	2018-07-08 16:10:50 +
+++ data/tribes/buildings/productionsites/atlanteans/quarry/init.lua	2018-09-06 08:41:46 +
@@ -44,7 +44,7 @@
-- This order is on purpose so that the productivity
-- drops fast once all rocks are gone.
 "call=mine_stone",
-"return=skipped"
+"return=no_stats"
  },
   },
   mine_stone = {

=== modified file 'data/tribes/buildings/productionsites/atlanteans/shipyard/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/shipyard/init.lua	2017-11-18 21:23:09 +
+++ data/tribes/buildings/productionsites/atlanteans/shipyard/init.lua	2018-09-06 08:41:46 +
@@ -65,7 +65,7 @@
  actions = {
 "sleep=2",
 "call=ship",
-"return=skipped"
+"return=no_stats"
  }
   },
   ship = {

=== modified file 'data/tribes/buildings/productionsites/atlanteans/smelting_works/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/smelting_works/init.lua	2017-11-18 17:57:00 +
+++ 

[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1786613-10s-return-skipped into lp:widelands

2018-09-06 Thread Toni Förster
The proposal to merge 
lp:~widelands-dev/widelands/bug-1786613-10s-return-skipped into lp:widelands 
has been updated.

Status: Needs review => Superseded

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1786613-10s-return-skipped/+merge/353514
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/mines-worldsavior.

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

2018-09-06 Thread hessenfarmer
they deleted asString unfortunately. 
I found the solution above that throws the warning in some other project on the 
internet. 
I don't know how to test it, nor how to avoid it, cause I dont't understand the 
intention behind these code blocks.
-- 
https://code.launchpad.net/~widelands-dev/widelands/appveyor_fix/+merge/354160
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/appveyor_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/appveyor_fix into lp:widelands

2018-09-06 Thread GunChleoc
We have a new compiler warning on AppVeyor:

../src/graphic/gl/initialize.cc:101:9: warning: format '%s' expects argument of 
type 'char*', but argument 2 has type 
'std::unique_ptr::pointer' {aka 
'glbinding::AbstractValue*'} [-Wformat=]
 log("%s", call.parameters[i].get());
 ^~~~  
../src/graphic/gl/initialize.cc:107:9: warning: format '%s' expects argument of 
type 'char*', but argument 2 has type 
'std::unique_ptr::pointer' {aka 
'glbinding::AbstractValue*'} [-Wformat=]
 log(" -> %s", call.returnValue.get());
 ^~~~  ~~

See if you can get something interesting to log from the objects - do they 
still have ->asString().c_str() available?
-- 
https://code.launchpad.net/~widelands-dev/widelands/appveyor_fix/+merge/354160
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/appveyor_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


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

2018-09-06 Thread GunChleoc
The proposal to merge lp:~widelands-dev/widelands/appveyor_glbinding into 
lp:widelands has been updated.

Status: Needs review => Work in progress

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

2018-09-06 Thread GunChleoc
The proposal to merge 
lp:~widelands-dev/widelands/appveyor_glbinding_with_boost_downgrade into 
lp:widelands has been updated.

Status: Needs review => Work in progress

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/appveyor_glbinding_with_boost_downgrade/+merge/354171
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/appveyor_glbinding_with_boost_downgrade 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-1786613-10s-return-skipped into lp:widelands

2018-09-06 Thread GunChleoc
The mines_worldsavior branch is blocked. Can you create a fresh branch off 
trunk with the changes that are independent of that branch, so that we can get 
them in for Build 20?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1786613-10s-return-skipped/+merge/353514
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/mines-worldsavior.

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

2018-09-06 Thread GunChleoc
The mines_worldsavior branch is blocked. Can you create a fresh branch off 
trunk, so that we can merge this?
-- 
https://code.launchpad.net/~widelands-dev/widelands/shipyard_statistics/+merge/354208
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1786613-10s-return-skipped.

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

2018-09-06 Thread GunChleoc
Review: Needs Fixing

The wares cannot be fixed without a bug overhaul of the production program 
code, and it's too late in the release cycle to do that now. The only 
alternative would be some really really ugly hacks, which I don't want to do.

The problem is that the consumed wares are not in the same programs as the 
produced wares.

I propose that we split off all the changes that don't create this problem into 
a new branch and merge that one.
-- 
https://code.launchpad.net/~widelands-dev/widelands/mines-worldsavior/+merge/350716
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/mines-worldsavior.

___
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