mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
IF_KEY_EXISTS used in util.cpp
This commit is contained in:
parent
cd60b0ffb3
commit
e567fa2033
29
util.cpp
29
util.cpp
@ -207,11 +207,10 @@ cld exp_parser::parse(int prio) {
|
|||||||
cld c = rparse(0);
|
cld c = rparse(0);
|
||||||
force_eat(")");
|
force_eat(")");
|
||||||
|
|
||||||
if(extra_params.count("angleunit")) {
|
IF_KEY_EXISTS(it, extra_params, "angleunit") {
|
||||||
|
a *= it->second;
|
||||||
a *= extra_params["angleunit"];
|
b *= it->second;
|
||||||
b *= extra_params["angleunit"];
|
c *= it->second;
|
||||||
c *= extra_params["angleunit"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return edge_of_triangle_with_angles(real(a), real(b), real(c));
|
return edge_of_triangle_with_angles(real(a), real(b), real(c));
|
||||||
@ -238,14 +237,14 @@ cld exp_parser::parse(int prio) {
|
|||||||
test.compute_sum();
|
test.compute_sum();
|
||||||
test.compute_geometry();
|
test.compute_geometry();
|
||||||
res = test.edgelength;
|
res = test.edgelength;
|
||||||
if(extra_params.count("distunit"))
|
IF_KEY_EXISTS(it, extra_params, "distunit")
|
||||||
res /= extra_params["distunit"];
|
res /= it->second;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if(eat("regangle(")) {
|
else if(eat("regangle(")) {
|
||||||
cld edgelen = parse(0);
|
cld edgelen = parse(0);
|
||||||
if(extra_params.count("distunit")) {
|
IF_KEY_EXISTS(it, extra_params, "distunit") {
|
||||||
edgelen = edgelen * extra_params["distunit"];
|
edgelen = edgelen * it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
force_eat(",");
|
force_eat(",");
|
||||||
@ -261,14 +260,14 @@ cld exp_parser::parse(int prio) {
|
|||||||
|
|
||||||
if(arb::legacy) {
|
if(arb::legacy) {
|
||||||
res = M_PI - result;
|
res = M_PI - result;
|
||||||
if(extra_params.count("angleofs"))
|
IF_KEY_EXISTS(it, extra_params, "angleofs")
|
||||||
res -= extra_params["angleofs"];
|
res -= it->second;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
res = result;
|
res = result;
|
||||||
|
|
||||||
if(extra_params.count("angleunit"))
|
IF_KEY_EXISTS(it, extra_params, "angleunit")
|
||||||
res /= extra_params["angleunit"];
|
res /= it->second;
|
||||||
}
|
}
|
||||||
else if(eat("test(")) {
|
else if(eat("test(")) {
|
||||||
res = parsepar();
|
res = parsepar();
|
||||||
@ -319,8 +318,8 @@ cld exp_parser::parse(int prio) {
|
|||||||
else if(next() == '(') at++, res = parsepar();
|
else if(next() == '(') at++, res = parsepar();
|
||||||
else {
|
else {
|
||||||
string number = next_token();
|
string number = next_token();
|
||||||
if(extra_params.count(number)) res = extra_params[number];
|
IF_KEY_EXISTS(it, extra_params, number) res = it->second;
|
||||||
else if(params.count(number)) res = params[number]->get_cld();
|
else IF_KEY_EXISTS(it, params, number) res = it->second->get_cld();
|
||||||
else if(number == "e") res = exp(1);
|
else if(number == "e") res = exp(1);
|
||||||
else if(number == "i") res = cld(0, 1);
|
else if(number == "i") res = cld(0, 1);
|
||||||
else if(number == "p" || number == "pi") res = M_PI;
|
else if(number == "p" || number == "pi") res = M_PI;
|
||||||
|
Loading…
Reference in New Issue
Block a user