From a6f1fd5ac67993d84de03f66b96f2e88353b9db4 Mon Sep 17 00:00:00 2001
From: Stijn Buys <ingar@osirion.org>
Date: Sun, 23 Nov 2014 23:07:48 +0000
Subject: Enforce reciprocal reputation.

---
 src/game/base/faction.cc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'src/game')

diff --git a/src/game/base/faction.cc b/src/game/base/faction.cc
index 07c0a3a..2afa0b0 100644
--- a/src/game/base/faction.cc
+++ b/src/game/base/faction.cc
@@ -198,6 +198,20 @@ bool Faction::init()
 			}
 		}
 	}
+	
+	// enforce reciprocal reputation
+	for (core::Info::Registry::iterator it = core::Info::registry().begin(); it != core::Info::registry().end(); it++) {
+		core::Info *info = (*it);
+		
+		if (info->type() == faction_infotype) {
+			faction = static_cast<Faction *>(info);
+			
+			for (core::Reputation::FactionReps::iterator rip = faction->reputation().factionreps().begin(); rip != faction->reputation().factionreps().end(); ++rip) {
+				Faction *otherfaction = Faction::find((*rip)->faction()->label());
+				otherfaction->reputation().set_reputation(faction, (*rip)->reputation());
+			}
+		}
+	}
 
 	con_debug << "  " << inifile.name() << " " << count << " factions" << std::endl;
 	
-- 
cgit v1.2.3