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();
|
||||
}
|
||||
|
||||
bool cDialog::initCalled = false;
|
||||
|
||||
void cDialog::init(){
|
||||
cButton::init();
|
||||
cLed::init();
|
||||
cPict::init();
|
||||
cScrollbar::init();
|
||||
initCalled = true;
|
||||
}
|
||||
|
||||
cDialog::~cDialog(){
|
||||
|
@@ -69,10 +69,12 @@ class cDialog {
|
||||
template<typename Iter> void handleTabOrder(std::string& itemHit, Iter begin, Iter end);
|
||||
std::vector<std::pair<std::string,cTextField*>> tabOrder;
|
||||
static cDialog* topWindow; // Tracks the frontmost dialog.
|
||||
static bool initCalled;
|
||||
public:
|
||||
static void (*redraw_everything)();
|
||||
/// Performs essential startup initialization. Generally should not be called directly.
|
||||
static void init();
|
||||
static bool wasInitCalled() { return initCalled; };
|
||||
/// 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.
|
||||
/// The default background pattern for newly created dialogs.
|
||||
|
@@ -75,11 +75,9 @@ void cStrDlog::show(){
|
||||
dlg.run();
|
||||
}
|
||||
|
||||
extern bool finished_init;
|
||||
|
||||
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 (!finished_init) {
|
||||
if (!cDialog::wasInitCalled()) {
|
||||
std::cout << title << std::endl << str1 << std::endl << str2 << std::endl;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user