-
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
Debug menu fixes #21053
Debug menu fixes #21053
Conversation
src/wish.cpp
Outdated
@@ -170,7 +170,9 @@ class wish_mutate_callback: public uimenu_callback | |||
|
|||
mvwprintz( menu->window, menu->w_height - 3, startx, c_green, "%s", msg.c_str() ); | |||
msg = padding; | |||
mvwprintw( menu->window, menu->w_height - 2, startx, _( "[/] find, [q]uit" ) ); | |||
input_context ctxt( "UIMENU" ); | |||
mvwprintw( menu->window, menu->w_height - 2, startx, string_format( _( "[%s] find, [%s] quit" ), |
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.
mvwprintw
does formatting, no need to invoke string_format
. Actually, this can cause trouble if the formatted string contains a '%', which is interpreted by mvwprintw
and expects another (missing) argument.
src/wish.cpp
Outdated
mvwprintw( w_info, getmaxy( w_info ) - 2, 0, | ||
_( "[/] find, [f]riendly, [h]allucination, [i]ncrease group, [d]ecrease group, [q]uit" ) ); | ||
string_format( |
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.
Same problem here: mvwprintw
does formatting on its own.
src/wish.cpp
Outdated
mvwprintw( menu->window, menu->w_height - 2, startx, _( "[/] find, [f] container, [q]uit" ) ); | ||
input_context ctxt( "UIMENU" ); | ||
mvwprintw( menu->window, menu->w_height - 2, startx, | ||
string_format( _( "[%s] find, [f] container, [%s] quit" ), |
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.
And here.
src/wish.cpp
Outdated
@@ -476,36 +485,42 @@ void debug_menu::wishitem( player *p, int x, int y, int z ) | |||
wmenu.query(); | |||
if( wmenu.ret >= 0 ) { | |||
item granted( opts[wmenu.ret] ); | |||
if( dynamic_cast<wish_item_callback *>( wmenu.callback )->incontainer ) { |
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.
Why don't you use the callback object cb
directly? That way you won't need the dynamic_cast
.
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, I actually moved these code here from a latter place. I'll see if I can improve it.
This will fix 2 of 3 remaining items in #17889. |
Fixes several issues with regard to the debug menu: