-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CR] Filter in vehicle menu for part installation #13341
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,6 +131,18 @@ bool is_valid_in_w_terrain(int x, int y) | |
return x >= 0 && x < TERRAIN_WINDOW_WIDTH && y >= 0 && y < TERRAIN_WINDOW_HEIGHT; | ||
} | ||
|
||
/* | ||
* case insensitive string::find( string::findstr ). findstr must be lowercased | ||
*/ | ||
bool lcmatch(const std::string &str, const std::string &findstr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there some specific reason why you moved this function around? game.cpp isn't really a good place for it, it has nothing to do with the game itself. While ui.cpp may not be the best, it kind of fits there as it is mostly used for UI related stuff. Alternatively, it could be in in output.cpp or in catacharset.cpp (the function is btw. not Unicode-compatible). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved declaration to game.h so every second .cpp file would stop redeclaring it. And since it was moved to game.h for that, it might be defined in game.cpp as well. I originally moved it to ui.h, but most files that used the function didn't include ui.h so it was not that much better(which I forgot to uninclude - it doesn't make sense to include entire ui.h for simple lcmatch). I din't find general helper functions header or file so moved to game.h which is included everywhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Because it's already included everywhere" is pretty much the worst reason to put a function in a particular file, the fact that everything includes game.h already is a major problem that we're trying to fix, and this makes the code go the wrong way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it doesn't feel like UI. It's string function. Should I make new header or there more appropriate header? |
||
{ | ||
std::string ret = ""; | ||
ret.reserve( str.size() ); | ||
transform( str.begin(), str.end(), std::back_inserter(ret), tolower ); | ||
return ( (int)ret.find( findstr ) != -1 ); | ||
} | ||
|
||
|
||
// This is the main game set-up process. | ||
game::game() : | ||
map_ptr( new map() ), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of repeating the loop, why not call
clearok
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it doesn't work.
clearok updates
stdscr
without touchingwin
and I don't know if it's intended or not, but calling it doesn't fix black screen issues, while looping does.(Oh, there's also a problem with clearok that its proper declaration is
int clearok(WINDOW *win, bool bf);
, notclearok(WINDOW *win)
- but since veh_interact.cpp doesn't call it, I left it as is)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not see that, it looks like a bug. It's only used inside of
wclear
, which in turn is only used byclear
in cursesport.cpp, it's a mess and it's probably not worth touching it.The implementation of
redrawwin
is fine.