Index: binaries/data/mods/public/gui/savedgames/load.js
===================================================================
--- binaries/data/mods/public/gui/savedgames/load.js	(révision 14585)
+++ binaries/data/mods/public/gui/savedgames/load.js	(copie de travail)
@@ -3,6 +3,24 @@
 	var gameSelection = Engine.GetGUIObjectByName("gameSelection");
 
 	var savedGames = Engine.GetSavedGames();
+
+	var sameMods = Engine.GetGUIObjectByName("modsSelection").checked;
+	if (sameMods)
+	{
+		var modsLoaded = Engine.GetModsLoaded();
+		savedGames = savedGames.filter(function(game) {
+			if (!game.metadata.mods)
+				return true;     // temporary, for backward compatibility
+			var gameMods = game.metadata.mods;
+			if (modsLoaded.length != gameMods.length)
+				return false;
+			for (var i = 0; i < modsLoaded.length; ++i)
+				if (modsLoaded[i] != gameMods[i])
+					return false;
+			return true;
+		});
+	}
+
 	if (savedGames.length == 0)
 	{
 		gameSelection.list = [ "No saved games found" ];
Index: binaries/data/mods/public/gui/savedgames/load.xml
===================================================================
--- binaries/data/mods/public/gui/savedgames/load.xml	(révision 14585)
+++ binaries/data/mods/public/gui/savedgames/load.xml	(copie de travail)
@@ -21,6 +21,14 @@
 			size="24 24 100%-24 100%-100">
 		</object>
 
+		<object type="image" size="50 100%-90 100%-50 100%-70">
+			<object name="modsSelection" size="0 10% 16 90%" type="checkbox" style="StoneCrossBox">
+				<action on="Load">this.checked = true;</action>
+				<action on="Press">init();</action>
+			</object>
+			<object size="25 0 100% 100%" type="text" style="LeftLabelText" ghost="true">Show only games with the current mod</object>
+		</object>
+
 		<object name="loadGameButton" type="button" size="0%+25 100%-60 33%+10 100%-32" style="StoneButton">
 			Load
 			<action on="Press">loadGame();</action>
Index: source/gui/scripting/ScriptFunctions.cpp
===================================================================
--- source/gui/scripting/ScriptFunctions.cpp	(révision 14585)
+++ source/gui/scripting/ScriptFunctions.cpp	(copie de travail)
@@ -194,6 +194,11 @@
 		g_Game->SetPlayerID(id);
 }
 
+std::vector<std::string> GetModsLoaded(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
+{
+	return g_modsLoaded;
+}
+
 void StartNetworkGame(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
 {
 	ENSURE(g_NetServer);
@@ -841,6 +846,7 @@
 	scriptInterface.RegisterFunction<void, &RestartInAtlas>("RestartInAtlas");
 	scriptInterface.RegisterFunction<bool, &AtlasIsAvailable>("AtlasIsAvailable");
 	scriptInterface.RegisterFunction<bool, &IsAtlasRunning>("IsAtlasRunning");
+	scriptInterface.RegisterFunction<std::vector<std::string>, &GetModsLoaded>("GetModsLoaded");
 	scriptInterface.RegisterFunction<CScriptVal, VfsPath, &LoadMapSettings>("LoadMapSettings");
 	scriptInterface.RegisterFunction<CScriptVal, &GetMapSettings>("GetMapSettings");
 	scriptInterface.RegisterFunction<float, &CameraGetX>("CameraGetX");
Index: source/main.cpp
===================================================================
--- source/main.cpp	(révision 14585)
+++ source/main.cpp	(copie de travail)
@@ -421,6 +421,7 @@
 	if(ran_atlas)
 		return;
 
+	g_modsLoaded.clear();
 	// run non-visual simulation replay if requested
 	if (args.Has("replay"))
 	{
@@ -464,6 +465,9 @@
 	const double res = timer_Resolution();
 	g_frequencyFilter = CreateFrequencyFilter(res, 30.0);
 
+	std::vector<CStr> modsLoaded = args.GetMultiple("mod");
+	for (size_t i = 0; i < modsLoaded.size(); ++i)
+		g_modsLoaded.push_back((std::string)modsLoaded[i]);
 	// run the game
 	Init(args, 0);
 	InitGraphics(args, 0);
Index: source/ps/GameSetup/Config.cpp
===================================================================
--- source/ps/GameSetup/Config.cpp	(révision 14585)
+++ source/ps/GameSetup/Config.cpp	(copie de travail)
@@ -76,6 +76,7 @@
 // If non-empty, specified map will be automatically loaded
 CStr g_AutostartMap = "";
 
+std::vector<std::string> g_modsLoaded;
 
 //----------------------------------------------------------------------------
 // config
Index: source/ps/GameSetup/Config.h
===================================================================
--- source/ps/GameSetup/Config.h	(révision 14585)
+++ source/ps/GameSetup/Config.h	(copie de travail)
@@ -90,6 +90,9 @@
 
 extern CStrW g_CursorName;
 
+// list of mods currently loaded
+extern std::vector<std::string> g_modsLoaded;
+
 class CmdLineArgs;
 extern void CONFIG_Init(const CmdLineArgs& args);
 
Index: source/ps/SavedGame.cpp
===================================================================
--- source/ps/SavedGame.cpp	(révision 14585)
+++ source/ps/SavedGame.cpp	(copie de travail)
@@ -24,6 +24,7 @@
 #include "lib/file/archive/archive_zip.h"
 #include "ps/CLogger.h"
 #include "ps/Filesystem.h"
+#include "ps/GameSetup/Config.h"
 #include "scriptinterface/ScriptInterface.h"
 #include "simulation2/Simulation2.h"
 
@@ -76,6 +77,7 @@
 	simulation.GetScriptInterface().Eval("({})", metadata);
 	simulation.GetScriptInterface().SetProperty(metadata.get(), "version_major", SAVED_GAME_VERSION_MAJOR);
 	simulation.GetScriptInterface().SetProperty(metadata.get(), "version_minor", SAVED_GAME_VERSION_MINOR);
+	simulation.GetScriptInterface().SetProperty(metadata.get(), "mods", g_modsLoaded);
 	simulation.GetScriptInterface().SetProperty(metadata.get(), "time", (double)now);
 	simulation.GetScriptInterface().SetProperty(metadata.get(), "player", playerID);
 	simulation.GetScriptInterface().SetProperty(metadata.get(), "initAttributes", simulation.GetInitAttributes());
