mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 07:30:26 +00:00
when search in overview matches nothing, it now displays lands not in game
This commit is contained in:
parent
989fc119bc
commit
97fda826a8
24
menus.cpp
24
menus.cpp
@ -38,19 +38,26 @@ void showOverview() {
|
|||||||
|
|
||||||
generateLandList(isLandIngame);
|
generateLandList(isLandIngame);
|
||||||
|
|
||||||
|
bool not_in_game = false;
|
||||||
|
|
||||||
if(dialog::infix != "") {
|
if(dialog::infix != "") {
|
||||||
vector<eLand> filtered;
|
auto land_matches = [] (eLand l) {
|
||||||
for(eLand l: landlist) {
|
|
||||||
string s = dnameof(l);
|
string s = dnameof(l);
|
||||||
s += "@";
|
s += "@";
|
||||||
s += dnameof(treasureType(l));
|
s += dnameof(treasureType(l));
|
||||||
s += "@";
|
s += "@";
|
||||||
s += dnameof(nativeOrbType(l));
|
s += dnameof(nativeOrbType(l));
|
||||||
if(dialog::hasInfix(s))
|
return dialog::hasInfix(s);
|
||||||
filtered.push_back(l);
|
};
|
||||||
}
|
|
||||||
|
vector<eLand> filtered;
|
||||||
|
for(eLand l: landlist) if(land_matches(l)) filtered.push_back(l);
|
||||||
if(filtered.size())
|
if(filtered.size())
|
||||||
landlist = filtered;
|
landlist = filtered;
|
||||||
|
else {
|
||||||
|
for(int i=0; i<landtypes; i++) if(land_matches(eLand(i))) filtered.push_back(eLand(i));
|
||||||
|
if(filtered.size()) landlist = filtered, not_in_game = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nl = isize(landlist), nlm;
|
int nl = isize(landlist), nlm;
|
||||||
@ -63,12 +70,17 @@ void showOverview() {
|
|||||||
}
|
}
|
||||||
else nlm = nl;
|
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 + (not_in_game ? 1 : 0), vid.xres/40);
|
||||||
|
|
||||||
eLand curland = getLandForList(cwt.at);
|
eLand curland = getLandForList(cwt.at);
|
||||||
|
|
||||||
getcstat = '0';
|
getcstat = '0';
|
||||||
|
|
||||||
|
if(not_in_game) {
|
||||||
|
int i0 = 56 + vid.fsize + nl * vf;
|
||||||
|
displayfrZ(64, i0, 1, vf-4, "(these lands are not in game)", forecolor, 0);
|
||||||
|
}
|
||||||
|
|
||||||
for(int i=0; i<nl; i++) {
|
for(int i=0; i<nl; i++) {
|
||||||
eLand l = landlist[lstart + i];
|
eLand l = landlist[lstart + i];
|
||||||
int xr = vid.xres / 64;
|
int xr = vid.xres / 64;
|
||||||
|
Loading…
Reference in New Issue
Block a user