(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.

This commit is contained in:
frosch
2011-02-05 16:07:23 +00:00
parent 67ce7c5c41
commit 447f3dbe2c
5 changed files with 51 additions and 12 deletions

View File

@@ -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;
}