Skip to content

Commit

Permalink
Allow disabling loading of addon karts or tracks, fix #4637
Browse files Browse the repository at this point in the history
  • Loading branch information
Benau committed Oct 5, 2021
1 parent 39f7e64 commit 013b065
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/config/user_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,10 @@ namespace UserConfigParams
/** True if graphical profiler should be displayed */
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
PARAM_PREFIX StringToUIntUserConfigParam m_server_bookmarks
PARAM_DEFAULT(StringToUIntUserConfigParam("server-bookmarks",
Expand Down
21 changes: 17 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ void cmdLineHelp()
" texture filtering.\n"
" --shadows=n Set resolution of shadows (0 to disable).\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"
" --apitrace This will disable buffer storage and\n"
" writing gpu query strings to opengl, which\n"
Expand Down Expand Up @@ -1000,6 +1002,11 @@ int handleCmdLinePreliminary()
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;
} // handleCmdLinePreliminary

Expand Down Expand Up @@ -1939,10 +1946,16 @@ void initRest()
// The maximum texture size can not be set earlier, since
// e.g. the background image needs to be loaded in high res.
irr_driver->setMaxTextureSize();
KartPropertiesManager::addKartSearchDir(
file_manager->getAddonsFile("karts/"));
track_manager->addTrackSearchDir(
file_manager->getAddonsFile("tracks/"));
if (!UserConfigParams::m_disable_addon_karts)
{
KartPropertiesManager::addKartSearchDir(
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"));
Expand Down

0 comments on commit 013b065

Please sign in to comment.