mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-25 22:52:49 +00:00
ru:: parse markup in hints and help
This commit is contained in:
parent
08dccbdb08
commit
1055ae0249
@ -255,7 +255,7 @@ void npc_or_trader::act() {
|
||||
pushScreen([&] { cmode = mode::playing; popScreen(); });
|
||||
pushScreen([&] {
|
||||
dialog::init(name, color() >> 8);
|
||||
dialog::addHelp(text);
|
||||
dialog::addHelp(parse_markup(text));
|
||||
dialog::addBreak(100);
|
||||
dialog::addBack();
|
||||
dialog::display();
|
||||
@ -360,7 +360,7 @@ void hint::act() {
|
||||
bool cur = intersect(get_pixel_bbox(), m.get_pixel_bbox());
|
||||
if(gframeid < 300) cur = 0;
|
||||
if(cur && !state) {
|
||||
addMessage(hint_text);
|
||||
addMessage(parse_markup(hint_text));
|
||||
}
|
||||
state = cur;
|
||||
}
|
||||
|
@ -163,4 +163,6 @@ void add_revert(revert_stack& s, const reaction_t& what);
|
||||
|
||||
void revert_all(revert_stack& s);
|
||||
|
||||
string parse_markup(string s);
|
||||
|
||||
}
|
||||
|
@ -349,6 +349,23 @@ void set_sval() {
|
||||
}
|
||||
}
|
||||
|
||||
string parse_markup(string s) {
|
||||
while(s.find("\\n") != string::npos) s.replace(s.find("\\n"), 2, "\n");
|
||||
while(s.find("[key:") != string::npos) {
|
||||
int kf = s.find("[key:");
|
||||
int ke = s.find("]", kf);
|
||||
string what = s.substr(kf+5, ke-kf-5);
|
||||
bool ok = false;
|
||||
for(auto& p: powers) if(p.name == what) {
|
||||
s.replace(kf, ke-kf+1, dialog::keyname(p.key));
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
if(!ok) return s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void enable() {
|
||||
|
||||
stop_game();
|
||||
|
Loading…
x
Reference in New Issue
Block a user