Allow disabling loading of addon karts or tracks, fix #4637

This commit is contained in:
Benau 2021-10-05 11:58:23 +08:00
parent 39f7e6441a
commit 013b065f2c
2 changed files with 21 additions and 4 deletions

View File

@ -805,6 +805,10 @@ namespace UserConfigParams
/** True if graphical profiler should be displayed */ /** True if graphical profiler should be displayed */
PARAM_PREFIX bool m_profiler_enabled PARAM_DEFAULT( false ); PARAM_PREFIX bool m_profiler_enabled PARAM_DEFAULT( false );
PARAM_PREFIX bool m_disable_addon_karts PARAM_DEFAULT( false );
PARAM_PREFIX bool m_disable_addon_tracks PARAM_DEFAULT( false );
// ---- Networking // ---- Networking
PARAM_PREFIX StringToUIntUserConfigParam m_server_bookmarks PARAM_PREFIX StringToUIntUserConfigParam m_server_bookmarks
PARAM_DEFAULT(StringToUIntUserConfigParam("server-bookmarks", PARAM_DEFAULT(StringToUIntUserConfigParam("server-bookmarks",

View File

@ -686,6 +686,8 @@ void cmdLineHelp()
" texture filtering.\n" " texture filtering.\n"
" --shadows=n Set resolution of shadows (0 to disable).\n" " --shadows=n Set resolution of shadows (0 to disable).\n"
" --render-driver=n Render driver to use (gl or directx9).\n" " --render-driver=n Render driver to use (gl or directx9).\n"
" --disable-addon-karts Disable loading of addon karts.\n"
" --disable-addon-tracks Disable loading of addon tracks.\n"
" --dump-official-karts Dump official karts for current stk-assets.\n" " --dump-official-karts Dump official karts for current stk-assets.\n"
" --apitrace This will disable buffer storage and\n" " --apitrace This will disable buffer storage and\n"
" writing gpu query strings to opengl, which\n" " writing gpu query strings to opengl, which\n"
@ -1000,6 +1002,11 @@ int handleCmdLinePreliminary()
Log::info("main", "STK using random seed (%d)", n); Log::info("main", "STK using random seed (%d)", n);
} }
if (CommandLine::has("--disable-addon-karts"))
UserConfigParams::m_disable_addon_karts = true;
if (CommandLine::has("--disable-addon-tracks"))
UserConfigParams::m_disable_addon_tracks = true;
return 0; return 0;
} // handleCmdLinePreliminary } // handleCmdLinePreliminary
@ -1939,10 +1946,16 @@ void initRest()
// The maximum texture size can not be set earlier, since // The maximum texture size can not be set earlier, since
// e.g. the background image needs to be loaded in high res. // e.g. the background image needs to be loaded in high res.
irr_driver->setMaxTextureSize(); irr_driver->setMaxTextureSize();
KartPropertiesManager::addKartSearchDir( if (!UserConfigParams::m_disable_addon_karts)
file_manager->getAddonsFile("karts/")); {
track_manager->addTrackSearchDir( KartPropertiesManager::addKartSearchDir(
file_manager->getAddonsFile("tracks/")); file_manager->getAddonsFile("karts/"));
}
if (!UserConfigParams::m_disable_addon_tracks)
{
track_manager->addTrackSearchDir(
file_manager->getAddonsFile("tracks/"));
}
{ {
XMLNode characteristicsNode(file_manager->getAsset("kart_characteristics.xml")); XMLNode characteristicsNode(file_manager->getAsset("kart_characteristics.xml"));