summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-05 16:07:23 +0000
committerfrosch <frosch@openttd.org>2011-02-05 16:07:23 +0000
commit915e339d0f395305ec722925bfd8f4fdd09f30a3 (patch)
treecf6982b3ae86b563f6868379f8f6240b658d6130 /src/settings.cpp
parenta4b08dddd10062f49352b5aee49e392f95e281e2 (diff)
downloadopenttd-915e339d0f395305ec722925bfd8f4fdd09f30a3.tar.xz
(svn r21975) -Add: console command to reset the engine pool. It removes the traces of engines which are no longer associated to a NewGRF, and can be used to e.g. 'fix' scenarios which were screwed up by the author. You can only use it when there are no vehicles in the game though.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 5d4e713be..30201541c 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -36,7 +36,6 @@
#include "train.h"
#include "news_func.h"
#include "window_func.h"
-#include "vehicle_func.h"
#include "sound_func.h"
#include "company_func.h"
#include "rev.h"
@@ -58,7 +57,6 @@
#include "ini_type.h"
#include "ai/ai_config.hpp"
#include "ai/ai.hpp"
-#include "newgrf.h"
#include "ship.h"
#include "smallmap_gui.h"
#include "roadveh.h"
@@ -1133,18 +1131,11 @@ static bool ChangeDynamicEngines(int32 p1)
{
if (_game_mode == GM_MENU) return true;
- const Vehicle *v;
- FOR_ALL_VEHICLES(v) {
- if (IsCompanyBuildableVehicleType(v)) {
- ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, WL_ERROR);
- return false;
- }
+ if (!EngineOverrideManager::ResetToCurrentNewGRFConfig()) {
+ ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, WL_ERROR);
+ return false;
}
- /* Reset the engines, they will get new EngineIDs */
- _engine_mngr.ResetToDefaultMapping();
- ReloadNewGRFData();
-
return true;
}