mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 15:40:26 +00:00
arb:: refactored set_defaults
This commit is contained in:
parent
edee92d877
commit
292bb72794
@ -590,23 +590,8 @@ EX void add_connection(arbi_tiling& c, int ai, int as, int bi, int bs, int m) {
|
|||||||
while(bs != bs0);
|
while(bs != bs0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void load(const string& fname, bool load_as_slided IS(false), bool keep_sliders IS(false)) {
|
EX void set_defaults(arb::arbi_tiling& c, bool keep_sliders, string fname) {
|
||||||
fhstream f(fname, "rt");
|
|
||||||
if(!f.f) throw hr_parse_exception("file " + fname + " does not exist");
|
|
||||||
string s;
|
|
||||||
while(true) {
|
|
||||||
int c = fgetc(f.f);
|
|
||||||
if(c < 0) break;
|
|
||||||
s += c;
|
|
||||||
}
|
|
||||||
auto& c = load_as_slided ? slided : current;
|
|
||||||
c.order++;
|
c.order++;
|
||||||
c.shapes.clear();
|
|
||||||
if(!keep_sliders) {
|
|
||||||
c.sliders.clear();
|
|
||||||
c.intsliders.clear();
|
|
||||||
}
|
|
||||||
int qsliders = 0, qintsliders = 0;
|
|
||||||
c.name = unnamed;
|
c.name = unnamed;
|
||||||
c.comment = "";
|
c.comment = "";
|
||||||
c.filename = fname;
|
c.filename = fname;
|
||||||
@ -619,6 +604,25 @@ EX void load(const string& fname, bool load_as_slided IS(false), bool keep_slide
|
|||||||
c.yendor_backsteps = 0;
|
c.yendor_backsteps = 0;
|
||||||
c.is_star = false;
|
c.is_star = false;
|
||||||
c.is_combinatorial = false;
|
c.is_combinatorial = false;
|
||||||
|
c.shapes.clear();
|
||||||
|
if(!keep_sliders) {
|
||||||
|
c.sliders.clear();
|
||||||
|
c.intsliders.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EX void load(const string& fname, bool load_as_slided IS(false), bool keep_sliders IS(false)) {
|
||||||
|
fhstream f(fname, "rt");
|
||||||
|
if(!f.f) throw hr_parse_exception("file " + fname + " does not exist");
|
||||||
|
string s;
|
||||||
|
while(true) {
|
||||||
|
int c = fgetc(f.f);
|
||||||
|
if(c < 0) break;
|
||||||
|
s += c;
|
||||||
|
}
|
||||||
|
auto& c = load_as_slided ? slided : current;
|
||||||
|
set_defaults(c, keep_sliders, fname);
|
||||||
|
int qsliders = 0, qintsliders = 0;
|
||||||
exp_parser ep;
|
exp_parser ep;
|
||||||
ep.s = s;
|
ep.s = s;
|
||||||
ld angleunit = 1, distunit = 1;
|
ld angleunit = 1, distunit = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user