diff --git a/src/editor/C4Console.cpp b/src/editor/C4Console.cpp index 0b751ef14..ff71a1496 100644 --- a/src/editor/C4Console.cpp +++ b/src/editor/C4Console.cpp @@ -62,7 +62,9 @@ C4Console::~C4Console() C4Window * C4Console::Init(C4AbstractApp * pApp) { - return C4ConsoleGUI::CreateConsoleWindow(pApp); + if (!C4ConsoleGUI::CreateConsoleWindow(pApp)) + return NULL; + return this; } bool C4Console::In(const char *szText) @@ -613,10 +615,12 @@ bool C4ConsoleGUI::ClearLog() {return 0;} void C4ConsoleGUI::ClearNetMenu() {} void C4ConsoleGUI::ClearPlayerMenu() {} void C4ConsoleGUI::ClearViewportMenu() {} -C4Window * C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp * pApp) +bool C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp * pApp) { C4Rect r(0, 0, 400, 350); - return C4Window::Init(C4Window::W_Console, pApp, LoadResStr("IDS_CNS_CONSOLE"), &r); + if (!C4Window::Init(C4Window::W_Console, pApp, LoadResStr("IDS_CNS_CONSOLE"), &r)) + return false; + return true; } void C4ConsoleGUI::DisplayInfoText(C4ConsoleGUI::InfoTextType, StdStrBuf&) {} void C4ConsoleGUI::DoEnableControls(bool) {} diff --git a/src/editor/C4ConsoleCocoa.mm b/src/editor/C4ConsoleCocoa.mm index aa768d8f3..bff9da756 100644 --- a/src/editor/C4ConsoleCocoa.mm +++ b/src/editor/C4ConsoleCocoa.mm @@ -63,14 +63,14 @@ public: void Clear() {} }; -C4Window* C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp *application) +bool C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp *application) { C4WindowController* controller = [C4EditorWindowController new]; setObjectiveCObject(controller); [NSBundle loadNibNamed:@"Editor" owner:controller]; [controller setStdWindow:this]; this->Active = true; - return this; + return true; } void C4ConsoleGUI::Out(const char* message) diff --git a/src/editor/C4ConsoleGUI.h b/src/editor/C4ConsoleGUI.h index bd6519128..2a6492072 100644 --- a/src/editor/C4ConsoleGUI.h +++ b/src/editor/C4ConsoleGUI.h @@ -122,7 +122,7 @@ public: void ClearPlayerMenu(); void SetInputFunctions(std::list &functions); - C4Window* CreateConsoleWindow(C4AbstractApp *application); + bool CreateConsoleWindow(C4AbstractApp *application); void Out(const char* message); bool ClearLog(); void DisplayInfoText(InfoTextType type, StdStrBuf& text); diff --git a/src/editor/C4ConsoleQt.cpp b/src/editor/C4ConsoleQt.cpp index 24baef3bc..e0533c8c9 100644 --- a/src/editor/C4ConsoleQt.cpp +++ b/src/editor/C4ConsoleQt.cpp @@ -82,12 +82,12 @@ void C4ConsoleGUI::SetInputFunctions(std::list &functions) if (Active) state->SetInputFunctions(functions); } -C4Window* C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp *application) +bool C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp *application) { - if (!state->CreateConsoleWindow(application)) return NULL; + if (!state->CreateConsoleWindow(application)) return false; Active = true; EnableControls(fGameOpen); - return this; + return true; } void C4ConsoleGUI::Out(const char* message) diff --git a/src/editor/C4ConsoleWin32.cpp b/src/editor/C4ConsoleWin32.cpp index ddcbda6d9..0cb0f67c5 100644 --- a/src/editor/C4ConsoleWin32.cpp +++ b/src/editor/C4ConsoleWin32.cpp @@ -783,7 +783,7 @@ bool C4ConsoleGUI::UpdateModeCtrls(int iMode) return true; } -C4Window* C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp *application) +bool C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp *application) { hWindow = CreateDialog(application->GetInstance(), MAKEINTRESOURCE(IDD_CONSOLE), NULL, ConsoleDlgProc); if (!hWindow) @@ -802,7 +802,7 @@ C4Window* C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp *application) Log(FormatString("Error creating dialog window: %s", StdStrBuf(lpMsgBuf).getData()).getData()); // Free the buffer. LocalFree(lpMsgBuf); - return NULL; + return false; } // Remember metrics state->console_handle = hWindow; @@ -827,7 +827,7 @@ C4Window* C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp *application) ShowCursor(true); renderwnd = hWindow; // Success - return this; + return true; } void C4ConsoleGUI::DoEnableControls(bool fEnable)