1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

Filtering by keyboard in the World Overview screen

This commit is contained in:
Zeno Rogue 2017-08-18 02:47:49 +02:00
parent 0df6d78c0b
commit fef663e1b3
2 changed files with 42 additions and 13 deletions

View File

@ -409,6 +409,7 @@ namespace mapeditor {
char tt = 0; char tt = 0;
if(c >= 'a' && c <= 'z') tt += c - 32; if(c >= 'a' && c <= 'z') tt += c - 32;
else if(c >= 'A' && c <= 'Z') tt += c; else if(c >= 'A' && c <= 'Z') tt += c;
else if(c == '@') tt += c;
if(tt) t += tt; if(tt) t += tt;
} }
return t.find(infix) != string::npos; return t.find(infix) != string::npos;

View File

@ -19,26 +19,51 @@ int PREC(ld x) {
void showOverview() { void showOverview() {
cmode = sm::ZOOMABLE | sm::OVERVIEW; cmode = sm::ZOOMABLE | sm::OVERVIEW;
DEBB(DF_GRAPH, (debugfile,"show overview\n")); DEBB(DF_GRAPH, (debugfile,"show overview\n"));
mouseovers = XLAT("world overview");
mouseovers += " "; if(mapeditor::infix != "")
mouseovers += XLAT(" kills: %1/%2", its(tkills()), its(killtypes())); mouseovers = mapeditor::infix;
mouseovers += XLAT(" $$$: %1", its(gold())); else {
if(hellUnlocked()) { mouseovers = XLAT("world overview");
int i1, i2; countHyperstoneQuest(i1, i2); mouseovers += " ";
mouseovers += XLAT(" Hyperstone: %1/%2", its(i1), its(i2)); mouseovers += XLAT(" kills: %1/%2", its(tkills()), its(killtypes()));
mouseovers += XLAT(" $$$: %1", its(gold()));
if(hellUnlocked()) {
int i1, i2; countHyperstoneQuest(i1, i2);
mouseovers += XLAT(" Hyperstone: %1/%2", its(i1), its(i2));
}
else
mouseovers += XLAT(" Hell: %1/9", its(orbsUnlocked()));
} }
else
mouseovers += XLAT(" Hell: %1/9", its(orbsUnlocked()));
bool pages; bool pages;
int nl = LAND_OVER, nlm; int nl = LAND_OVER, nlm;
eLand *landtab = land_over; eLand *landtab = land_over;
if(randomPatternsMode) { nl = nlm = RANDLANDS; landtab = randlands; } if(randomPatternsMode) { nl = RANDLANDS; landtab = randlands; }
else {
if(mapeditor::infix != "") {
static eLand filteredLands[landtypes];
int nlid = 0;
for(int i=0; i<nl; i++) {
eLand l = landtab[i];
string s = dnameof(l);
s += "@";
s += dnameof(treasureType(l));
s += "@";
s += dnameof(orbType(l));
if(mapeditor::hasInfix(s))
filteredLands[nlid++] = l;
}
if(nlid) {
nl = nlid; landtab = filteredLands;
}
}
if(nl > 30) {
pages = true; pages = true;
landtab += dialog::handlePage(nl, nlm, (nl+1)/2); landtab += dialog::handlePage(nl, nlm, (nl+1)/2);
} }
else nlm = nl;
int vf = min((vid.yres-64-vid.fsize*2) / nlm, vid.xres/40); int vf = min((vid.yres-64-vid.fsize*2) / nlm, vid.xres/40);
@ -158,6 +183,7 @@ void showOverview() {
"mousewheel to gain or lose treasures and orbs quickly (Ctrl = precise, Shift = reverse)." "mousewheel to gain or lose treasures and orbs quickly (Ctrl = precise, Shift = reverse)."
); );
else if(dialog::handlePageButtons(uni)) ; else if(dialog::handlePageButtons(uni)) ;
else if(mapeditor::editInfix(uni)) ;
else if(doexiton(sym, uni)) popScreen(); else if(doexiton(sym, uni)) popScreen();
}; };
} }
@ -740,7 +766,9 @@ void setAppropriateOverview() {
pushScreen(peace::showMenu); pushScreen(peace::showMenu);
else if(geometry != gNormal) else if(geometry != gNormal)
pushScreen(showEuclideanMenu); pushScreen(showEuclideanMenu);
else else {
mapeditor::infix = "";
pushScreen(showOverview); pushScreen(showOverview);
}
} }