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

refer to color by HTML name in commandline arguments

This commit is contained in:
Zeno Rogue
2021-10-17 09:18:31 +02:00
parent 9d26e98fcd
commit 839ca440ea
8 changed files with 60 additions and 19 deletions

View File

@@ -102,6 +102,14 @@ EX namespace arg {
}
}
EX bool argis(const string& s) { if(args()[0] == '-' && args()[1] == '-') return args().substr(1) == s; return args() == s; }
EX color_t argcolor(int bits) {
string s = args();
auto p = find_color_by_name(s);
if(p && bits == 24) return p->second;
if(p && bits == 32) return (p->second << 8) | 0xFF;
return strtoll(argcs(), NULL, 16);
}
EX void shift_arg_formula(ld& x, const reaction_t& r IS(reaction_t())) {
shift(); ld old = x; x = argf();