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

rogueviz::dhrg:: improved cleanup

This commit is contained in:
Zeno Rogue 2022-07-23 15:43:26 +02:00
parent 57f9e3efb6
commit cd58923454
2 changed files with 17 additions and 3 deletions

View File

@ -86,9 +86,6 @@ void place_rogueviz_vertices() {
for(int i=0; i<N; i++) vdata[i].m->base = vertices[i]->ascell();
for(int i=0; i<N; i++) vdata[i].m->at = Id;
fixedges();
for(int i=N; i<isize(vdata); i++)
if(vdata[i].m)
vdata[i].m->store();
}
int destroy;
@ -97,6 +94,8 @@ void clear() {
coords.clear();
// destroytallies();
// todo: correct cleanup!
for(int i=0; i<MAXDIST; i++) tally[i] = 0;
for(int i=0; i<MAXDIST; i++) edgetally[i] = 0;
#ifdef BUILD_ON_HR
mymap.clear();
#else
@ -265,8 +264,22 @@ int dhrgArgs() {
return 0;
}
void gamedata(hr::gamedata* gd) {
if(true) {
for(auto& t: tally) gd->store(t);
for(auto& t: edgetally) gd->store(t);
gd->store(coords);
#ifdef BUILD_ON_HR
gd->store(mymap);
#else
gd->store(mroot);
#endif
}
}
auto hook =
addHook(hooks_args, 50, dhrgArgs)
+ addHook(hooks_gamedata, 230, gamedata)
+ addHook(hooks_clearmemory, 200, clear);
#if CAP_SDL

View File

@ -15,6 +15,7 @@ namespace dhrg {
e->orig = NULL;
addedge(e->i, e->j, e);
}
storeall(N);
}
void tst() {}