summaryrefslogtreecommitdiff
path: root/src/game/GameModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/GameModel.cpp')
-rw-r--r--src/game/GameModel.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index 85f4249..a1d6b8b 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -8,6 +8,7 @@
#include "EllipseBrush.h"
#include "client/Client.h"
#include "game/DecorationTool.h"
+#include "SaveLoadException.h"
GameModel::GameModel():
activeTools({NULL, NULL, NULL}),
@@ -257,7 +258,12 @@ void GameModel::SetSave(Save * newSave)
currentSave = newSave;
if(currentSave)
{
- sim->Load(currentSave->GetData(), currentSave->GetDataLength());
+ int returnVal = sim->Load(currentSave->GetData(), currentSave->GetDataLength());
+ if(returnVal){
+ delete currentSave;
+ currentSave = NULL;
+ throw SaveLoadException(returnVal==2?"Save from newer version":"Save data corrupt");
+ }
}
notifySaveChanged();
notifyPausedChanged();