1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 15:40:26 +00:00

arb:: added an argument for some functions

This commit is contained in:
Zeno Rogue 2022-04-24 21:40:29 +02:00
parent 87f1c9f972
commit 5a748e113a
2 changed files with 11 additions and 13 deletions

View File

@ -408,15 +408,15 @@ EX void load_tile(exp_parser& ep, arbi_tiling& c, bool unit) {
EX bool do_unmirror = true; EX bool do_unmirror = true;
/** \brief for tessellations which contain mirror rules, remove them by taking the orientable double cover */ /** \brief for tessellations which contain mirror rules, remove them by taking the orientable double cover */
EX void unmirror() { EX void unmirror(arbi_tiling& c) {
auto& mirror_rules = arb::current.mirror_rules; auto& mirror_rules = c.mirror_rules;
mirror_rules = 0; mirror_rules = 0;
for(auto& s: arb::current.shapes) for(auto& s: c.shapes)
for(auto& t: s.connections) for(auto& t: s.connections)
if(t.mirror) if(t.mirror)
mirror_rules++; mirror_rules++;
if(!mirror_rules) return; if(!mirror_rules) return;
auto& sh = current.shapes; auto& sh = c.shapes;
int s = isize(sh); int s = isize(sh);
for(int i=0; i<s; i++) for(int i=0; i<s; i++)
sh.push_back(sh[i]); sh.push_back(sh[i]);
@ -443,9 +443,7 @@ EX void unmirror() {
} }
} }
EX void compute_vertex_valence() { EX void compute_vertex_valence(arb::arbi_tiling& ac) {
auto& ac = arb::current;
int tcl = -1; int tcl = -1;
for(auto& sh: ac.shapes) for(auto& sh: ac.shapes)
@ -856,11 +854,11 @@ EX void load(const string& fname, bool after_sliding IS(false)) {
} }
if(do_unmirror) { if(do_unmirror) {
unmirror(); unmirror(c);
} }
if(!c.have_tree) compute_vertex_valence(); if(!c.have_tree) compute_vertex_valence(c);
if(c.have_tree) rulegen::verify_parsed_treestates(); if(c.have_tree) rulegen::verify_parsed_treestates(c);
if(!after_sliding) slided = current; if(!after_sliding) slided = current;
} }
@ -1474,7 +1472,7 @@ EX void convert() {
} }
} }
arb::compute_vertex_valence(); arb::compute_vertex_valence(ac);
} }
EX bool in() { EX bool in() {

View File

@ -2422,7 +2422,7 @@ EX void parse_treestate(arb::arbi_tiling& c, exp_parser& ep) {
ep.force_eat(")"); ep.force_eat(")");
} }
EX void verify_parsed_treestates() { EX void verify_parsed_treestates(arb::arbi_tiling& c) {
if(rule_root < 0 || rule_root >= isize(treestates)) if(rule_root < 0 || rule_root >= isize(treestates))
throw hr_parse_exception("undefined treestate as root"); throw hr_parse_exception("undefined treestate as root");
for(auto& ts: treestates) for(auto& r: ts.rules) { for(auto& ts: treestates) for(auto& r: ts.rules) {
@ -2431,7 +2431,7 @@ EX void verify_parsed_treestates() {
if(r > isize(treestates)) if(r > isize(treestates))
throw hr_parse_exception("undefined treestate"); throw hr_parse_exception("undefined treestate");
} }
for(auto& sh: arb::current.shapes) sh.cycle_length = sh.size(); for(auto& sh: c.shapes) sh.cycle_length = sh.size();
find_possible_parents(); find_possible_parents();
} }