Skip to content

Commit

Permalink
GUI2/Loading Screen: renamed singleton member
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Aug 19, 2019
1 parent 63f0f04 commit e761acb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/gui/dialogs/loading_screen.cpp
Expand Up @@ -71,7 +71,7 @@ namespace dialogs
{
REGISTER_DIALOG(loading_screen)

loading_screen* loading_screen::current_load = nullptr;
loading_screen* loading_screen::singleton_ = nullptr;

loading_screen::loading_screen(std::function<void()> f)
: animation_counter_(0)
Expand All @@ -98,7 +98,7 @@ loading_screen::loading_screen(std::function<void()> f)
}

current_visible_stage_ = visible_stages_.end();
current_load = this;
singleton_ = this;
}

void loading_screen::pre_show(window& window)
Expand Down Expand Up @@ -140,8 +140,8 @@ void loading_screen::post_show(window& /*window*/)

void loading_screen::progress(loading_stage stage)
{
if(current_load && stage != loading_stage::none) {
current_load->current_stage_.store(stage, std::memory_order_release);
if(singleton_ && stage != loading_stage::none) {
singleton_->current_stage_.store(stage, std::memory_order_release);
}
}

Expand Down Expand Up @@ -197,14 +197,14 @@ loading_screen::~loading_screen()
#endif
}

current_load = nullptr;
singleton_ = nullptr;
}

void loading_screen::display(std::function<void()> f)
{
const bool use_loadingscreen_animation = !preferences::disable_loadingscreen_animation();

if(current_load || CVideo::get_singleton().faked()) {
if(singleton_ || CVideo::get_singleton().faked()) {
f();
} else if(use_loadingscreen_animation) {
loading_screen(f).show();
Expand Down
6 changes: 3 additions & 3 deletions src/gui/dialogs/loading_screen.hpp
Expand Up @@ -76,7 +76,7 @@ class loading_screen : public modal_dialog, public events::pump_monitor
~loading_screen();

static void display(std::function<void()> f);
static bool displaying() { return current_load != nullptr; }
static bool displaying() { return singleton_ != nullptr; }

static void progress(loading_stage stage = loading_stage::none);

Expand All @@ -99,6 +99,8 @@ class loading_screen : public modal_dialog, public events::pump_monitor
/** Callback to handle drawing the progress animation. */
void draw_callback();

static loading_screen* singleton_;

int animation_counter_;
std::function<void()> load_func_;
std::future<void> worker_result_;
Expand All @@ -109,8 +111,6 @@ class loading_screen : public modal_dialog, public events::pump_monitor
label* progress_stage_label_;
label* animation_label_;

static loading_screen* current_load;

std::atomic<loading_stage> current_stage_;

using stage_map = std::map<loading_stage, t_string>;
Expand Down

0 comments on commit e761acb

Please sign in to comment.