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

arb:: comments, named tilings

This commit is contained in:
Zeno Rogue 2019-12-27 01:43:58 +01:00
parent 3f69ffa58c
commit ab283002f1
2 changed files with 13 additions and 2 deletions

View File

@ -27,6 +27,7 @@ struct shape {
struct arbi_tiling {
vector<shape> shapes;
string name;
geometryinfo1& get_geometry();
eGeometryClass get_class() { return get_geometry().kind; }
@ -63,6 +64,8 @@ template<class T> bool correct_index(int index, const T& v) { return correct_ind
template<class T> void verify_index(int index, const T& v) { if(!correct_index(index, v)) throw hr_parse_exception("bad index"); }
string unnamed = "unnamed";
void load(const string& fname) {
fhstream f(fname, "rt");
string s;
@ -73,13 +76,20 @@ void load(const string& fname) {
}
auto& c = current;
c.shapes.clear();
c.name = unnamed;
exp_parser ep;
ep.s = s;
ld angleunit = 1, distunit = 1, angleofs = 0;
while(true) {
ep.skip_white();
if(ep.next() == 0) break;
if(ep.eat("e2.")) {
if(ep.eat("#")) {
while(ep.eat(" ")) ;
string s = "";
while(ep.next() >= 32) s += ep.next(), ep.at++;
if(c.name == unnamed) c.name = s;
}
else if(ep.eat("e2.")) {
ginf[gArbitrary].g = giEuclid2;
set_flag(ginf[gArbitrary].flags, qBOUNDED, false);
}
@ -334,6 +344,7 @@ int readArgs() {
println(hlog, "failed: ", ex.s);
exit(3);
}
ginf[gArbitrary].tiling_name = current.name;
}
else return 1;
return 0;

View File

@ -886,7 +886,7 @@ EX vector<geometryinfo> ginf = {
{"{3,4,4}","none", "{3,4,4} hyperbolic honeycomb", "344", 8, 4, qIDEAL, giHyperb3, 0x50000, {{7, 2}}, eVariation::pure},
{"{3,4,4}","Crystal", "4D crystal in H3", "Cryst3" , 8, 4, qIDEAL | qANYQ | qCRYSTAL, giHyperb3, 0x52000, {{7, 3}}, eVariation::pure},
{"cat", "cat", "Arnold's cat mapping torus", "cat", 12, 3, qBINARY | qSOL | qsBQ | qOPTQ, giSolNIH, 0x52200, {{6, 4}}, eVariation::pure},
{"arb", "arb", "arbitrary", "arb", 7, 3, qEXPERIMENTAL, giEuclid2, 0, {{7, 5}}, eVariation::pure},
{"arb", "none", "arbitrary", "arb", 7, 3, qEXPERIMENTAL, giEuclid2, 0, {{7, 5}}, eVariation::pure},
{"{4,oo}", "none", "{4,∞} (infinite squares)", "oox4", 4, 100, qIDEAL, giHyperb2, 0x49400, {{5, 5}}, eVariation::pure},
};
// bits: 9, 10, 15, 16, (reserved for later) 17, 18