|
@@ -712,13 +712,13 @@ static CommandCost ReplaceChain(Vehicle
|
|
|
* @param flags type of operation
|
|
|
* @param p1 Index of vehicle
|
|
|
* @param p2 not used
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
Vehicle *v = Vehicle::GetIfValid(p1);
|
|
|
if (v == nullptr) return CMD_ERROR;
|
|
|
|
|
|
CommandCost ret = CheckOwnership(v->owner);
|
|
|
if (ret.Failed()) return ret;
|
|
@@ -805,13 +805,13 @@ CommandCost CmdAutoreplaceVehicle(TileIn
|
|
|
* @param p2 packed data
|
|
|
* - bits 0-15 = old engine type
|
|
|
* - bits 16-31 = new engine type
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
Company *c = Company::GetIfValid(_current_company);
|
|
|
if (c == nullptr) return CMD_ERROR;
|
|
|
|
|
|
EngineID old_engine_type = GB(p2, 0, 16);
|
|
|
EngineID new_engine_type = GB(p2, 16, 16);
|