-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
return 0; | ||
} | ||
win->draw = true; | ||
for (int i = 0; i < win->height; i++) { |
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 touching win
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);
, not clearok(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.
clearok updates stdscr without touching win and I don't know if it's intended or not, but calling it doesn't fix black screen issues, while looping does.
I did not see that, it looks like a bug. It's only used inside of wclear
, which in turn is only used by clear
in cursesport.cpp, it's a mess and it's probably not worth touching it.
The implementation of redrawwin
is fine.
Regarding |
@drbig, popup is actually separated issue caused by double buffering. cursesport updates out of screen buffer without actually outputting anything to the screen. When game ends saving files, it redraws game screen(overwrites out of screen buffer once more), then after a while back buffer is outputted to the screen but popups are already gone. |
Will it be possible solution for this (#11706)? |
@Night-Pryanik No. It simply adds possibility to filter vehicle parts by name. It doesn't change the actual installation process where parts are removed from inventory and attached to the vehicle, only UI which happens before the actual installation begins. |
/* | ||
* 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 comment
The 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 comment
The 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 comment
The 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 comment
The 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?
Rebased to fix unmergeability. |
This PR didn't have updates for a while. Is there a major problem with it that prevents merging? It looks quite useful, as out vehicle part menu got quite bloated. |
I'm not convinced that letting the input context redraw the windows is a good solution. In my opinion, the caller (the loop that calls This is an important difference when the normal drawing code displays the current key bindings. If the bindings were changed and the input context only calls the curses redraw-functions, it will draw the current buffer, which will still contain the information about the old key bindings. That information must be updated by the caller as only the caller knows where to print it. |
Just checking for HELP_KEYBINDINGS bloats code too much:
Adding special case for If handler needs more than curses functions, it can check action just as |
Filter filters parts by name Updated curses port to behave more like curses * Added redrawwin * Added handling of null pointer to wrefresh Moved lcmatch to game.cpp and game.h Function lcmatch was declared too many times in too many files. Since all of them included game.h already and including ui.h made little sense just for lcmatch, moved it to game.* Workaround for popup in tiles In several places in tiles build popup didn't appear for the following reason: Curses port writes to back renderer but the actual screen is not updated anywhere in cursesport.cpp. It's updated from renderer in try_update which is called from message handling routine. If screen was rewritten before message processed started again, then no matter how many calls to wrefresh were done, they were not actually printed to the screen. Only backscreen renderer changed. Update wrefresh to update actual renderer. Note that it's not placed inside of `if (win->draw)`. In e.g. when popup() calls refresh mainwin->draw is false. Refactored input_context to keep track of windows Now after input_context corrupts screen after HELP_KEYBINDING, it redraws windows that were assigned to it. As result, it fixes CleverRaven#8514, fixes CleverRaven#9835 in * Character menu (in-game) * Construction menu * Character creation menu * World creation menu * Vehicle interaction menu
Am I correctly interpreting the discussion here that the only thing wrong with the original feature is that our current window-redrawing code can't handle it, and no one likes the various possible solutions to that problem? |
Conflicts: src/crafting.cpp src/game.cpp src/input.cpp src/newcharacter.cpp
@sparr |
Out of sync |
This PR adds ability to filter parts for
i
installation in vehicle interaction menu.Displaying query for filtering caused nasty artifacts (windows were not redrawn nor in console, not in tiles, there were black spaces) so I've updated curses port to redraw them and patched the same artifacts that appeared after closing help '?'.
I've tested it on linux with tiles on and off, can't say if behaves properly on windows.