Am Montag, 12. Juni 2006 04:14 schrieb Dennis Schridde:
> Hi!
> I created a quite big patch...
> --Dennis
Revised the patch for working on Linux and with a real svn dir...

Removed plain data/ data/mp loading and instead added the relocation stuff 
back in. (Also reworked it.)

modding.h and init.c are only included because I modified the interface of the 
xxxSubdirs functions.
Index: src/modding.h
===================================================================
--- src/modding.h	(revision 0)
+++ src/modding.h	(revision 0)
@@ -0,0 +1,6 @@
+#define PHYSFS_APPEND 1
+#define PHYSFS_PREPEND 0
+
+void addSubdirs( const char * basedir, const char * subdir, const BOOL appendToPath, char * checkList[] );
+void removeSubdirs( const char * basedir, const char * subdir, char * checkList[] );
+void printSearchPath( void );
Index: src/init.c
===================================================================
--- src/init.c	(revision 77)
+++ src/init.c	(working copy)
@@ -102,6 +102,8 @@
 #include "gateway.h"
 #include "lighting.h"
 
+#include "modding.h"
+
 extern char UserMusicPath[];
 
 extern void statsInitVars(void);
@@ -113,6 +115,8 @@
 extern void	initMiscVars( void );
 
 extern char datadir[];
+extern char * campaign_mods[];
+extern char * multiplay_mods[];
 
 
  // the sizes for the game block heap
@@ -720,7 +724,7 @@
 	return TRUE;
 }
 
-
+/*
 void empty_search_path()
 {
 	char** search_path = PHYSFS_getSearchPath();
@@ -757,17 +761,18 @@
 	}
 	PHYSFS_freeList(search_path);
 }
-
+*/
 BOOL loadLevFile(const char* filename, int datadir) {
 	char *pBuffer;
 	UDWORD size;
 
 	if (   !PHYSFS_exists(filename)
 	    || !loadFile(filename, &pBuffer, &size)) {
+		debug(LOG_ERROR, "loadLevFile: File not found: %s\n", filename);
 		return FALSE; // only in NDEBUG case
 	}
 	if (!levParse(pBuffer, size, datadir)) {
-		debug(LOG_ERROR, "loadLevFile: gamedesc.lev parse error");
+		debug(LOG_ERROR, "loadLevFile: Parse error in %s\n", filename);
 		return FALSE;
 	}
 	FREE(pBuffer);
@@ -780,6 +785,7 @@
 	int	depend;
 };
 
+/*
 static struct data_dir_t*	data_dirs = NULL;
 static int			nb_data_dirs = 0;
 static int			data_dirs_size = 0;
@@ -790,7 +796,8 @@
 static char*			global_mod = NULL;
 static char*			campaign_mod = NULL;
 static char*			multiplayer_mod = NULL;
-
+*/
+/*
 BOOL register_mod(int dir, const char* type, const char* name) {
 	char path[MAX_PATH];
 
@@ -815,7 +822,48 @@
 
 	return TRUE;
 }
+*/
 
