Skip to content

Commit

Permalink
Do not fail to load a savegame if we do not use wzscript.
Browse files Browse the repository at this point in the history
  • Loading branch information
perim committed Dec 20, 2017
1 parent 2999513 commit f093075
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/script/eventsave.cpp
Expand Up @@ -142,12 +142,6 @@ static bool eventLoadContext(WzConfig &ini)
// get the number of contexts in the save file
numContext = ini.value("general/contexts", 0).toInt();

if (numContext == 0)
{
debug(LOG_FATAL, "No script contexts found -- failed to load script data");
return false;
}

// go through the contexts
for (int context = 0; context < numContext; context++)
{
Expand Down Expand Up @@ -355,6 +349,11 @@ bool eventSaveState(const char *pFilename)
bool eventLoadState(const char *pFilename)
{
WzConfig ini(pFilename, WzConfig::ReadOnly);
// see if we actually use wzscript anymore
if (ini.value("general/contexts", 0).toInt() == 0)
{
return true; // not a bug
}
// load the event contexts
if (!eventLoadContext(ini) || !eventLoadTriggerList(ini, "trig") || !eventLoadTriggerList(ini, "callback"))
{
Expand Down

0 comments on commit f093075

Please sign in to comment.