Merge branch 'template_train_replacement' into jgrpp

# Conflicts:
#	src/saveload/extended_ver_sl.cpp
This commit is contained in:
Jonathan G Rennison
2018-10-18 23:57:20 +01:00
9 changed files with 62 additions and 4 deletions

View File

@@ -951,6 +951,35 @@ CommandCost CmdToggleRefitAsTemplate(TileIndex tile, DoCommandFlag flags, uint32
return CommandCost();
}
/**
* Toggles replace old only on a template vehicle.
* @param tile unused
* @param flags type of operation
* @param p1 the template vehicle's index
* @param p2 unused
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdToggleTemplateReplaceOldOnly(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
// Identify template to toggle
TemplateVehicle *template_vehicle = TemplateVehicle::GetIfValid(p1);
if (template_vehicle == NULL) {
return CMD_ERROR;
}
bool should_execute = (flags & DC_EXEC) != 0;
if (should_execute) {
template_vehicle->ToggleReplaceOldOnly();
InvalidateWindowClassesData(WC_TEMPLATEGUI_MAIN, 0);
}
return CommandCost();
}
/**
* Create a virtual train from a template vehicle.
* @param tile unused