Basic content sanity checks and exit w/o crashing on check failure

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3572 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2011-02-28 20:02:38 +00:00
parent f379f533cf
commit a12d306b8b
3 changed files with 11 additions and 6 deletions
-2
View File
@@ -477,8 +477,6 @@ main (int argc, char *argv[])
mem_uninit ();
}
log_showBox (false, false);
return EXIT_SUCCESS;
}
+4 -1
View File
@@ -110,7 +110,8 @@ LoadKernel (int argc, char *argv[])
return FALSE;
/* Load base content. */
loadIndices (contentDir);
if (loadIndices (contentDir) == 0)
return FALSE; // Must have at least one index in content dir
/* Load addons demanded by the current configuration. */
if (opt3doMusic)
@@ -139,6 +140,8 @@ LoadKernel (int argc, char *argv[])
COLORMAP ColorMapTab;
ColorMapTab = CaptureColorMap (LoadColorMap (STARCON_COLOR_MAP));
if (ColorMapTab == NULL)
return FALSE; // The most basic resource is missing
SetColorMap (GetColorMapAddress (ColorMapTab));
DestroyColorMap (ReleaseColorMap (ColorMapTab));
}
+7 -3
View File
@@ -177,10 +177,13 @@ while (--ac > 0)
if (!LoadKernel (0,0))
{
log_add (log_Fatal, "\n *** FATAL ERROR: Could not load basic content ***\n\nUQM requires at least the base content pack to run properly.");
log_add (log_Fatal, "This file is typically called uqm-%d.%d.0.uqm. UQM was expecting it", UQM_MAJOR_VERSION, UQM_MINOR_VERSION);
log_add (log_Fatal, "in the %s/packages directory.", baseContentPath);
log_add (log_Fatal, "This file is typically called uqm-%d.%d.0-content.uqm. UQM was expecting", UQM_MAJOR_VERSION, UQM_MINOR_VERSION);
log_add (log_Fatal, "it in the %s/packages directory.", baseContentPath);
log_add (log_Fatal, "Either your installation did not install the content pack at all, or it\ninstalled it in a different directory.\n\nFix your installation and rerun UQM.\n\n *******************\n");
exit (EXIT_FAILURE);
log_showBox (true, true);
MainExited = TRUE;
return EXIT_FAILURE;
}
log_add (log_Info, "We've loaded the Kernel");
@@ -300,6 +303,7 @@ while (--ac > 0)
FreeMasterShipList ();
FreeKernel ();
log_showBox (false, false);
MainExited = TRUE;
(void) threadArg; /* Satisfying compiler (unused parameter) */