summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-03-29 15:17:30 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-03-29 15:17:30 (GMT)
commit289556ac7078963b6af361f5812dd62e6712359f (patch)
tree77bfff7d8594fcefe1220a0789dd69af58a48a25 /src/game
parent1f388e4ca02f0a84e4b9d9b19e6308224389818d (diff)
downloadpowder-289556ac7078963b6af361f5812dd62e6712359f.zip
powder-289556ac7078963b6af361f5812dd62e6712359f.tar.gz
Replace Error notification with exception for Tags model
Diffstat (limited to 'src/game')
-rw-r--r--src/game/GameController.cpp4
-rw-r--r--src/game/GameModel.cpp4
-rw-r--r--src/game/GameModelException.h26
3 files changed, 30 insertions, 4 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index e5c3013..7b08716 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -10,7 +10,7 @@
#include "login/LoginController.h"
#include "interface/Point.h"
#include "dialogues/ErrorMessage.h"
-#include "SaveLoadException.h"
+#include "GameModelException.h"
using namespace std;
@@ -39,7 +39,7 @@ public:
{
cc->gameModel->SetSave(new Save(*(cc->search->GetLoadedSave())));
}
- catch(SaveLoadException & ex)
+ catch(GameModelException & ex)
{
new ErrorMessage("Cannot open save", ex.what());
}
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index a1d6b8b..0106dd7 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -8,7 +8,7 @@
#include "EllipseBrush.h"
#include "client/Client.h"
#include "game/DecorationTool.h"
-#include "SaveLoadException.h"
+#include "GameModelException.h"
GameModel::GameModel():
activeTools({NULL, NULL, NULL}),
@@ -262,7 +262,7 @@ void GameModel::SetSave(Save * newSave)
if(returnVal){
delete currentSave;
currentSave = NULL;
- throw SaveLoadException(returnVal==2?"Save from newer version":"Save data corrupt");
+ throw GameModelException(returnVal==2?"Save from newer version":"Save data corrupt");
}
}
notifySaveChanged();
diff --git a/src/game/GameModelException.h b/src/game/GameModelException.h
new file mode 100644
index 0000000..05138f2
--- /dev/null
+++ b/src/game/GameModelException.h
@@ -0,0 +1,26 @@
+/*
+ * SaveLoadException.h
+ *
+ * Created on: Mar 29, 2012
+ * Author: Simon
+ */
+
+#ifndef SAVELOADEXCEPTION_H_
+#define SAVELOADEXCEPTION_H_
+
+#include <string>
+#include <exception>
+using namespace std;
+
+struct GameModelException: public exception {
+ string message;
+public:
+ GameModelException(string message_): message(message_) {}
+ const char * what() const throw()
+ {
+ return message.c_str();
+ }
+ ~GameModelException() throw() {};
+};
+
+#endif /* SAVELOADEXCEPTION_H_ */