Index: binaries/data/mods/public/simulation/helpers/InitSavedGame.js
===================================================================
--- binaries/data/mods/public/simulation/helpers/InitSavedGame.js	(révision 13897)
+++ binaries/data/mods/public/simulation/helpers/InitSavedGame.js	(copie de travail)
@@ -1,21 +0,0 @@
-function InitSavedGame()
-{
-	// This will be called after the map settings have been loaded,
-	// before the simulation has started.
-	// This is only called at the start of a saved game, not when loading
-	// a new game.
-
-	// rebuild the RallyPointRenderers from the RallyPoints info
-	var rallyPoints = Engine.GetEntitiesWithInterface(IID_RallyPoint);
-	for each (var ent in rallyPoints)
-	{
-		var cmpRallyPointRenderer = Engine.QueryInterface(ent, IID_RallyPointRenderer);
-		if (!cmpRallyPointRenderer)
-			continue;
-		var positions = Engine.QueryInterface(ent, IID_RallyPoint).GetPositions();
-		for each (var pos in positions)
-			cmpRallyPointRenderer.AddPosition({'x': pos.x, 'y': pos.z});
-	}
-}
-
-Engine.RegisterGlobal("InitSavedGame", InitSavedGame);
Index: binaries/data/mods/public/simulation/components/GuiInterface.js
===================================================================
--- binaries/data/mods/public/simulation/components/GuiInterface.js	(révision 13897)
+++ binaries/data/mods/public/simulation/components/GuiInterface.js	(copie de travail)
@@ -848,6 +848,11 @@
 				cmpRallyPointRenderer.AddPosition({'x': pos.x, 'y': pos.z}); // AddPosition takes a CFixedVector2D which has X/Y components, not X/Z
 			else if (cmd.queued == false)
 				cmpRallyPointRenderer.SetPosition({'x': pos.x, 'y': pos.z}); // SetPosition takes a CFixedVector2D which has X/Y components, not X/Z
+			// rebuild the renderer when not set (when reading saved game or in case of building update)
+			else if (!cmpRallyPointRenderer.IsSet())
+				for each (var posi in cmpRallyPoint.GetPositions())
+					cmpRallyPointRenderer.AddPosition({'x': posi.x, 'y': posi.z});
+
 			cmpRallyPointRenderer.SetDisplayed(true);
 			
 			// remember which entities have their rally points displayed so we can hide them again
Index: binaries/data/mods/public/simulation/components/Foundation.js
===================================================================
--- binaries/data/mods/public/simulation/components/Foundation.js	(révision 13897)
+++ binaries/data/mods/public/simulation/components/Foundation.js	(copie de travail)
@@ -277,13 +277,10 @@
 		{
 			var rallyCoords = cmpRallyPoint.GetPositions();
 			var rallyData = cmpRallyPoint.GetData();
-			var cmpBuildingRallyPointRenderer = Engine.QueryInterface(building, IID_RallyPointRenderer);
 			for (var i = 0; i < rallyCoords.length; ++i)
 			{
 				cmpBuildingRallyPoint.AddPosition(rallyCoords[i].x, rallyCoords[i].z);
 				cmpBuildingRallyPoint.AddData(rallyData[i]);
-				if (cmpBuildingRallyPointRenderer)
-					cmpBuildingRallyPointRenderer.AddPosition({'x': rallyCoords[i].x, 'y': rallyCoords[i].z});
 			}
 		}
 
