mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-16 02:04:48 +00:00
fixed cellcount
This commit is contained in:
parent
97fc244ba9
commit
b79eb4de1d
8
cell.cpp
8
cell.cpp
@ -138,12 +138,18 @@ EX int dirdiff(int dd, int t) {
|
|||||||
|
|
||||||
EX int cellcount = 0;
|
EX int cellcount = 0;
|
||||||
|
|
||||||
|
EX void destroy_cell(cell *c) {
|
||||||
|
tailored_delete(c);
|
||||||
|
cellcount--;
|
||||||
|
}
|
||||||
|
|
||||||
EX cell *newCell(int type, heptagon *master) {
|
EX cell *newCell(int type, heptagon *master) {
|
||||||
cell *c = tailored_alloc<cell> (type);
|
cell *c = tailored_alloc<cell> (type);
|
||||||
c->type = type;
|
c->type = type;
|
||||||
c->master = master;
|
c->master = master;
|
||||||
initcell(c);
|
initcell(c);
|
||||||
hybrid::will_link(c);
|
hybrid::will_link(c);
|
||||||
|
cellcount++;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +333,7 @@ EX void clearcell(cell *c) {
|
|||||||
c->move(t)->move(c->c.spin(t)) = NULL;
|
c->move(t)->move(c->c.spin(t)) = NULL;
|
||||||
}
|
}
|
||||||
DEBB(DF_MEMORY, (format("DEL %p\n", hr::voidp(c))));
|
DEBB(DF_MEMORY, (format("DEL %p\n", hr::voidp(c))));
|
||||||
tailored_delete(c);
|
destroy_cell(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX heptagon deletion_marker;
|
EX heptagon deletion_marker;
|
||||||
|
@ -98,12 +98,11 @@ struct gcell {
|
|||||||
int cellid;
|
int cellid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gcell() { cellcount++;
|
gcell() {
|
||||||
#ifdef CELLID
|
#ifdef CELLID
|
||||||
cellid = cellcount;
|
cellid = cellcount;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
~gcell() { cellcount--; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define landparam LHU.landpar
|
#define landparam LHU.landpar
|
||||||
|
@ -1147,7 +1147,7 @@ EX namespace hybrid {
|
|||||||
|
|
||||||
~hrmap_hybrid() {
|
~hrmap_hybrid() {
|
||||||
in_underlying([] { delete currentmap; });
|
in_underlying([] { delete currentmap; });
|
||||||
for(auto& p: at) tailored_delete(p.second);
|
for(auto& p: at) destroy_cell(p.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual transmatrix spin_to(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_to(c, d, bonus); }); }
|
virtual transmatrix spin_to(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_to(c, d, bonus); }); }
|
||||||
|
Loading…
Reference in New Issue
Block a user