diff --git a/rogueviz/dhrg/dhrg.cpp b/rogueviz/dhrg/dhrg.cpp index 46adbf11..9a32c91e 100644 --- a/rogueviz/dhrg/dhrg.cpp +++ b/rogueviz/dhrg/dhrg.cpp @@ -65,7 +65,6 @@ void clear() { void dhrg_init() { if(!mroot) { println(hlog, "DHRG version " DHRGVER "\n"); - rogueviz::init(0); rogueviz::rv_hook(hooks_handleKey, 100, dhrg_animate); regular_info(); generate_root(); @@ -82,14 +81,7 @@ bool stored; int dhrgArgs() { using namespace arg; - if(argis("-dhrg")) { - PHASE(3); dhrg_init(); graph_from_rv(); - next_timestamp++; - ts_rogueviz = next_timestamp; - ts_vertices = next_timestamp; - } - - else if(argis("-analyze_grid")) { + if(argis("-analyze_grid")) { PHASE(3); shift(); dhrg_init(); do_analyze_grid(argi()); } @@ -149,7 +141,7 @@ int dhrgArgs() { shift(); ground_truth_test(args()); } - else if(argis("-eload")) { + else if(argis("-el-dhrg")) { PHASE(3); shift(); dhrg_init(); load_embedded(args()); next_timestamp++; ts_rogueviz = next_timestamp; diff --git a/rogueviz/dhrg/embedder.cpp b/rogueviz/dhrg/embedder.cpp index 3e61bc3e..81cb1fa5 100644 --- a/rogueviz/dhrg/embedder.cpp +++ b/rogueviz/dhrg/embedder.cpp @@ -224,6 +224,15 @@ struct dhrg_embedding : public rogueviz::embeddings::tiled_embedding { ld zero_distance(int i) override { return vertices[i]->lev; } + + void save(fhstream& f) override { + int N = isize(rogueviz::vdata); + for(int i=0; ias_hyperpoint(i); #if BUILD_ON_HR cell *c = currentmap->gamestart(); - hyperpoint T0 = vdata[i].m->at * C0; virtualRebase2(vdata[i].m->base, T0, true); vertices[i] = find_mycell(vdata[i].m->base); #else - vertices[i] = find_mycell_by_path(computePath(vdata[i].m->at)); + vertices[i] = find_mycell_by_path(computePath(T0)); #endif vdata[i].m->at = Id; pb++; - // printf("%s\n", computePath(vdata[i].m->base).c_str()); + // printf("%s %s\n", vdata[i].name.c_str(), computePath(vdata[i].m->base).c_str()); } } @@ -284,44 +293,28 @@ void embedder_loop(int max) { } } -void save_embedding(const string s) { - FILE *f = fopen(s.c_str(), "wt"); - int N = isize(rogueviz::vdata); - for(int i=0; i ids; - for(int i=0; i(f); + if(who == "") break; + string where = scan(f); + if(where == "X") where = ""; + vertices[rogueviz::labeler.at(who)] = find_mycell_by_path(where); pb++; } - fclose(f); for(int i=0; i= 1000) recycle_compute_map(); if(!mapptr) mapptr = bt::in() ? bt::new_map() : new hrmap_hyperbolic; recycle_counter++; dynamicval dv (currentmap, mapptr); cell *c = mapptr->gamestart(); - hyperpoint T0 = T * C0; // call HyperRogue's function virtualRebase: // a point in the hyperbolic plane is given by cell c and point T0 relative to c // change c and T0 so that the same point is specified, but with minimal T0