1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-01-01 18:09:04 +00:00

rogueviz:: dhrg;: legacy invocations

This commit is contained in:
Zeno Rogue
2025-12-05 09:55:27 +01:00
parent 0810767544
commit 02ed6746a1
2 changed files with 47 additions and 2 deletions

View File

@@ -2,8 +2,6 @@
#include "dhrg.h"
namespace rogueviz { extern string fname; }
#include "regular.cpp"
#include "gridmapping.cpp"
#include "mycell.cpp"
@@ -175,3 +173,5 @@ auto hook =
#endif
}
#include "legacy.cpp"

45
rogueviz/dhrg/legacy.cpp Normal file
View File

@@ -0,0 +1,45 @@
#include "dhrg.h"
namespace dhrg {
string legacy_dhrg_name;
int dhrg_legacy_args() {
using namespace arg;
if(argis("-graph") || argis("-dhrg")) {
PHASE(3); shift();
legacy_dhrg_name = args();
rogueviz::embeddings::read_edgelist(legacy_dhrg_name + "-links.txt");
rogueviz::embeddings::read_polar(legacy_dhrg_name + "-coordinates.txt");
dhrg_init(); graph_from_rv();
next_timestamp++;
ts_rogueviz = next_timestamp;
ts_vertices = next_timestamp;
}
else if(argis("-esave")) {
fhstream f(legacy_dhrg_name + "-dhrg.txt", "wt");
if(!f.f) { file_error(legacy_dhrg_name); return 0; }
rogueviz::embeddings::current->save(f);
}
else if(argis("-eload")) {
PHASE(3); shift();
legacy_dhrg_name = args();
rogueviz::embeddings::read_edgelist(legacy_dhrg_name + "-links.txt");
dhrg_init(); load_embedded(legacy_dhrg_name + "-dhrg.txt");
next_timestamp++;
ts_rogueviz = next_timestamp;
ts_vertices = next_timestamp;
}
else return 1;
return 0;
}
auto legacy_hook =
addHook(hooks_args, 50, dhrg_legacy_args);
}