]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/qe3.cpp
radiant: fix xy/yz/xz layout
[xonotic/netradiant.git] / radiant / qe3.cpp
index 62530c11447964b2454309b5ebff27fb941969fb..09d49d30dfabecc711eba8afc172e62ddc987cfb 100644 (file)
@@ -79,44 +79,58 @@ void QE_InitVFS(){
        // we need to call in order, the mod ones first, then the base ones .. they will be searched in this order
        // *nix systems have a dual filesystem in ~/.q3a, which is searched first .. so we need to add that too
 
-       const char* gamename = gamename_get();
+       const char* enginepath = EnginePath_get();
+       const char* homepath = g_qeglobals.m_userEnginePath.c_str(); // returns enginepath if not homepath is not set
+
        const char* basegame = basegame_get();
-       const char* userRoot = g_qeglobals.m_userEnginePath.c_str();
-       const char* globalRoot = EnginePath_get();
+       const char* gamename = gamename_get(); // returns basegame if gamename is not set
 
        // editor builtin VFS
        StringOutputStream editorGamePath( 256 );
-       editorGamePath << GlobalRadiant().getAppPath() << DEFAULT_EDITORVFS_DIRNAME;
+       editorGamePath << GlobalRadiant().getDataPath() << DEFAULT_EDITORVFS_DIRNAME;
        GlobalFileSystem().initDirectory( editorGamePath.c_str() );
 
+       globalOutputStream() << "engine path: " << enginepath << "\n";
+       globalOutputStream() << "home path: " << homepath << "\n";
+       globalOutputStream() << "base game: " << basegame << "\n";
+       globalOutputStream() << "game name: " << gamename << "\n";
+
        // if we have a mod dir
        if ( !string_equal( gamename, basegame ) ) {
+               // if we have a home dir
+               if ( !string_equal( homepath, enginepath ) )
+               {
                // ~/.<gameprefix>/<fs_game>
-               if ( userRoot && !string_equal( globalRoot, userRoot ) && !g_disableHomePath ) {
+               if ( homepath && !string_equal( enginepath, homepath ) && !g_disableHomePath ) {
                        StringOutputStream userGamePath( 256 );
-                       userGamePath << userRoot << gamename << '/';
+                               userGamePath << homepath << gamename << '/';
                        GlobalFileSystem().initDirectory( userGamePath.c_str() );
                }
+               }
 
                // <fs_basepath>/<fs_game>
                if ( !g_disableEnginePath ) {
                        StringOutputStream globalGamePath( 256 );
-                       globalGamePath << globalRoot << gamename << '/';
+                       globalGamePath << enginepath << gamename << '/';
                        GlobalFileSystem().initDirectory( globalGamePath.c_str() );
                }
        }
 
+       // if we have a home dir
+       if ( !string_equal( homepath, enginepath ) )
+       {
        // ~/.<gameprefix>/<fs_main>
-       if ( userRoot && !string_equal( globalRoot, userRoot ) && !g_disableHomePath ) {
+       if ( homepath && !string_equal( enginepath, homepath ) && !g_disableHomePath ) {
                StringOutputStream userBasePath( 256 );
-               userBasePath << userRoot << basegame << '/';
+                       userBasePath << homepath << basegame << '/';
                GlobalFileSystem().initDirectory( userBasePath.c_str() );
        }
+       }
 
        // <fs_basepath>/<fs_main>
        if ( !g_disableEnginePath ) {
                StringOutputStream globalBasePath( 256 );
-               globalBasePath << globalRoot << basegame << '/';
+               globalBasePath << enginepath << basegame << '/';
                GlobalFileSystem().initDirectory( globalBasePath.c_str() );
        }
 
@@ -173,37 +187,45 @@ bool ConfirmModified( const char* title ){
 }
 
 void bsp_init(){
+       // this is expected to not be used since
+       // ".[ExecutableType]" is replaced by "[ExecutableExt]"
+       const char *exe_ext = GDEF_OS_EXE_EXT;
+       build_set_variable( "ExecutableType", exe_ext[0] == '\0' ? exe_ext : exe_ext + 1 );
+
+       build_set_variable( "ExecutableExt", GDEF_OS_EXE_EXT );
        build_set_variable( "RadiantPath", AppPath_get() );
-       build_set_variable( "ExecutableType", RADIANT_EXECUTABLE );
        build_set_variable( "EnginePath", EnginePath_get() );
        build_set_variable( "UserEnginePath", g_qeglobals.m_userEnginePath.c_str() );
+
        build_set_variable( "MonitorAddress", ( g_WatchBSP_Enabled ) ? "127.0.0.1:39000" : "" );
+
        build_set_variable( "GameName", gamename_get() );
 
-       StringBuffer ExtraQ3map2Args;
+       std::string ExtraQ3map2Args;
        // extra pakpaths
        for ( int i = 0; i < g_pakPathCount; i++ ) {
                if ( g_strcmp0( g_strPakPath[i].c_str(), "") ) {
-                       ExtraQ3map2Args.push_string( " -fs_pakpath \"" );
-                       ExtraQ3map2Args.push_string( g_strPakPath[i].c_str() );
-                       ExtraQ3map2Args.push_string( "\"" );
+                       ExtraQ3map2Args += " -fs_pakpath \"";
+                       ExtraQ3map2Args += g_strPakPath[i].c_str();
+                       ExtraQ3map2Args += "\"";
                }
        }
 
        // extra switches
        if ( g_disableEnginePath ) {
-               ExtraQ3map2Args.push_string( " -fs_nobasepath " );
+               ExtraQ3map2Args += " -fs_nobasepath ";
        }
 
        if ( g_disableHomePath ) {
-               ExtraQ3map2Args.push_string( " -fs_nohomepath " );
+               ExtraQ3map2Args += " -fs_nohomepath ";
        }
 
        build_set_variable( "ExtraQ3map2Args", ExtraQ3map2Args.c_str() );
 
        const char* mapname = Map_Name( g_map );
-       StringOutputStream name( 256 );
-       name << StringRange( mapname, path_get_filename_base_end( mapname ) ) << ".bsp";
+       std::string name;
+       name.append( mapname, path_get_filename_base_end( mapname ) - mapname );
+       name += ".bsp";
 
        if( region_active ){
                StringOutputStream name( 256 );