(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:
@@ -29,6 +29,7 @@
|
||||
#include "engine_func.h"
|
||||
#include "engine_base.h"
|
||||
#include "company_base.h"
|
||||
#include "vehicle_func.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/engines.h"
|
||||
@@ -429,6 +430,25 @@ EngineID EngineOverrideManager::GetID(VehicleType type, uint16 grf_local_id, uin
|
||||
return INVALID_ENGINE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to reset the engine mapping to match the current NewGRF configuration.
|
||||
* This is only possible when there are currently no vehicles in the game.
|
||||
* @return false if resetting failed due to present vehicles.
|
||||
*/
|
||||
bool EngineOverrideManager::ResetToCurrentNewGRFConfig()
|
||||
{
|
||||
const Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (IsCompanyBuildableVehicleType(v)) return false;
|
||||
}
|
||||
|
||||
/* Reset the engines, they will get new EngineIDs */
|
||||
_engine_mngr.ResetToDefaultMapping();
|
||||
ReloadNewGRFData();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets cached values in Company::num_vehicles and Group::num_vehicles
|
||||
*/
|
||||
|
Reference in New Issue
Block a user