check for ui initialization without game-only global var
This commit is contained in:
@@ -460,11 +460,14 @@ void cDialog::recalcRect(){
|
|||||||
winRect.bottom *= ui_scale();
|
winRect.bottom *= ui_scale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cDialog::initCalled = false;
|
||||||
|
|
||||||
void cDialog::init(){
|
void cDialog::init(){
|
||||||
cButton::init();
|
cButton::init();
|
||||||
cLed::init();
|
cLed::init();
|
||||||
cPict::init();
|
cPict::init();
|
||||||
cScrollbar::init();
|
cScrollbar::init();
|
||||||
|
initCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cDialog::~cDialog(){
|
cDialog::~cDialog(){
|
||||||
|
|||||||
@@ -69,10 +69,12 @@ class cDialog {
|
|||||||
template<typename Iter> void handleTabOrder(std::string& itemHit, Iter begin, Iter end);
|
template<typename Iter> void handleTabOrder(std::string& itemHit, Iter begin, Iter end);
|
||||||
std::vector<std::pair<std::string,cTextField*>> tabOrder;
|
std::vector<std::pair<std::string,cTextField*>> tabOrder;
|
||||||
static cDialog* topWindow; // Tracks the frontmost dialog.
|
static cDialog* topWindow; // Tracks the frontmost dialog.
|
||||||
|
static bool initCalled;
|
||||||
public:
|
public:
|
||||||
static void (*redraw_everything)();
|
static void (*redraw_everything)();
|
||||||
/// Performs essential startup initialization. Generally should not be called directly.
|
/// Performs essential startup initialization. Generally should not be called directly.
|
||||||
static void init();
|
static void init();
|
||||||
|
static bool wasInitCalled() { return initCalled; };
|
||||||
/// The light background pattern used by the scenario editor dialogs.
|
/// The light background pattern used by the scenario editor dialogs.
|
||||||
static const short BG_LIGHT, BG_DARK; ///< The dark background pattern used by the game dialogs.
|
static const short BG_LIGHT, BG_DARK; ///< The dark background pattern used by the game dialogs.
|
||||||
/// The default background pattern for newly created dialogs.
|
/// The default background pattern for newly created dialogs.
|
||||||
|
|||||||
@@ -75,11 +75,9 @@ void cStrDlog::show(){
|
|||||||
dlg.run();
|
dlg.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool finished_init;
|
|
||||||
|
|
||||||
static void giveError(pic_num_t pic, std::string title, std::string str1, std::string str2, cDialog* parent) {
|
static void giveError(pic_num_t pic, std::string title, std::string str1, std::string str2, cDialog* parent) {
|
||||||
// If giveError() is called before UI is initialized, print to console
|
// If giveError() is called before UI is initialized, print to console
|
||||||
if (!finished_init) {
|
if (!cDialog::wasInitCalled()) {
|
||||||
std::cout << title << std::endl << str1 << std::endl << str2 << std::endl;
|
std::cout << title << std::endl << str1 << std::endl << str2 << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user