Skip to content

Commit

Permalink
Replace handle_redraw calls with refresh calls
Browse files Browse the repository at this point in the history
game_ui::init_ui() is doing much more than redrawing.
Discard handle_redraw().
Fixes CleverRaven#35631.
  • Loading branch information
AMurkin committed Nov 24, 2019
1 parent 57ec5bb commit f38c174
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 29 deletions.
1 change: 0 additions & 1 deletion src/cursesport.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ int projected_window_width();
int projected_window_height();
bool handle_resize( int w, int h );
int get_scaling_factor();
void handle_redraw();

#endif
#endif
Expand Down
8 changes: 2 additions & 6 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2593,9 +2593,7 @@ std::string options_manager::show( bool ingame, const bool world_options_only )
const std::string action = ctxt.handle_input();

if( world_options_only && ( action == "NEXT_TAB" || action == "PREV_TAB" || action == "QUIT" ) ) {
#if defined(TILES) || defined(_WIN32)
handle_redraw();
#endif
catacurses::refresh();
return action;
}

Expand Down Expand Up @@ -2683,9 +2681,7 @@ std::string options_manager::show( bool ingame, const bool world_options_only )
// keybinding screen erased the internal borders of main menu, restore it:
draw_borders_internal( w_options_header, mapLines );
} else if( action == "QUIT" ) {
#if defined(TILES) || defined(_WIN32)
handle_redraw();
#endif
catacurses::refresh();
break;
}
}
Expand Down
9 changes: 2 additions & 7 deletions src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1689,19 +1689,14 @@ bool handle_resize( int w, int h )
WindowHeight = h;
TERMINAL_WIDTH = WindowWidth / fontwidth / scaling_factor;
TERMINAL_HEIGHT = WindowHeight / fontheight / scaling_factor;
handle_redraw();
SetupRenderTarget();
game_ui::init_ui();

return true;
}
return false;
}

void handle_redraw()
{
SetupRenderTarget();
game_ui::init_ui();
}

void toggle_fullscreen_window()
{
static int restore_win_w = get_option<int>( "TERMINAL_X" ) * fontwidth * scaling_factor;
Expand Down
20 changes: 5 additions & 15 deletions src/worldfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ WORLDPTR worldfactory::make_new_world( bool show_prompt, const std::string &worl
}
}
if( curtab < 0 ) {
#if defined(TILES) || defined(_WIN32)
handle_redraw();
#endif
catacurses::refresh();
return nullptr;
}
}
Expand Down Expand Up @@ -492,9 +490,7 @@ WORLDPTR worldfactory::pick_world( bool show_prompt )
const std::string action = ctxt.handle_input();

if( action == "QUIT" ) {
#if defined(TILES) || defined(_WIN32)
handle_redraw();
#endif
catacurses::refresh();
break;
} else if( !world_pages[selpage].empty() && action == "DOWN" ) {
sel++;
Expand Down Expand Up @@ -761,9 +757,7 @@ void worldfactory::show_active_world_mods( const std::vector<mod_id> &world_mods
}

} else if( action == "QUIT" || action == "CONFIRM" ) {
#if defined(TILES) || defined(_WIN32)
handle_redraw();
#endif
catacurses::refresh();
break;
}
}
Expand Down Expand Up @@ -1170,9 +1164,7 @@ int worldfactory::show_worldgen_tab_confirm( const catacurses::window &win, WORL
if( !valid_worldname( world->world_name ) ) {
continue;
}
#if defined(TILES) || defined(_WIN32)
handle_redraw();
#endif
catacurses::refresh();
return 1;
}
} else if( query_yn( _( "Are you SURE you're finished?" ) ) ) {
Expand All @@ -1183,9 +1175,7 @@ int worldfactory::show_worldgen_tab_confirm( const catacurses::window &win, WORL

if( valid_worldname( worldname ) ) {
world->world_name = worldname;
#if defined(TILES) || defined(_WIN32)
handle_redraw();
#endif
catacurses::refresh();
return 1;
} else {
continue;
Expand Down

0 comments on commit f38c174

Please sign in to comment.