+BOOL loadLevels( int type )
+{
+	static int current_type = 0;
+
+	if ( type != current_type )
+	{
+		current_type = type;
+		if ( type == DIR_CAMPAIGN )
+		{
+			debug( LOG_WZ, "Switching to campaign mode" );
+
+			// Throw multiplay only mods out...
+			removeSubdirs( PHYSFS_getWriteDir(), "mods/multiplay", multiplay_mods );
+			removeSubdirs( PHYSFS_getBaseDir(), "mods/multiplay", multiplay_mods );
+
+			// Pull campaign only mods in...
+			addSubdirs( PHYSFS_getWriteDir(), "mods/campaign", PHYSFS_PREPEND, campaign_mods );
+			addSubdirs( PHYSFS_getBaseDir(), "mods/campaign", PHYSFS_PREPEND, campaign_mods );
+		}
+		else if ( type == DIR_MULTIPLAYER )
+		{
+			debug( LOG_WZ, "Switching to multiplay mode" );
+
+			// Throw campaign only mods out...
+			removeSubdirs( PHYSFS_getWriteDir(), "mods/campaign", campaign_mods );
+			removeSubdirs( PHYSFS_getBaseDir(), "mods/campaign", campaign_mods );
+
+			// Pull multiplay only mods in...
+			addSubdirs( PHYSFS_getWriteDir(), "mods/multiplay", PHYSFS_PREPEND, multiplay_mods );
+			addSubdirs( PHYSFS_getBaseDir(), "mods/multiplay", PHYSFS_PREPEND, multiplay_mods );
+		}
+		else
+			debug( LOG_ERROR, "loadLevels: Something used unknown type %i", type );
+
+		printSearchPath();
+	}
+	return TRUE;
+}
+
+/*
 BOOL loadLevels(int _index) {
 	static int current_index = -1;
 	int index;
@@ -932,11 +980,13 @@
 	data_dirs[nb_data_dirs].depend = depend;
 	return nb_data_dirs++;
 }
+*/
 
 #define MAP_DIR "maps"
 
 BOOL buildMapList()
 {
+	/*
 	char** search_path = save_search_path();
 	int depend;
 
@@ -949,10 +999,12 @@
 	register_mod(global_mod_dir_campaign, "global", global_mod);
 	campaign_data_dir = declare_data_directory(NULL, global_mod_dir_campaign);
 	register_mod(campaign_data_dir, "campaign", campaign_mod);
-	if (!loadLevFile("gamedesc.lev", campaign_data_dir)) {
-		restore_search_path(search_path);
+	*/
+	if ( !loadLevFile( "gamedesc.lev", DIR_CAMPAIGN ) ) {
+		//restore_search_path(search_path);
 		return FALSE; // only in NDEBUG case
 	}
+	/*
 	PHYSFS_removeFromSearchPath(datadir);
 
 	// load maps from patches
@@ -966,7 +1018,9 @@
 		multiplayer_data_dir = depend = declare_data_directory(NULL, depend);
 		register_mod(multiplayer_data_dir, "multiplayer", multiplayer_mod);
 		PHYSFS_addToSearchPath(path, 1);
-		loadLevFile("addon.lev", depend);
+		*/
+		loadLevFile( "addon.lev", DIR_MULTIPLAYER );
+		/*
 		PHYSFS_removeFromSearchPath(path);
 	}
 
@@ -982,30 +1036,39 @@
 
 		for (i = map_dirs; *i != NULL; ++i) {
 			int dir_index = -1;
+			*/
+		{
 			char** filelist;
 			char** j;
 
+			/*
 			snprintf(path, MAX_PATH, "%s%s"MAP_DIR"%s%s", datadir, PHYSFS_getDirSeparator(), PHYSFS_getDirSeparator(), *i);
 			PHYSFS_addToSearchPath(path, 1);
+			*/
 			filelist = PHYSFS_enumerateFiles("");
 			for (j = filelist; *j != NULL; ++j) {
 				unsigned int l = strlen(*j);
 
-				if (   (l >= 9)
-				    && !strcasecmp((char*)(*j+l-9), "addon.lev")) {
+				if ( (l > 9) // Do not add addon.lev again
+				    && !strcasecmp((char*)(*j+l-9), "addon.lev") ) {
+					/*
 					if (dir_index == -1) {
 						dir_index = declare_data_directory(path, depend);
 					}
-					loadLevFile(*j, dir_index);
+					*/
+					debug( LOG_WZ, "--- Loading lev file: %s\n", *j );
+					loadLevFile( *j, DIR_MULTIPLAYER );
 				}
 			}
 			PHYSFS_freeList( filelist );
+			/*
 			PHYSFS_removeFromSearchPath(path);
 		}
 		PHYSFS_freeList( map_dirs );
+		*/
 	}
 
-	restore_search_path(search_path);
+	//restore_search_path(search_path); // FIXME Temporarily removed
 	return TRUE;
 }
 
@@ -1043,7 +1106,7 @@
 
 	buildMapList();
 
-	loadLevels(DIR_CAMPAIGN);
+	//loadLevels(DIR_CAMPAIGN);
 
 	// Initialize render engine
 	war_SetFog(FALSE);
@@ -1138,7 +1201,7 @@
 //
 BOOL systemShutdown(void)
 {
-	unsigned int i;
+//	unsigned int i;
 #ifdef ARROWS
 	arrowShutDown();
 #endif
@@ -1149,11 +1212,13 @@
 	// free up all the load functions (all the data should already have been freed)
 	resReleaseAll();
 
+/*
 	for( i = 0; i < data_dirs_size; i++ )
 	{
 		free( data_dirs[i].name );
 	}
 	free( data_dirs );
+*/
 
 	// release the block heaps
 	BLOCK_DESTROY(psGameHeap);
Index: src/main.c
===================================================================
--- src/main.c	(revision 77)
+++ src/main.c	(working copy)
@@ -39,11 +39,25 @@
 // FIXME Direct iVis implementation include!
 #include "lib/ivis_opengl/screen.h"
 
-#ifndef DEFAULT_DATA_DIR
-	#define DEFAULT_DATA_DIR "/usr/share"
+#include "modding.h"
+
+#ifndef DEFAULT_DATADIR
+# define DEFAULT_DATADIR "/usr/share/warzone/"
 #endif
+
+#ifdef WIN32
+# define WZ_WRITEDIR "Warzone-2.0"
+#else
+# define WZ_WRITEDIR ".warzone-2.0"
+#endif
+
 char datadir[MAX_PATH] = "\0"; // Global that src/clparse.c:ParseCommandLine can write to, so it can override the default datadir on runtime. Needs to be \0 on startup for ParseCommandLine to work!
 
+char * global_mods[MAX_MODS] = { NULL };
+char * campaign_mods[MAX_MODS] = { NULL };
+char * multiplay_mods[MAX_MODS] = { NULL };
+
+
 // Warzone 2100 . Pumpkin Studios
 
 UDWORD	gameStatus = GS_TITLE_SCREEN;	// Start game in title mode.
@@ -96,12 +110,12 @@
 
 	This function sets the datadir variable.
 ***************************************************************************/
-static void find_data_dir(void)
+/*static void find_data_dir(void)
 {
 	debug(LOG_WZ, "Finding data dir\n");
 	/* Do we have a user supplied data dir? It must point to a directory with gamedesc.lev or
 	 * a warzone.wz with this file inside. */
-	if (datadir[0] != '\0') {
+	/*if (datadir[0] != '\0') {
 		strcpy(datadir, DEFAULT_DATA_DIR);
 		if (!PHYSFS_addToSearchPath(datadir, 1) || !PHYSFS_exists("gamedesc.lev")) {
 			debug(LOG_ERROR, "Required file gamedesc.lev not found in requested data dir \"%s\".", datadir);
@@ -112,20 +126,18 @@
 	}
 
 	/* Check current dir for unpacked game data */
-	if (!PHYSFS_addToSearchPath(PHYSFS_getBaseDir(), 1) || !PHYSFS_exists("gamedesc.lev")) {
-		debug(LOG_WZ, "Could not find data in current dir \"%s\".", PHYSFS_getBaseDir());
-		(void) PHYSFS_removeFromSearchPath(PHYSFS_getBaseDir());
+	/*strcpy(datadir, PHYSFS_getBaseDir());
+	if (!PHYSFS_addToSearchPath(datadir, 1) || !PHYSFS_exists("gamedesc.lev")) {
+		debug(LOG_WZ, "Could not find data in current directory \"%s\".", datadir);
+		(void) PHYSFS_removeFromSearchPath(datadir);
 	} else {
-		char* tmp;
-
-		strcpy(datadir, PHYSFS_getBaseDir());
-		tmp = strrchr(datadir, *PHYSFS_getDirSeparator());
-		if (tmp != NULL) *tmp = '\0'; // Trim ending '/', which getBaseDir always provides
+		if( strrchr(datadir, *PHYSFS_getDirSeparator()) != NULL )
+			*strrchr(datadir, *PHYSFS_getDirSeparator()) = '\0'; // Trim ending '/', which getBaseDir always provides
 		return;
 	}
 
 	/* Check for warzone.wz in current dir */
-	strcpy(datadir, PHYSFS_getBaseDir());
+	/*strcpy(datadir, PHYSFS_getBaseDir());
 	strcat(datadir, "warzone.wz");
 	if (!PHYSFS_addToSearchPath(datadir, 1) || !PHYSFS_exists("gamedesc.lev")) {
 		debug(LOG_WZ, "Did not find warzone.wz in currect directory \"%s\".", datadir);
@@ -135,7 +147,7 @@
 	}
 
 	/* Check for warzone.wz in data/ dir */
-	strcpy(datadir, PHYSFS_getBaseDir());
+	/*strcpy(datadir, PHYSFS_getBaseDir());
 	strcat(datadir, "data/warzone.wz");
 	if (!PHYSFS_addToSearchPath(datadir, 1) || !PHYSFS_exists("gamedesc.lev")) {
 		debug(LOG_WZ, "Did not find warzone.wz in data/ directory \"%s\".", datadir);
@@ -146,12 +158,12 @@
 
 	/* Check for warzone.wz in Unixland system data directory and check if we are running
 	 * straight out of the build directory (for convenience). */
-	strcpy(datadir, PHYSFS_getBaseDir());
+	/*strcpy(datadir, PHYSFS_getBaseDir());
 	if( strrchr(datadir, '/') != NULL ) { // Skip this on Windows, where '/' is not the dirSeperator
 		*strrchr(datadir, '/') = '\0'; // Trim ending '/', which getBaseDir always provides
-		if (strcmp(strrchr(datadir, '/'), "/bin" ) == 0) {
-			strcpy(strrchr(datadir, '/'), "/share/warzone/warzone.wz" );
-		}	else if (strcmp(strrchr(datadir, '/'), "/src" ) == 0 ) {
+		if (strcmp( strrchr( datadir, '/' ), "/bin" ) == 0) {
+			strcpy( strrchr( datadir, '/' ), "/share/warzone/warzone.wz" );
+		}	else if (strcmp( strrchr( datadir, '/' ), "/src" ) == 0 ) {
 			strcpy( strrchr( datadir, '/' ), "/data" );
 		}
 	}
@@ -160,8 +172,78 @@
 		debug(LOG_ERROR, "Could not find game data. Aborting.");
 		exit(1);
 	}
+}*/
+
+static BOOL inList( char * list[], const char * item )
+{
+	int i = 0;
+	debug( LOG_NEVER, "Item: [%s]", item );
+	while( list[i] != NULL )
+	{
+		debug( LOG_NEVER, "Checking for match with: [%s]", list[i] );
+		if ( strcmp( list[i], item ) == 0 )
+			return TRUE;
+		i++;
+	}
+	return FALSE;
 }
 
+void addSubdirs( const char * basedir, const char * subdir, const BOOL appendToPath, char * checkList[] )
+{
+	char tmpstr[MAX_PATH];
+	char ** subdirlist = PHYSFS_enumerateFiles( subdir );
+	char ** i = subdirlist;
+	while( *i != NULL )
+	{
+		debug( LOG_NEVER, "Examining subdir: [%s]", *i );
+		if( !checkList || inList( checkList, *i ) )
+		{
+			strcpy( tmpstr, basedir );
+			strcat( tmpstr, subdir );
+			strcat( tmpstr, PHYSFS_getDirSeparator() );
+			strcat( tmpstr, *i );
+			debug( LOG_NEVER, "Adding [%s] to search path", tmpstr );
+			PHYSFS_addToSearchPath( tmpstr, appendToPath );
+		}
+		i++;
+	}
+	PHYSFS_freeList( subdirlist );
+}
+
+void removeSubdirs( const char * basedir, const char * subdir, char * checkList[] )
+{
+	char tmpstr[MAX_PATH];
+	char ** subdirlist = PHYSFS_enumerateFiles( subdir );
+	char ** i = subdirlist;
+	while( *i != NULL )
+	{
+		debug( LOG_NEVER, "Examining subdir: [%s]", *i );
+		if( !checkList || inList( checkList, *i ) )
+		{
+			strcpy( tmpstr, basedir );
+			strcat( tmpstr, subdir );
+			strcat( tmpstr, PHYSFS_getDirSeparator() );
+			strcat( tmpstr, *i );
+			debug( LOG_NEVER, "Removing [%s] from search path", tmpstr );
+			PHYSFS_removeFromSearchPath( tmpstr );
+		}
+		i++;
+	}
+	PHYSFS_freeList( subdirlist );
+}
+
+void printSearchPath( void )
+{
+	char ** i, ** searchPath;
+
+	debug(LOG_WZ, "Search paths:");
+	searchPath = PHYSFS_getSearchPath();
+	for (i = searchPath; *i != NULL; i++) {
+		debug(LOG_WZ, "    [%s]", *i);
+	}
+	PHYSFS_freeList( searchPath );
+}
+
 /***************************************************************************
 	Initialize the PhysicsFS library.
 ***************************************************************************/
@@ -169,13 +251,7 @@
 {
 	PHYSFS_Version compiled;
 	PHYSFS_Version linked;
-	char **i, **searchPath;
-	char overridepath[MAX_PATH], writepath[MAX_PATH], mappath[MAX_PATH];
-#ifdef WIN32
-  const char *writedir = "warzone-2.0";
-#else
-  const char *writedir = ".warzone-2.0";
-#endif
+	char tmpstr[MAX_PATH];
 
 	PHYSFS_VERSION(&compiled);
 	PHYSFS_getLinkedVersion(&linked);
@@ -185,50 +261,115 @@
 	debug(LOG_WZ, "Linked against PhysFS version: %d.%d.%d",
 	      linked.major, linked.minor, linked.patch);
 
-	strcpy(writepath, PHYSFS_getUserDir());
-	if (PHYSFS_setWriteDir(writepath) == 0) {
-		debug(LOG_ERROR, "Error setting write directory to home directory \"%s\": %s",
-		      writepath, PHYSFS_getLastError());
+	strcpy( tmpstr, PHYSFS_getUserDir() );
+	strcat( tmpstr, WZ_WRITEDIR );
+	if ( PHYSFS_setWriteDir( tmpstr ) == 0 ) {
+		debug( LOG_ERROR, "Error setting write directory to \"%s\": %s",
+			tmpstr, PHYSFS_getLastError() );
 		exit(1);
 	}
-	strcat(writepath, writedir);
-	(void) PHYSFS_mkdir(writedir); /* Just in case it does not exist yet; */
-	if (PHYSFS_setWriteDir(writepath) == 0) {
-		debug(LOG_ERROR, "Error setting write directory to \"%s\": %s",
-			writepath, PHYSFS_getLastError());
-		exit(1);
-	}
-	PHYSFS_addToSearchPath(writepath, 0); /* add to search path */
+	
+	// User's home dir
+	PHYSFS_addToSearchPath( PHYSFS_getWriteDir(), PHYSFS_APPEND );
 
-  find_data_dir();
-  debug(LOG_WZ, "Data dir set to \"%s\".", datadir);
+	PHYSFS_permitSymbolicLinks(1);
 
-	snprintf(overridepath, sizeof(overridepath), "%smods", PHYSFS_getBaseDir());
-	strcpy(mappath, PHYSFS_getBaseDir());
-	strcat(mappath, "maps");
+	debug( LOG_WZ, "Write dir: %s", PHYSFS_getWriteDir() );
+	debug( LOG_WZ, "Base dir: %s", PHYSFS_getBaseDir() );
+}
 
-	/* The 1 below means append to search path, while 0 means prepend. */
-	if (!PHYSFS_addToSearchPath(overridepath, 0)) {
-		debug(LOG_WZ, "Error adding override path %s: %s", overridepath,
-		      PHYSFS_getLastError());
+// We need ParseCommandLine, before we can add any mods...
+void scanDataDirs( void )
+{
+	char tmpstr[MAX_PATH], realBaseDir[MAX_PATH], realSuffix[MAX_PATH];
+
+	// Command line supplied datadir
+	PHYSFS_addToSearchPath( datadir, PHYSFS_PREPEND );
+
+	// maps/mods subdirs of user's home dir
+	addSubdirs( PHYSFS_getWriteDir(), "mods/global", PHYSFS_APPEND, global_mods );
+	addSubdirs( PHYSFS_getWriteDir(), "maps", PHYSFS_APPEND, FALSE );
+
+	// maps/mods subdirs of program dir
+	PHYSFS_addToSearchPath( PHYSFS_getBaseDir(), PHYSFS_APPEND );
+	addSubdirs( PHYSFS_getBaseDir(), "mods/global", PHYSFS_APPEND, global_mods );
+	addSubdirs( PHYSFS_getBaseDir(), "maps", PHYSFS_APPEND, FALSE );
+	PHYSFS_removeFromSearchPath( PHYSFS_getBaseDir() );
+
+	// Program dir mp.wz patches
+	strcpy( tmpstr, PHYSFS_getBaseDir() );
+	strcat( tmpstr, "mp.wz" );
+	PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
+
+	// Program dir warzone.wz
+	strcpy( tmpstr, PHYSFS_getBaseDir() );
+	strcat( tmpstr, "warzone.wz" );
+	PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
+
+
+	// Plain program dir + patches
+	strcpy( tmpstr, PHYSFS_getBaseDir() );
+	strcat( tmpstr, "mp" );
+	PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
+	PHYSFS_addToSearchPath( PHYSFS_getBaseDir(), PHYSFS_APPEND );
+
+
+	// Plain default datadir on Unix
+	strcpy( tmpstr, DEFAULT_DATADIR );
+	strcat( tmpstr, "mp" );
+	PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
+	PHYSFS_addToSearchPath( DEFAULT_DATADIR, PHYSFS_APPEND );
+
+	// Default datadir with .wz files on Unix
+	strcpy( tmpstr, DEFAULT_DATADIR );
+	strcat( tmpstr, "mp.wz" );
+	PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
+	strcpy( tmpstr, DEFAULT_DATADIR );
+	strcat( tmpstr, "warzone.wz" );
+	PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
+
+
+	// Find out which PREFIX we are in...
+	strcpy( tmpstr, PHYSFS_getBaseDir() );
+	*strrchr( tmpstr, *PHYSFS_getDirSeparator() ) = '\0'; // Trim ending '/', which getBaseDir always provides
+
+	strncpy( realBaseDir, PHYSFS_getBaseDir(), // Skip the last dir from base dir
+		strrchr( tmpstr, *PHYSFS_getDirSeparator() ) - tmpstr );
+	strcpy( realSuffix, strrchr( tmpstr, *PHYSFS_getDirSeparator() ) ); // Remember the last dir
+
+	// Relocation for AutoPackage
+	if ( strcmp( realSuffix, "/bin" ) == 0 ) {
+		strcpy( tmpstr, realBaseDir );
+		strcat( tmpstr, "/share/warzone/mp.wz" );
+		PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
+		strcpy( tmpstr, realBaseDir );
+		strcat( tmpstr, "/share/warzone/warzone.wz" );
+		PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
 	}
-	if (!PHYSFS_addToSearchPath(mappath, 0)) {
-		debug(LOG_WZ, "Error adding map path %s: %s", mappath,
-		      PHYSFS_getLastError());
+	// Hack for the hackers... Use data in SVN dir
+	else if (strcmp( realSuffix, "/src" ) == 0 ) {
+		strcpy( tmpstr, realBaseDir );
+		strcat( tmpstr, "/data/mp" );
+		PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
+		strcpy( tmpstr, realBaseDir );
+		strcat( tmpstr, "/data" );
+		PHYSFS_addToSearchPath( tmpstr, PHYSFS_APPEND );
 	}
+		
 
 	/** Debugging and sanity checks **/
 
-	debug(LOG_WZ, "Search paths:");
-	searchPath = PHYSFS_getSearchPath();
-	for (i = searchPath; *i != NULL; i++) {
-		debug(LOG_WZ, "    [%s]", *i);
+	printSearchPath();
+
+	if( PHYSFS_exists("gamedesc.lev") )
+	{
+		debug( LOG_WZ, "gamedesc.lev found at %s", PHYSFS_getRealDir( "gamedesc.lev" ) );
 	}
-	PHYSFS_freeList( searchPath );
-	debug(LOG_WZ, "Write path: %s", PHYSFS_getWriteDir());
-
-	PHYSFS_permitSymbolicLinks(1);
-	debug(LOG_WZ, "gamedesc.lev found at %s", PHYSFS_getRealDir("gamedesc.lev"));
+	else
+	{
+		debug( LOG_ERROR, "Could not find game data. Aborting." );
+		exit(1);
+	}
 }
 
 /***************************************************************************
@@ -242,7 +383,7 @@
 		strcat(dest, subdir);
 	}
 	{
-		unsigned int l = strlen(dest);
+		size_t l = strlen(dest);
 
 		if (dest[l-1] != '/') {
 			dest[l] = '/';
@@ -296,11 +437,7 @@
 
 	/*** Initialize PhysicsFS ***/
 
-#ifdef WIN32
-	PHYSFS_init(NULL);
-#else
 	PHYSFS_init(argv[0]);
-#endif
 	initialize_PhysicsFS();
 
 	make_dir(ScreenDumpPath, "screendumps", NULL);
@@ -336,6 +473,9 @@
 			return -1;
 		}
 	}
+
+	scanDataDirs();
+
 	debug(LOG_MAIN, "reinitializing");
 
 	// find out if the lobby stuff has been disabled
@@ -348,10 +488,6 @@
 
 	reInit = FALSE;//just so we dont restart again
 
-#ifdef USE_FILE_PATH
-	chdir(FILE_PATH);
-#endif
-
 	bVidMem = FALSE;
 	dispBitDepth = DISP_BITDEPTH;
 
@@ -409,9 +545,9 @@
 			case GS_TITLE_SCREEN:
 				screen_RestartBackDrop();
 
-				loadLevels(DIR_MULTIPLAYER);
+				//loadLevels(DIR_MULTIPLAYER);
 
-				if (!frontendInitialise("wrf\\frontend.wrf"))
+				if (!frontendInitialise("wrf/frontend.wrf"))
 				{
 					goto exit;
 				}

Attachment: pgpH22kXn1Yjc.pgp
Description: PGP signature

_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to