bounded Minefield now works according to the standard Minesweeper rules

This commit is contained in:
Zeno Rogue committed 2019-09-12 22:42:58 +02:00
1 parent e61c684bca
commit 57f2891826
8 files changed
+52 -2

No files matched your search

+11
View File
@@ -1516,4 +1516,15 @@ void moreBigStuff(cell *c) {
}
}
void generate_mines() {
vector<cell*> candidates;
for(cell *c: currentmap->allcells())
if(c->wall == waMineUnknown)
candidates.push_back(c);
bounded_mine_max = isize(candidates);
hrandom_shuffle(&candidates[0], bounded_mine_max);
bounded_mine_quantity = int(bounded_mine_max * bounded_mine_percentage + 0.5);
for(int i=0; i<bounded_mine_quantity; i++) candidates[i]->wall = waMineMine;
}
}