1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-18 11:19:59 +00:00

memory clearing in inverse

This commit is contained in:
Zeno Rogue 2020-07-13 00:54:12 +02:00
parent 224a02d086
commit 9da8dac45b
2 changed files with 8 additions and 0 deletions

View File

@ -342,6 +342,7 @@ EX void clearcell(cell *c) {
}
DEBB(DF_MEMORY, (format("DEL %p\n", hr::voidp(c))));
destroy_cell(c);
gp::delete_mapped(c);
}
EX heptagon deletion_marker;

View File

@ -1262,6 +1262,13 @@ EX namespace gp {
EX hrmap* get_underlying_map() { return inv_map()->underlying_map; }
EX cell* get_mapped(cell *c) { return inv_map()->get_mapped(c, 0); }
EX int untruncated_shift(cell *c) { return inv_map()->shift[c]; }
EX void delete_mapped(cell *c) {
if(!pmap) return;
auto i = (hrmap_inverse*) pmap;
if(i->mapping.count(c))
destroy_cell(i->mapping[c]);
}
EX cell *inverse_move(cell *c, int d) { return inv_map()->create_move(c, d); }