1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-18 11:19:59 +00:00

parser: s and ms are always accepted

This commit is contained in:
Zeno Rogue 2018-11-07 07:21:57 +01:00
parent 9cff432cee
commit 0a198a2ab5
2 changed files with 3 additions and 3 deletions

View File

@ -295,8 +295,6 @@ hyperpoint find_point(ld t) {
exp_parser ep;
auto &dict = ep.extra_params;
dict["t"] = t;
dict["s"] = ticks / 1000.;
dict["ms"] = ticks;
dict["phi"] = t * 2 * M_PI;
dict["x"] = tan(t * M_PI - M_PI/2);
for(auto& ff: formula) {

View File

@ -203,6 +203,8 @@ cld exp_parser::parse(int prio) {
else if(number == "" && next() == '-') res = 0, prio = 0;
else if(number == "") at = -1;
else if(extra_params.count(number)) res = extra_params[number];
else if(number == "s") res = ticks / 1000.;
else if(number == "ms") res = ticks;
else if(number[0] >= 'a' && number[0] <= 'z') at = -1;
else { std::stringstream ss; res = 0; ss << number; ss >> res; }
}
@ -225,6 +227,6 @@ ld parseld(const string& s) {
string parser_help() {
return XLAT("Functions available: %1",
"(a)sin(h), (a)cos(h), (a)tan(h), exp, log, abs, re, im, conj, let(t=...,...t...), e, i, pi");
"(a)sin(h), (a)cos(h), (a)tan(h), exp, log, abs, re, im, conj, let(t=...,...t...), e, i, pi, s, ms");
}
}