Fix no error message when attaching new template/virtual vehicle fails

See: #187
This commit is contained in:
Jonathan G Rennison
2020-09-08 23:56:38 +01:00
parent ff12051ee1
commit 11a9a4dc0c
5 changed files with 42 additions and 2 deletions

View File

@@ -1396,7 +1396,10 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u
auto check_on_failure = [&](CommandCost cost) -> CommandCost {
if (delete_failed_virtual && src->IsVirtual()) {
return DoCommand(src->tile, src->index | (1 << 21), 0, flags, CMD_SELL_VEHICLE);
CommandCost res = DoCommand(src->tile, src->index | (1 << 21), 0, flags, CMD_SELL_VEHICLE);
if (res.Failed() || cost.GetErrorMessage() == INVALID_STRING_ID) return res;
cost.MakeSuccessWithMessage();
return cost;
} else {
return cost;
}