From dd6caeac3f27bff7a02819bb2211a954fb028d29 Mon Sep 17 00:00:00 2001
From: cybersphinx <chr.ohm@gmx.net>
Date: Mon, 18 Jul 2011 17:41:09 +0200
Subject: [PATCH 2/2] Load maps last, so files in them don't override game
 data.

---
 src/init.cpp |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/init.cpp b/src/init.cpp
index 0d8992e..0b7d7c0 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -362,9 +362,8 @@ bool rebuildSearchPath( searchPathMode mode, bool force )
 #ifdef DEBUG
 					debug(LOG_WZ, "Adding [%s] to search path", curSearchPath->path);
 #endif // DEBUG
-					// Add maps and global and multiplay mods
+					// Add global and multiplay mods
 					PHYSFS_addToSearchPath( curSearchPath->path, PHYSFS_APPEND );
-					addSubdirs( curSearchPath->path, "maps", PHYSFS_APPEND, NULL, false );
 					addSubdirs( curSearchPath->path, "mods/music", PHYSFS_APPEND, NULL, false );
 					addSubdirs( curSearchPath->path, "mods/global", PHYSFS_APPEND, use_override_mods?override_mods:global_mods, true );
 					addSubdirs( curSearchPath->path, "mods", PHYSFS_APPEND, use_override_mods?override_mods:global_mods, true );
@@ -393,6 +392,15 @@ bool rebuildSearchPath( searchPathMode mode, bool force )
 
 					curSearchPath = curSearchPath->higherPriority;
 				}
+				curSearchPath = searchPathRegistry;
+				while (curSearchPath->lowerPriority)
+					curSearchPath = curSearchPath->lowerPriority;
+				// Add maps last, so files in them don't override game data
+                                while (curSearchPath)
+				{
+					addSubdirs(curSearchPath->path, "maps", PHYSFS_APPEND, NULL, false);
+					curSearchPath = curSearchPath->higherPriority;
+				}
 				break;
 			default:
 				debug(LOG_ERROR, "Can't switch to unknown mods %i", mode);
-- 
1.7.5.4


