+
+ prop = (char*)xmlGetProp(pNode, (const xmlChar*)ENGINE_ATTRIBUTE);
+ if (prop == NULL)
+ {
+#ifdef _WIN32
+ mEngine = "quake3.exe";
+#elif __linux__
+ mEngine = "quake3";
+#elif __APPLE__
+ mEngine = "Quake3.app";
+#endif
+ }
+ else
+ {
+ mEngine = prop;
+ xmlFree(prop);
+ }
+
+ prop = (char*)xmlGetProp(pNode, (const xmlChar*)MP_ENGINE_ATTRIBUTE);
+ if (prop == NULL)
+ {
+#ifdef _WIN32
+ mMultiplayerEngine = "quake3.exe";
+#elif __linux__
+ mMultiplayerEngine = "quake3";
+#elif __APPLE__
+ mMultiplayerEngine = "Quake3.app";
+#endif
+ }
+ else
+ {
+ mMultiplayerEngine = prop;
+ xmlFree(prop);
+ }
+
+ {
+ // on win32, engine path can now be specified relative to the exe's cwd
+ prop = (char*)xmlGetProp(pNode, (const xmlChar *)ENGINEPATH_ATTRIBUTE);
+ if ( prop != NULL ) {
+ char full[PATH_MAX];
+ #ifdef _WIN32
+ _fullpath( full, prop, PATH_MAX );
+ #else
+ strncpy( full, prop, PATH_MAX );
+ #endif
+ xmlFree( prop );
+ prop = NULL;
+ // process seperators
+ for ( p = full; *p != '\0'; p++ ) {
+ if ( *p == '\\' ) {
+ *p = '/';
+ }
+ }
+ mEnginePath = full;
+ if ( p != full && *(p-1) != '/' ) {
+ mEnginePath += "/";
+ }
+ }
+ else
+ {
+ // if engine path was not specified in the .game, it implies we can guess it from the gametools path
+ // on win32, and for most game package, the gametools are installed with the game
+ char aux_path[PATH_MAX]; // aux
+ strcpy( aux_path, mGameToolsPath.GetBuffer() );
+ if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) {
+ aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any
+ }
+ char up_path[PATH_MAX]; // up one level
+ ExtractFilePath( aux_path, up_path );
+ mEnginePath = up_path;
+ }
+ }
+