mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-20 00:17:39 +00:00
arcm:: fixed the possible crash on deleting arcms with large cells, because of the confusion of cdata
This commit is contained in:
@@ -694,12 +694,6 @@ struct hrmap_arbi : hrmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
~hrmap_arbi() {
|
~hrmap_arbi() {
|
||||||
/*
|
|
||||||
if(hyperbolic) for(auto& p: arbi_matrix) if(p.second.first->cdata) {
|
|
||||||
delete p.second.first->cdata;
|
|
||||||
p.second.first->cdata = NULL;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
clearfrom(origin);
|
clearfrom(origin);
|
||||||
altmap.clear();
|
altmap.clear();
|
||||||
arbi_matrix.clear();
|
arbi_matrix.clear();
|
||||||
|
@@ -585,10 +585,6 @@ struct hrmap_archimedean : hrmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
~hrmap_archimedean() {
|
~hrmap_archimedean() {
|
||||||
if(hyperbolic) for(auto& p: archimedean_gmatrix) if(p.second.first->cdata) {
|
|
||||||
delete p.second.first->cdata;
|
|
||||||
p.second.first->cdata = NULL;
|
|
||||||
}
|
|
||||||
clearfrom(origin);
|
clearfrom(origin);
|
||||||
altmap.clear();
|
altmap.clear();
|
||||||
archimedean_gmatrix.clear();
|
archimedean_gmatrix.clear();
|
||||||
|
4
cell.cpp
4
cell.cpp
@@ -378,9 +378,9 @@ EX void clearfrom(heptagon *at) {
|
|||||||
q.pop();
|
q.pop();
|
||||||
DEBB(DF_MEMORY, ("from %p", at));
|
DEBB(DF_MEMORY, ("from %p", at));
|
||||||
if(!at->c7) {
|
if(!at->c7) {
|
||||||
heptagon *h = (heptagon*) at->cdata;
|
heptagon *h = dynamic_cast<heptagon*> ((cdata_or_heptagon*) at->cdata);
|
||||||
if(h) {
|
if(h) {
|
||||||
if(h->alt != at) { DEBB(DF_MEMORY | DF_ERROR, ("alt error :: h->alt = ", h->alt)); }
|
if(h->alt != at) { DEBB(DF_MEMORY | DF_ERROR, ("alt error :: h->alt = ", h->alt, " expected ", at)); }
|
||||||
cell *c = h->c7;
|
cell *c = h->c7;
|
||||||
subcell(c, destroycellcontents);
|
subcell(c, destroycellcontents);
|
||||||
h->alt = NULL;
|
h->alt = NULL;
|
||||||
|
@@ -287,7 +287,9 @@ enum hstate { hsOrigin, hsA, hsB, hsError, hsA0, hsA1, hsB0, hsB1, hsC };
|
|||||||
struct cell *createMov(struct cell *c, int d);
|
struct cell *createMov(struct cell *c, int d);
|
||||||
struct heptagon *createStep(struct heptagon *c, int d);
|
struct heptagon *createStep(struct heptagon *c, int d);
|
||||||
|
|
||||||
struct cdata {
|
struct cdata_or_heptagon { virtual ~cdata_or_heptagon() {} };
|
||||||
|
|
||||||
|
struct cdata : cdata_or_heptagon {
|
||||||
int val[4];
|
int val[4];
|
||||||
int bits;
|
int bits;
|
||||||
};
|
};
|
||||||
@@ -313,7 +315,7 @@ constexpr int iteration_limit = 10000000;
|
|||||||
* heptagons are unused
|
* heptagons are unused
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct heptagon {
|
struct heptagon : cdata_or_heptagon {
|
||||||
/** \brief Automata are used to generate the standard maps. s is the state of this automaton */
|
/** \brief Automata are used to generate the standard maps. s is the state of this automaton */
|
||||||
hstate s : 6;
|
hstate s : 6;
|
||||||
/** \brief distance modulo 4, in heptagons */
|
/** \brief distance modulo 4, in heptagons */
|
||||||
|
Reference in New Issue
Block a user