← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug1504948 into lp:widelands

 

Jens Beyer has proposed merging lp:~widelands-dev/widelands/bug1504948 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1504948 in widelands: "Performance issue when "no use for ships on this map""
  https://bugs.launchpad.net/widelands/+bug/1504948

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

Fix the performance issue.

What I found while doing a Valgrind session was that the Map::allows_seafaring and the CheckMap program part was running much too often (about ten times a second or so).

I believe the reason is that the program is not ended with a Fail, thus somehow being started immediately again. Now that it fails on ending, it correctly ends the subprogram and is not called so often and the whole production site program is now correctly using the sleep.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug1504948 into lp:widelands.
=== modified file 'src/logic/production_program.cc'
--- src/logic/production_program.cc	2015-10-02 07:02:00 +0000
+++ src/logic/production_program.cc	2015-10-11 14:43:19 +0000
@@ -815,7 +815,7 @@
 				return ps.program_step(game, 0);
 			else {
 				ps.set_production_result("No use for ships on this map!");
-				return ps.program_end(game, None);
+				return ps.program_end(game, Failed);
 			}
 		}
 		default:


Follow ups