From ca0674d684acef3f64c97b81cefe1ef976a6f877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Thu, 6 Nov 2014 02:43:33 +0100 Subject: [PATCH] Add --noaddons command line option. This option prevents any add-ons from being loaded. --- changelog | 1 + src/commandline_options.cpp | 4 ++++ src/commandline_options.hpp | 2 ++ src/game_config_manager.cpp | 3 ++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog b/changelog index c3d20e0a418..a941566cf33 100644 --- a/changelog +++ b/changelog @@ -380,6 +380,7 @@ Version 1.13.0-dev: * Fix bug #21400: Use unit 'image' with higher priority than 'image_icon' for animation frames with no specified image. * New filesystem implementation based on boost filesystem + * Added "--noaddons" command-line argument, prevents any add-ons from being loaded. * Added "--render-image" command-line argument, similar to --screenshot, but instead of a map, it takes a wesnoth imagepath and generates at bitmap with the filters applied. * New gettext implementation based on boost locale. This raises min boost requirement to 1.48, diff --git a/src/commandline_options.cpp b/src/commandline_options.cpp index 0516642eba3..88f249cdfec 100644 --- a/src/commandline_options.cpp +++ b/src/commandline_options.cpp @@ -105,6 +105,7 @@ commandline_options::commandline_options (const std::vector& args) multiplayer_side(), multiplayer_turns(), max_fps(), + noaddons(false), nocache(false), nodelay(false), nogui(false), @@ -173,6 +174,7 @@ commandline_options::commandline_options (const std::vector& args) ("help,h", "prints this message and exits.") ("language,L", po::value(), "uses language (symbol) this session. Example: --language ang_GB@latin") ("load,l", po::value(), "loads the save from the standard save game directory. When launching the map editor via -e, the map is loaded, relative to the current directory. If it is a directory, the editor will start with a load map dialog opened there.") + ("noaddons", "disables the loading of all add-ons.") ("nocache", "disables caching of game data.") ("nodelay", "runs the game without any delays.") ("nomusic", "runs the game without music.") @@ -367,6 +369,8 @@ commandline_options::commandline_options (const std::vector& args) multiplayer_repeat = vm["multiplayer-repeat"].as(); if (vm.count("new-widgets")) new_widgets = true; + if (vm.count("noaddons")) + noaddons = true; if (vm.count("nocache")) nocache = true; if (vm.count("nodelay")) diff --git a/src/commandline_options.hpp b/src/commandline_options.hpp index 981b68591f4..13e7a9a1382 100644 --- a/src/commandline_options.hpp +++ b/src/commandline_options.hpp @@ -124,6 +124,8 @@ public: boost::optional multiplayer_turns; /// Max FPS specified by --max-fps option. boost::optional max_fps; + /// True if --noaddons was given on the command line. Disables the loading of all add-ons. + bool noaddons; /// True if --nocache was given on the command line. Disables cache usage. bool nocache; /// True if --nodelay was given on the command line. diff --git a/src/game_config_manager.cpp b/src/game_config_manager.cpp index 3d9f55e2cd3..176274709b7 100644 --- a/src/game_config_manager.cpp +++ b/src/game_config_manager.cpp @@ -138,7 +138,8 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload, config core_terrain_rules; core_terrain_rules.splice_children(game_config_, "terrain_graphics"); - load_addons_cfg(); + if (!cmdline_opts_.noaddons) + load_addons_cfg(); // If multiplayer campaign is being loaded, [scenario] tags should // become [multiplayer] tags and campaign's id should be added to them