Index: source/ps/Game.cpp
===================================================================
--- source/ps/Game.cpp	(révision 13897)
+++ source/ps/Game.cpp	(copie de travail)
@@ -195,17 +195,13 @@
  **/
 PSRETURN CGame::ReallyStartGame()
 {
-	// Call the script function InitGame only for new games, and InitSavedGame for saved games
+	// Call the script function InitGame only for new games, not saved games
 	if (!m_IsSavedGame)
 	{
 		CScriptVal settings;
 		m_Simulation2->GetScriptInterface().GetProperty(m_Simulation2->GetInitAttributes().get(), "settings", settings);
 		m_Simulation2->InitGame(settings);
 	}
-	else
-	{
-		m_Simulation2->InitSavedGame();
-	}
 
 	// We need to do an initial Interpolate call to set up all the models etc,
 	// because Update might never interpolate (e.g. if the game starts paused)
Index: source/simulation2/Simulation2.h
===================================================================
--- source/simulation2/Simulation2.h	(révision 13897)
+++ source/simulation2/Simulation2.h	(copie de travail)
@@ -150,10 +150,8 @@
 	 * Initialise a new game, based on some script data. (Called on CGame instantiation)
 	 * (This mustn't be used when e.g. loading saved games, only when starting new ones.)
 	 * This calls the InitGame function defined in helpers/InitGame.js.
-	 * Saved games are initialized with InitSavedGame.
 	 */
 	void InitGame(const CScriptVal& data);
-	void InitSavedGame();
 
 	void Update(int turnLength);
 	void Update(int turnLength, const std::vector<SimulationCommand>& commands);
Index: source/simulation2/components/CCmpRallyPointRenderer.cpp
===================================================================
--- source/simulation2/components/CCmpRallyPointRenderer.cpp	(révision 13897)
+++ source/simulation2/components/CCmpRallyPointRenderer.cpp	(copie de travail)
@@ -299,6 +299,14 @@
 		RecomputeAllRallyPointPaths();
 	}
 
+	/**
+	 * Returns true if at least one display rally point is set; i.e., if we have a point to render our marker/line at.
+	 */
+	bool IsSet()
+	{
+		return !m_RallyPoints.empty();
+	}
+
 private:
 
 	/**
@@ -316,14 +324,6 @@
 	}
 
 	/**
-	 * Returns true iff at least one display rally point is set; i.e., if we have a point to render our marker/line at.
-	 */
-	bool IsSet()
-	{
-		return !m_RallyPoints.empty();
-	}
-
-	/**
 	 * Repositions the rally point markers; moves them outside of the world (ie. hides them), or positions them at the currently
 	 * set rally points. Also updates the actor's variation according to the entity's current owning player's civilization.
 	 * 
Index: source/simulation2/components/ICmpRallyPointRenderer.h
===================================================================
--- source/simulation2/components/ICmpRallyPointRenderer.h	(révision 13897)
+++ source/simulation2/components/ICmpRallyPointRenderer.h	(copie de travail)
@@ -44,6 +44,9 @@
 	/// Reset the positions of this rally point marker
 	virtual void Reset() = 0;
 
+	/// Returns true if at least one display rally point is set
+	virtual bool IsSet() = 0;
+
 	DECLARE_INTERFACE_TYPE(RallyPointRenderer)
 };
 
Index: source/simulation2/components/ICmpRallyPointRenderer.cpp
===================================================================
--- source/simulation2/components/ICmpRallyPointRenderer.cpp	(révision 13897)
+++ source/simulation2/components/ICmpRallyPointRenderer.cpp	(copie de travail)
@@ -27,4 +27,5 @@
 DEFINE_INTERFACE_METHOD_1("SetPosition", void, ICmpRallyPointRenderer, SetPosition, CFixedVector2D)
 DEFINE_INTERFACE_METHOD_1("AddPosition", void, ICmpRallyPointRenderer, AddPosition_wrapper, CFixedVector2D)
 DEFINE_INTERFACE_METHOD_0("Reset", void, ICmpRallyPointRenderer, Reset)
+DEFINE_INTERFACE_METHOD_0("IsSet", bool, ICmpRallyPointRenderer, IsSet)
 END_INTERFACE_WRAPPER(RallyPointRenderer)
Index: source/simulation2/Simulation2.cpp
===================================================================
--- source/simulation2/Simulation2.cpp	(révision 13897)
+++ source/simulation2/Simulation2.cpp	(copie de travail)
@@ -652,11 +652,6 @@
 	GetScriptInterface().CallFunctionVoid(GetScriptInterface().GetGlobalObject(), "InitGame", data);
 }
 
-void CSimulation2::InitSavedGame()
-{
-	GetScriptInterface().CallFunctionVoid(GetScriptInterface().GetGlobalObject(), "InitSavedGame");
-}
-
 void CSimulation2::Update(int turnLength)
 {
 	std::vector<SimulationCommand> commands;
