Changed: #877 World editor crashes on launch ...

This commit is contained in:
kervala 2010-05-11 11:10:51 +02:00
parent ad6a1e6888
commit 0e97acfacf
3 changed files with 132 additions and 51 deletions

View file

@ -468,12 +468,19 @@ void CMainFrame::onLogicChanged(const std::vector<NLLIGO::CPrimRegion*> &regions
bool CMainFrame::yesNoMessage (const char *format, ... ) bool CMainFrame::yesNoMessage (const char *format, ... )
{ {
// Make a buffer string char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
return theApp.yesNoMessage (buffer); return theApp.yesNoMessage (buffer);
} }
@ -482,12 +489,19 @@ bool CMainFrame::yesNoMessage (const char *format, ... )
void CMainFrame::errorMessage (const char *format, ... ) void CMainFrame::errorMessage (const char *format, ... )
{ {
// Make a buffer string char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
theApp.errorMessage (buffer); theApp.errorMessage (buffer);
} }
@ -496,12 +510,19 @@ void CMainFrame::errorMessage (const char *format, ... )
void CMainFrame::infoMessage (const char *format, ... ) void CMainFrame::infoMessage (const char *format, ... )
{ {
// Make a buffer string char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
theApp.infoMessage (buffer); theApp.infoMessage (buffer);
} }

View file

@ -430,47 +430,76 @@ void CWorldEditorApp::OnAppAbout()
bool CWorldEditorApp::yesNoMessage (const char *format, ... ) bool CWorldEditorApp::yesNoMessage (const char *format, ... )
{ {
// Make a buffer string char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
return MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_YESNO|MB_ICONQUESTION) == IDYES; return MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_YESNO|MB_ICONQUESTION) == IDYES;
} }
void CWorldEditorApp::errorMessage (const char *format, ... ) void CWorldEditorApp::errorMessage (const char *format, ... )
{ {
// Make a buffer string char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_OK|MB_ICONEXCLAMATION); MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_OK|MB_ICONEXCLAMATION);
} }
void CWorldEditorApp::infoMessage (const char *format, ... ) void CWorldEditorApp::infoMessage (const char *format, ... )
{ {
// Make a buffer string char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_OK|MB_ICONINFORMATION); MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_OK|MB_ICONINFORMATION);
} }
void CWorldEditorApp::syntaxError (const char *filename, xmlNodePtr xmlNode, const char *format, ...) void CWorldEditorApp::syntaxError (const char *filename, xmlNodePtr xmlNode, const char *format, ...)
{ {
char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
errorMessage ("(%s), node (%s), line (%d) :\n%s", filename, xmlNode->name, (int)xmlNode->content, buffer); errorMessage ("(%s), node (%s), line (%d) :\n%s", filename, xmlNode->name, (int)xmlNode->content, buffer);
} }
@ -784,12 +813,19 @@ CNoInteraction::~CNoInteraction ()
void CMyLigoConfig::errorMessage (const char *format, ... ) void CMyLigoConfig::errorMessage (const char *format, ... )
{ {
// Make a buffer string char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
theApp.errorMessage (buffer); theApp.errorMessage (buffer);
} }

View file

@ -1093,11 +1093,19 @@ void CPlugin::postRender(CDisplay &display)
bool CPlugin::yesNoMessage (const char *format, ... ) bool CPlugin::yesNoMessage (const char *format, ... )
{ {
char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
return _PluginAccess->yesNoMessage ("Plugin AI : %s", buffer); return _PluginAccess->yesNoMessage ("Plugin AI : %s", buffer);
} }
@ -1106,11 +1114,19 @@ bool CPlugin::yesNoMessage (const char *format, ... )
void CPlugin::errorMessage (const char *format, ... ) void CPlugin::errorMessage (const char *format, ... )
{ {
char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
_PluginAccess->errorMessage ("Plugin AI : %s", buffer); _PluginAccess->errorMessage ("Plugin AI : %s", buffer);
} }
@ -1119,11 +1135,19 @@ void CPlugin::errorMessage (const char *format, ... )
void CPlugin::infoMessage (const char *format, ... ) void CPlugin::infoMessage (const char *format, ... )
{ {
char buffer[1024];
if (format)
{
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
char buffer[1024];
sint ret = vsnprintf( buffer, 1024, format, args ); sint ret = vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
}
else
{
strcpy(buffer, "Unknown error");
}
_PluginAccess->infoMessage ("Plugin AI : %s", buffer); _PluginAccess->infoMessage ("Plugin AI : %s", buffer);
} }