Build and refit vehicle test no longer needs to match exec command.

This commit is contained in:
Jonathan G Rennison
2017-02-13 18:45:40 +00:00
parent 4550ac39b9
commit fba4268127
4 changed files with 13 additions and 0 deletions

View File

@@ -177,6 +177,14 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
}
}
}
/* Since we can't estimate the cost of build and refitting a vehicle accurately we must
* check whether the company has enough money manually. */
if (!CheckCompanyHasMoney(value)) {
if (flags & DC_EXEC) {
/* The vehicle has already been bought, so now it must be sold again. */
DoCommand(tile, v->index, 0, flags, GetCmdSellVeh(type));
}
}
}
return value;