1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-29 19:40:35 +00:00

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(")) { else if(ep.eat("treestate(")) {
rulegen::parse_treestate(c, ep); 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(")) { else if(ep.eat("yendor_backsteps(")) {
c.yendor_backsteps = ep.iparse(); c.yendor_backsteps = ep.iparse();
ep.force_eat(")"); 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() { EX void verify_parsed_treestates() {
println(hlog, arb::current.shapes[0].connections); if(rule_root < 0 || rule_root >= isize(treestates))
println(hlog, arb::current.shapes[1].connections); throw hr_parse_exception("undefined treestate as root");
println(hlog, arb::current.shapes[0].stretch_shear);
for(auto& ts: treestates) println(hlog, ts.rules);
for(auto& ts: treestates) for(auto& r: ts.rules) { for(auto& ts: treestates) for(auto& r: ts.rules) {
if(r < 0 && !among(r, DIR_PARENT, DIR_LEFT, DIR_RIGHT)) if(r < 0 && !among(r, DIR_PARENT, DIR_LEFT, DIR_RIGHT))
throw hr_parse_exception("negative number in treestates"); throw hr_parse_exception("negative number in treestates");