Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/editmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ void editmap::edit_feature()
info_title_curr = info_title<T_t>();
do_ui_invalidation();

emenu.query( true, get_option<int>( "BLINK_SPEED" ) );
emenu.query( false, get_option<int>( "BLINK_SPEED" ) );
if( emenu.ret == UILIST_CANCEL ) {
quit = true;
} else if( ( emenu.ret >= 0 && static_cast<size_t>( emenu.ret ) < T_t::count() ) ||
Expand Down Expand Up @@ -1280,7 +1280,7 @@ void editmap::edit_fld()
info_title_curr = pgettext( "Map editor: Editing field effects", "Field effects" );
do_ui_invalidation();

fmenu.query( true, get_option<int>( "BLINK_SPEED" ) );
fmenu.query( false, get_option<int>( "BLINK_SPEED" ) );
if( ( fmenu.ret > 0 && static_cast<size_t>( fmenu.ret ) < field_type::count() ) ||
( fmenu.ret == UILIST_ADDITIONAL && ( fmenu.ret_act == "LEFT" || fmenu.ret_act == "RIGHT" ) ) ) {

Expand Down Expand Up @@ -1893,7 +1893,7 @@ void editmap::mapgen_preview( const real_coords &tc, uilist &gmenu )
oter_id( gmenu.selected ).id().str() );
do_ui_invalidation();

gpmenu.query( true, get_option<int>( "BLINK_SPEED" ) * 3 );
gpmenu.query( false, get_option<int>( "BLINK_SPEED" ) * 3 );

if( gpmenu.ret == 0 ) {
cleartmpmap( tmpmap );
Expand Down
2 changes: 1 addition & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2368,7 +2368,7 @@ int game::inventory_item_menu( item_location locThisItem,
}

const int prev_selected = action_menu.selected;
action_menu.query( true );
action_menu.query( false );
if( action_menu.ret >= 0 ) {
cMenu = action_menu.ret; /* Remember: hotkey == retval, see addentry above. */
} else if( action_menu.ret == UILIST_UNBOUND && action_menu.ret_act == "RIGHT" ) {
Expand Down
11 changes: 6 additions & 5 deletions src/uilist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,15 +855,14 @@ bool uilist::scrollby( const int scrollby )

shared_ptr_fast<uilist_impl> uilist::create_or_get_ui()
{
shared_ptr_fast<uilist_impl> current_ui = ui.lock();
if( !current_ui ) {
if( !ui ) {
if( title.empty() ) {
ui = current_ui = make_shared_fast<uilist_impl>( *this );
ui = make_shared_fast<uilist_impl>( *this );
} else {
ui = current_ui = make_shared_fast<uilist_impl>( *this, title );
ui = make_shared_fast<uilist_impl>( *this, title );
}
}
return current_ui;
return ui;
}

/**
Expand Down Expand Up @@ -945,6 +944,8 @@ void uilist::query( bool loop, int timeout, bool allow_unfiltered_hotkeys )

input_context ctxt = create_main_input_context();

// Ensure we have a uilist to work on
// TODO: We don't even use the return value here, find a better solution
shared_ptr_fast<uilist_impl> ui = create_or_get_ui();

#if defined(__ANDROID__)
Expand Down
2 changes: 1 addition & 1 deletion src/uilist.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ class uilist // NOLINT(cata-xy)
std::map<input_event, int, std::function<bool( const input_event &, const input_event & )>>
keymap { input_event::compare_type_mod_code };

weak_ptr_fast<uilist_impl> ui;
shared_ptr_fast<uilist_impl> ui;

std::unique_ptr<string_input_popup_imgui> filter_popup;
std::string filter;
Expand Down
Loading