changeset 102:c85ea8988455

Re #123: Rollcall plugin won't re-add Game System on reload * Set up code so that we can warn when we get same ID but different object (ignore equal objects with duplicate IDs)
author IBBoard <dev@ibboard.co.uk>
date Sat, 15 Aug 2009 09:25:28 +0000
parents f7b9423c2a5a
children 3593d5d756ef
files api/WarFoundryLoader.cs
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/api/WarFoundryLoader.cs	Thu Aug 13 21:09:20 2009 +0000
+++ b/api/WarFoundryLoader.cs	Sat Aug 15 09:25:28 2009 +0000
@@ -485,7 +485,13 @@
 					
 			if (systemsTable.ContainsKey(sysid))
 			{
-				LogNotifier.WarnFormat(GetType(), "System {0} ({1}) has already been loaded. Duplicate file ({3}) discarded", system.Name, system.ID, system.SourceFile.FullName);
+				GameSystem existingSystem = systemsTable[sysid];
+				
+				if (!system.Equals(existingSystem))
+				{
+					//TODO: Raise an event to say we got a different duplicate
+					//We can't just fail, because failing is for completely unhandled files, not for objects in a file
+				}
 			}
 			else
 			{
@@ -519,11 +525,18 @@
 				subRaces = new Dictionary<string,Race>();
 				systemRaces.Add(race.ID.ToLower(), subRaces);
 			}
+			
+			string subID = race.SubID.ToLower();
 
-			if (subRaces.ContainsKey(race.SubID.ToLower()))
+			if (subRaces.ContainsKey(subID))
 			{
-				LogNotifier.WarnFormat(GetType(), "Race {0} ({1} - {2}) for system {3} ({4}) has already been loaded. Duplicate file ({5}) discarded", race.Name, race.ID, race.SubID, race.GameSystem.ID, race.GameSystem.Name, race.SourceFile.Name);
-				race = null;
+				Race existingRace = subRaces[subID];
+				
+				if (!race.Equals(existingRace))
+				{
+					//TODO: Raise an event to say we got a different duplicate
+					//We can't just fail, because failing is for completely unhandled files, not for objects in a file
+				}
 			}
 			else
 			{