Index: binaries/data/mods/public/simulation/helpers/Commands.js
===================================================================
--- binaries/data/mods/public/simulation/helpers/Commands.js	(révision 13824)
+++ binaries/data/mods/public/simulation/helpers/Commands.js	(copie de travail)
@@ -296,7 +296,7 @@
 		{
 			var cmpRallyPoint = Engine.QueryInterface(ent, IID_RallyPoint);
 			if (cmpRallyPoint)
-				cmpRallyPoint.Unset();
+				cmpRallyPoint.Reset();
 		}
 		break;
 
Index: binaries/data/mods/public/simulation/helpers/InitSavedGame.js
===================================================================
--- binaries/data/mods/public/simulation/helpers/InitSavedGame.js	(révision 0)
+++ binaries/data/mods/public/simulation/helpers/InitSavedGame.js	(copie de travail)
@@ -0,0 +1,21 @@
+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 13824)
+++ binaries/data/mods/public/simulation/components/GuiInterface.js	(copie de travail)
@@ -20,7 +20,6 @@
 	this.placementEntity = undefined; // = undefined or [templateName, entityID]
 	this.placementWallEntities = undefined;
 	this.placementWallLastAngle = 0;
-	this.rallyPoints = undefined;
 	this.notifications = [];
 	this.renamedEntities = [];
 };
Index: binaries/data/mods/public/simulation/components/RallyPoint.js
===================================================================
--- binaries/data/mods/public/simulation/components/RallyPoint.js	(révision 13824)
+++ binaries/data/mods/public/simulation/components/RallyPoint.js	(copie de travail)
@@ -43,4 +43,12 @@
 	this.data = [];
 };
 
+RallyPoint.prototype.Reset = function()
+{
+	this.Unset();
+	var cmpRallyPointRenderer = Engine.QueryInterface(this.entity, IID_RallyPointRenderer);
+	if (cmpRallyPointRenderer)
+		cmpRallyPointRenderer.Reset();
+};
+
 Engine.RegisterComponentType(IID_RallyPoint, "RallyPoint", RallyPoint);
Index: source/simulation2/components/ICmpRallyPointRenderer.cpp
===================================================================
--- source/simulation2/components/ICmpRallyPointRenderer.cpp	(révision 13824)
+++ source/simulation2/components/ICmpRallyPointRenderer.cpp	(copie de travail)
@@ -26,4 +26,5 @@
 DEFINE_INTERFACE_METHOD_1("SetDisplayed", void, ICmpRallyPointRenderer, SetDisplayed, bool)
 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)
 END_INTERFACE_WRAPPER(RallyPointRenderer)
Index: source/simulation2/components/CCmpRallyPointRenderer.cpp
===================================================================
--- source/simulation2/components/CCmpRallyPointRenderer.cpp	(révision 13824)
+++ source/simulation2/components/CCmpRallyPointRenderer.cpp	(copie de travail)
@@ -293,6 +293,12 @@
 		}
 	}
 
+	virtual void Reset()
+	{
+		m_RallyPoints.clear();
+		RecomputeAllRallyPointPaths();
+	}
+
 private:
 
 	/**
Index: source/simulation2/components/ICmpRallyPointRenderer.h
===================================================================
--- source/simulation2/components/ICmpRallyPointRenderer.h	(révision 13824)
+++ source/simulation2/components/ICmpRallyPointRenderer.h	(copie de travail)
@@ -41,6 +41,9 @@
 	/// to the previous one.
 	virtual void AddPosition_wrapper(CFixedVector2D position) = 0;
 
+	/// Reset the positions of this rally point marker
+	virtual void Reset() = 0;
+
 	DECLARE_INTERFACE_TYPE(RallyPointRenderer)
 };
 
Index: source/simulation2/Simulation2.cpp
===================================================================
--- source/simulation2/Simulation2.cpp	(révision 13824)
+++ source/simulation2/Simulation2.cpp	(copie de travail)
@@ -649,6 +649,11 @@
 	GetScriptInterface().CallFunctionVoid(GetScriptInterface().GetGlobalObject(), "InitGame", data);
 }
 
+void CSimulation2::InitSavedGame()
+{
+	GetScriptInterface().CallFunctionVoid(GetScriptInterface().GetGlobalObject(), "InitSavedGame");
+}
+
 void CSimulation2::Update(int turnLength)
 {
 	std::vector<SimulationCommand> commands;
Index: source/simulation2/Simulation2.h
===================================================================
--- source/simulation2/Simulation2.h	(révision 13824)
+++ source/simulation2/Simulation2.h	(copie de travail)
@@ -150,8 +150,10 @@
 	 * 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/ps/Game.cpp
===================================================================
--- source/ps/Game.cpp	(révision 13824)
+++ source/ps/Game.cpp	(copie de travail)
@@ -195,13 +195,17 @@
  **/
 PSRETURN CGame::ReallyStartGame()
 {
-	// Call the script function InitGame only for new games, not saved games
+	// Call the script function InitGame only for new games, and InitSavedGame for 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)
