1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

arb:: a feature to add commandline options

This commit is contained in:
Zeno Rogue 2021-10-15 22:15:47 +02:00
parent 6821caa509
commit e3c80b70bf

View File

@ -85,6 +85,8 @@ struct arbi_tiling {
ld boundary_ratio;
string filename;
vector<string> options;
int min_valence, max_valence;
geometryinfo1& get_geometry();
@ -473,6 +475,16 @@ EX void load(const string& fname, bool after_sliding IS(false)) {
else if(ep.eat("star.")) {
c.is_star = true;
}
else if(ep.eat("option(\"")) {
next:
string s = "";
while(ep.next() != '"') s += ep.eatchar();
ep.force_eat("\"");
c.options.push_back(s);
ep.skip_white();
if(ep.eat(",")) { ep.skip_white(); ep.force_eat("\""); goto next; }
ep.force_eat(")");
}
else if(ep.eat("angleunit(")) angleunit = real(ep.parsepar());
else if(ep.eat("angleofs(")) {
angleofs = real(ep.parsepar());
@ -987,6 +999,7 @@ EX void run(string fname) {
try {
load(fname);
ginf[gArbitrary].tiling_name = current.name;
arg::run_arguments(current.options);
}
catch(hr_polygon_error& poly) {
set_geometry(g);