TBTR: Fix crash and issues when using a no longer available engine type.

Show error messages when cloning a vehicle to a template
or virtual vehicle fails.
Handle failed clones gracefully.
Bypass engine availability check when doing a template edit action.
Show correct error message if template replacement fails for
a non-money reason.
This commit is contained in:
Jonathan G Rennison
2016-02-15 02:31:26 +00:00
parent d9a48a2b5e
commit 5850bcf699
8 changed files with 71 additions and 40 deletions

View File

@@ -161,7 +161,7 @@ public:
this->vehicle_over = INVALID_VEHICLE;
if (to_edit) {
DoCommandP(0, to_edit->index, 0, CMD_VIRTUAL_TRAIN_FROM_TEMPLATE_VEHICLE, CcSetVirtualTrain);
DoCommandP(0, to_edit->index, 0, CMD_VIRTUAL_TRAIN_FROM_TEMPLATE_VEHICLE | CMD_MSG(STR_TMPL_CANT_CREATE), CcSetVirtualTrain);
}
this->resize.step_height = 1;
@@ -265,7 +265,7 @@ public:
}
// create a new one
DoCommandP(0, v->index, 0, CMD_VIRTUAL_TRAIN_FROM_TRAIN, CcSetVirtualTrain);
DoCommandP(0, v->index, 0, CMD_VIRTUAL_TRAIN_FROM_TRAIN | CMD_MSG(STR_TMPL_CANT_CREATE), CcSetVirtualTrain);
this->ToggleWidgetLoweredState(TCW_CLONE);
ResetObjectToPlace();
this->SetDirty();