diff options
author | Neil Moore <neil@s-z.org> | 2014-07-20 12:10:54 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-07-20 12:13:36 -0400 |
commit | 89be177bdf5805caf3c19f50982fb5a617e503b6 (patch) | |
tree | b050a8659aae8a1c7ee0576913df641b4dde77ab | |
parent | ae745b9303250a90be1201887979ac909d2514f5 (diff) | |
download | crawl-ref-89be177bdf5805caf3c19f50982fb5a617e503b6.tar.gz crawl-ref-89be177bdf5805caf3c19f50982fb5a617e503b6.zip |
Don't bias northwest in _dgn_find_nearest_square.
-rw-r--r-- | crawl-ref/source/terrain.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index a0fac67dc1..6a965c1965 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -656,13 +656,15 @@ static coord_def _dgn_find_nearest_square( { memset(travel_point_distance, 0, sizeof(travel_distance_grid_t)); - list<coord_def> points[2]; + vector<coord_def> points[2]; int iter = 0; points[iter].push_back(pos); while (!points[iter].empty()) { - for (list<coord_def>::iterator i = points[iter].begin(); + // Iterate each layer of BFS in random order to avoid bias. + shuffle_array(points[iter]); + for (vector<coord_def>::iterator i = points[iter].begin(); i != points[iter].end(); ++i) { const coord_def &p = *i; |