← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~mxsscott/widelands/1023264 into lp:widelands

 

Mark Scott has proposed merging lp:~mxsscott/widelands/1023264 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1023264 in widelands: "Scouts explore consistently to the west"
  https://bugs.launchpad.net/widelands/+bug/1023264

For more details, see:
https://code.launchpad.net/~mxsscott/widelands/1023264/+merge/144006

The list of fields to which scouts could explore was found to be (much) larger than 255 possibilities. The use of uint8_t as an index into this list meant that only SW-NW targets were typically considered.

Replaced uint8_t with std::vector<Coords>::size_type and scouts now happily go East and other directions.
-- 
https://code.launchpad.net/~mxsscott/widelands/1023264/+merge/144006
Your team Widelands Developers is requested to review the proposed merge of lp:~mxsscott/widelands/1023264 into lp:widelands.
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc	2012-12-16 19:08:53 +0000
+++ src/logic/worker.cc	2013-01-20 00:10:29 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -2814,7 +2814,7 @@
 			// Parse randomly the reachable fields, maximum 50 iterations
 			uint8_t iterations = list.size() % 51;
 			for (uint8_t i = 0; i < iterations; ++i) {
-				uint8_t const lidx = game.logic_rand() % list.size();
+				const std::vector<Coords>::size_type lidx = game.logic_rand() % list.size();
 				Coords const coord = list[lidx];
 				list.erase(list.begin() + lidx);
 				Map_Index idx = map.get_index(coord, map.get_width());