@@ -547,38 +547,38 @@ bool SettingsDisableElrail(int32 p1)
/* if it is an electric rail engine and its railtype is the wrong one */
if (rv_info->engclass == 2 && rv_info->railtype == old_railtype) {
/* change it to the proper one */
rv_info->railtype = new_railtype;
}
/* when disabling elrails, make sure that all existing trains can run on
* normal rail too */
if (disable) {
FOR_ALL_TRAINS(t) {
if (t->railtype == RAILTYPE_ELECTRIC) {
/* this railroad vehicle is now compatible only with elrail,
* so add there also normal rail compatibility */
t->compatible_railtypes |= RAILTYPES_RAIL;
t->railtype = RAILTYPE_RAIL;
SetBit(t->flags, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL);
/* Fix the total power and acceleration for trains */
/* power and acceleration is cached only for front engines */
if (IsFrontEngine(t)) {
if (t->IsFrontEngine()) {
TrainPowerChanged(t);
UpdateTrainAcceleration(t);
FOR_ALL_COMPANIES(c) c->avail_railtypes = GetCompanyRailtypes(c->index);
/* This resets the _last_built_railtype, which will be invalid for electric
* rails. It may have unintended consequences if that function is ever
* extended, though. */
ReinitGuiAfterToggleElrail(disable);
return true;