mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
Stop using the deprecated std::random_shuffle, for the benefit of MSVC.
And generalize `hrandom_shuffle` to take an arbitrary `Iter`, so that passing `vec.begin()` will work even with MSVC's debug iterators. (Passing `&vec[0]` or `vec.data()` would work either way, but I'd worry that someone would forget to do that conscientiously every time.)
This commit is contained in:
parent
62db7ee250
commit
1a93fbcd45
2
game.cpp
2
game.cpp
@ -4732,7 +4732,7 @@ void movehex(bool mounted, int colorpair) {
|
||||
for(int t=0; t<c->type; t++) if(c->mov[t] && inpair(c->mov[t], colorpair))
|
||||
dirtable[qdirtable++] = t;
|
||||
|
||||
random_shuffle(dirtable, dirtable+qdirtable);
|
||||
hrandom_shuffle(dirtable, qdirtable);
|
||||
while(qdirtable--) {
|
||||
int t = dirtable[qdirtable];
|
||||
hexvisit(c->mov[t], c, t, mounted, colorpair);
|
||||
|
1
hyper.h
1
hyper.h
@ -37,7 +37,6 @@ using std::imag;
|
||||
using std::stable_sort;
|
||||
using std::out_of_range;
|
||||
using std::get;
|
||||
using std::random_shuffle;
|
||||
using std::move;
|
||||
using std::make_tuple;
|
||||
|
||||
|
@ -691,7 +691,7 @@ void describe(cell *c) {
|
||||
help += "\n";
|
||||
vector<pair<double, int>> v;
|
||||
for(int s=0; s<samples; s++) if(whowon[s] == n) v.emplace_back(vnorm(n->net, data[s].val), s);
|
||||
random_shuffle(v.begin(), v.end());
|
||||
hrandom_shuffle(&v[0], isize(v));
|
||||
sort(v.begin(), v.end(), [] (pair<double,int> a, pair<double,int> b) { return a.first < b.first; });
|
||||
|
||||
for(int i=0; i<isize(v) && i<20; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user