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

Proposed by Mark Scott
Status: Merged
Merged at revision: 6490
Proposed branch: lp:~mxsscott/widelands/1023264
Merge into: lp:widelands
Diff against target: 19 lines (+2/-2)
1 file modified
src/logic/worker.cc (+2/-2)
To merge this branch: bzr merge lp:~mxsscott/widelands/1023264
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+144006@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

Nice catch! I went ahead and merged this as I had it already merged locally to understand the change you did.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/worker.cc'
2--- src/logic/worker.cc 2012-12-16 19:08:53 +0000
3+++ src/logic/worker.cc 2013-01-20 00:10:29 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
7+ * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11@@ -2814,7 +2814,7 @@
12 // Parse randomly the reachable fields, maximum 50 iterations
13 uint8_t iterations = list.size() % 51;
14 for (uint8_t i = 0; i < iterations; ++i) {
15- uint8_t const lidx = game.logic_rand() % list.size();
16+ const std::vector<Coords>::size_type lidx = game.logic_rand() % list.size();
17 Coords const coord = list[lidx];
18 list.erase(list.begin() + lidx);
19 Map_Index idx = map.get_index(coord, map.get_width());

Subscribers

People subscribed via source and target branches

to status/vote changes: