Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-10 19:20:06 +0000
committerStijn Buys <ingar@osirion.org>2013-11-10 19:20:06 +0000
commit5eaf6cc1f9ab772139a2dbe6d325a7ab9879e01b (patch)
tree5a6308ebee73df40e8f447213d7b5656e11e3210 /src/game
parentcf2d30145dea77a1b27f04f07a7a58184cf72c37 (diff)
Prevent player reputation for the 'default' faction from getting loaded from savegame.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/faction.h20
-rw-r--r--src/game/base/savegame.cc2
2 files changed, 21 insertions, 1 deletions
diff --git a/src/game/base/faction.h b/src/game/base/faction.h
index 3f6a1e5..551ce7b 100644
--- a/src/game/base/faction.h
+++ b/src/game/base/faction.h
@@ -84,6 +84,9 @@ public:
*/
static bool init();
+ /**
+ * @brief cleanup routines
+ */
static void done();
/**
@@ -91,6 +94,9 @@ public:
*/
static void list();
+ /**
+ * @brief returns a pointer to the faction with the given label, returns 0 if not found.
+ * */
static Faction *find(const std::string & label);
/**
@@ -98,11 +104,23 @@ public:
* */
static void apply_default(core::Reputation & reputation);
-
+ /**
+ * @brief faction info type
+ * */
static inline const core::InfoType *infotype() {
return faction_infotype;
}
+ /**
+ * @brief default faction
+ * This faction represents the default player reputation.
+ * No ships should be a member of this faction, not even player ships.
+ * */
+ static inline const Faction *default_faction()
+ {
+ return faction_default;
+ }
+
private:
/* --- attributes ------------------------------------------------- */
diff --git a/src/game/base/savegame.cc b/src/game/base/savegame.cc
index 90b7956..28f0ddb 100644
--- a/src/game/base/savegame.cc
+++ b/src/game/base/savegame.cc
@@ -99,6 +99,8 @@ void SaveGame::load_game(core::Player *player, filesystem::IniFile & inifile)
} else if (inifile.got_key_float("reputation", reputation)) {
if (!faction) {
inifile.unknown_error("reputation without faction");
+ } else if (faction == Faction::default_faction()) {
+ inifile.unknown_error("ignoring reputation for default faction");
} else {
player->reputation().set_reputation(faction, reputation);
}