forked from Mirrors/openclonk
Change return type of CreateConsoleWindow to bool
All implementations were just returning `this` anyway, and this makes it easier to add a corresponding cleanup function.console-destruction
parent
836927d93c
commit
a56d2fecdb
|
@ -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) {}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
void ClearPlayerMenu();
|
||||
void SetInputFunctions(std::list<const char*> &functions);
|
||||
|
||||
C4Window* CreateConsoleWindow(C4AbstractApp *application);
|
||||
bool CreateConsoleWindow(C4AbstractApp *application);
|
||||
void Out(const char* message);
|
||||
bool ClearLog();
|
||||
void DisplayInfoText(InfoTextType type, StdStrBuf& text);
|
||||
|
|
|
@ -82,12 +82,12 @@ void C4ConsoleGUI::SetInputFunctions(std::list<const char*> &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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue