an option to change rule_root in the tes file

This commit is contained in:
Zeno Rogue 2021-07-31 16:09:46 +02:00
parent 769411554f
commit a065e73013
2 changed files with 6 additions and 4 deletions

View File

@ -513,6 +513,10 @@ EX void load(const string& fname, bool after_sliding IS(false)) {
else if(ep.eat("treestate(")) {
rulegen::parse_treestate(c, ep);
}
else if(ep.eat("first_treestate(")) {
rulegen::rule_root = ep.iparse();
ep.force_eat(")");
}
else if(ep.eat("yendor_backsteps(")) {
c.yendor_backsteps = ep.iparse();
ep.force_eat(")");

View File

@ -1620,10 +1620,8 @@ EX void parse_treestate(arb::arbi_tiling& c, exp_parser& ep) {
}
EX void verify_parsed_treestates() {
println(hlog, arb::current.shapes[0].connections);
println(hlog, arb::current.shapes[1].connections);
println(hlog, arb::current.shapes[0].stretch_shear);
for(auto& ts: treestates) println(hlog, ts.rules);
if(rule_root < 0 || rule_root >= isize(treestates))
throw hr_parse_exception("undefined treestate as root");
for(auto& ts: treestates) for(auto& r: ts.rules) {
if(r < 0 && !among(r, DIR_PARENT, DIR_LEFT, DIR_RIGHT))
throw hr_parse_exception("negative number in treestates");