mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
Add wiki links to land help
This commit is contained in:
parent
7f8d978beb
commit
ff7be8d4e0
4
help.cpp
4
help.cpp
@ -1182,5 +1182,9 @@ EX void gotoHelpFor(eLand l) {
|
|||||||
help_extensions.push_back(help_extension{'t', XLAT("Galápagos shading"), [] () {
|
help_extensions.push_back(help_extension{'t', XLAT("Galápagos shading"), [] () {
|
||||||
tortoise::shading_enabled = !tortoise::shading_enabled;
|
tortoise::shading_enabled = !tortoise::shading_enabled;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
help_extensions.push_back(help_extension{'w', XLAT("wiki"), [l] () {
|
||||||
|
open_wiki(linf[l].name);
|
||||||
|
}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
util.cpp
15
util.cpp
@ -724,4 +724,19 @@ EX void open_url(string s) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *urlhex = "0123456789ABCDEF";
|
||||||
|
EX void open_wiki(const char *title) {
|
||||||
|
string url = "https://hyperrogue.miraheze.org/wiki/";
|
||||||
|
unsigned char c;
|
||||||
|
for (size_t i = 0; (c = title[i]); ++i) {
|
||||||
|
if (('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '_' || c == '-')
|
||||||
|
url += c;
|
||||||
|
else if (c == ' ')
|
||||||
|
url += "_";
|
||||||
|
else
|
||||||
|
url += string("%") + urlhex[c/16] + urlhex[c%16];
|
||||||
|
}
|
||||||
|
open_url(url);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user