1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

made all_disk_cells and all_disk_cells_sorted different, for consistency

This commit is contained in:
Zeno Rogue 2022-05-21 13:09:46 +02:00
parent 793148729b
commit 37f4e400bd

View File

@ -333,19 +333,22 @@ EX hookset<hrmap*()> hooks_newmap;
EX int req_disksize, disksize; EX int req_disksize, disksize;
EX vector<cell*> all_disk_cells; EX vector<cell*> all_disk_cells;
EX vector<cell*> all_disk_cells_sorted;
EX void init_disk_cells() { EX void init_disk_cells() {
disksize = req_disksize; disksize = req_disksize;
all_disk_cells.clear(); all_disk_cells.clear();
all_disk_cells_sorted.clear();
if(!disksize) return; if(!disksize) return;
celllister cl(currentmap->gamestart(), 1000000, disksize, NULL); celllister cl(currentmap->gamestart(), 1000000, disksize, NULL);
all_disk_cells = cl.lst; all_disk_cells = cl.lst;
sort(all_disk_cells.begin(), all_disk_cells.end()); all_disk_cells_sorted = cl.lst;
sort(all_disk_cells_sorted.begin(), all_disk_cells_sorted.end());
} }
EX bool is_in_disk(cell *c) { EX bool is_in_disk(cell *c) {
auto it = lower_bound(all_disk_cells.begin(), all_disk_cells.end(), c); auto it = lower_bound(all_disk_cells_sorted.begin(), all_disk_cells_sorted.end(), c);
if(it == all_disk_cells.end()) return false; if(it == all_disk_cells_sorted.end()) return false;
return *it == c; return *it == c;
} }