summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-09-10 09:16:46 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-09-10 13:35:07 +0200
commit30670662abe8d1661a589e493ca44220dc92b4d9 (patch)
tree7ed038b1d931862efd09caf6632751b7e038d8b7 /crawl-ref/source/mapdef.cc
parentcb2faac032b05e6105bba624180e36aa3202a314 (diff)
downloadcrawl-ref-30670662abe8d1661a589e493ca44220dc92b4d9.tar.gz
crawl-ref-30670662abe8d1661a589e493ca44220dc92b4d9.zip
Get rid of random_shuffle().
This should hopefully make games from the same seed proceed the same on all architectures[1], as I can't think of anything else that behaves differently based on pointer size, endianness or exact pointer values. I used a NIH implementation instead of passing a third argument to random_shuffle, as the interface is so much nicer. [1]. This will be affected by terminal size (elemental colours are not resolved outside the screen), tile windows size (random animations), tiles/non-tiles and possibly others. Also, I don't think we use STL hashes anywhere, but if we'd do, the STL implementation will matter. Please don't make this stop you: this commit is only to make test cases from my stress tests portable which is a small benefit, perhaps even smaller than the nicer call interface.
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 328c8e0d2d..5e1e9721e8 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -1451,7 +1451,7 @@ void map_lines::nsubst(nsubst_spec &spec)
while ((pos = lines[y].find_first_of(spec.key, pos)) != string::npos)
positions.push_back(coord_def(pos++, y));
}
- random_shuffle(positions.begin(), positions.end(), random2);
+ shuffle_array(positions);
int pcount = 0;
const int psize = positions.size();
@@ -1483,7 +1483,7 @@ int map_lines::apply_nsubst(vector<coord_def> &pos, int start, int nsub,
string map_lines::block_shuffle(const string &s)
{
vector<string> segs = split_string("/", s);
- random_shuffle(segs.begin(), segs.end(), random2);
+ shuffle_array(segs);
return (comma_separated_line(segs.begin(), segs.end(), "/", "/"));
}