diff --git a/library/Core.cpp b/library/Core.cpp index 4b036a83e..8d632e107 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -1471,6 +1471,10 @@ std::string Core::getHackPath() #endif } +df::viewscreen * Core::getTopViewscreen() { + return getInstance().top_viewscreen; +} + bool Core::InitMainThread() { Filesystem::init(); @@ -1855,6 +1859,11 @@ void *Core::GetData( std::string key ) } } +Core& Core::getInstance() { + static Core instance; + return instance; +} + bool Core::isSuspended(void) { return ownerThread.load() == std::this_thread::get_id(); diff --git a/library/include/Core.h b/library/include/Core.h index a574b029a..a41aff927 100644 --- a/library/include/Core.h +++ b/library/include/Core.h @@ -125,11 +125,7 @@ namespace DFHack friend bool ::dfhooks_ncurses_key(int key); public: /// Get the single Core instance or make one. - static Core& getInstance() - { - static Core instance; - return instance; - } + static Core& getInstance(); /// check if the activity lock is owned by this thread bool isSuspended(void); /// Is everything OK? @@ -177,7 +173,7 @@ namespace DFHack bool isWorldLoaded() { return (last_world_data_ptr != NULL); } bool isMapLoaded() { return (last_local_map_ptr != NULL && last_world_data_ptr != NULL); } - static df::viewscreen *getTopViewscreen() { return getInstance().top_viewscreen; } + static df::viewscreen *getTopViewscreen(); DFHack::Console &getConsole() { return con; } diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 39f600bbf..102fef9d6 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -1709,7 +1709,7 @@ bool Gui::autoDFAnnouncement(df::report_init r, string message) if (a_flags.bits.D_DISPLAY) { world->status.display_timer = r.display_timer; - Gui::writeToGamelog("x" + to_string(repeat_count + 1)); + Gui::writeToGamelog('x' + to_string(repeat_count + 1)); } DEBUG(gui).print("Announcement succeeded as repeat:\n%s\n", message.c_str()); return true;