CheckCompanyHasMoney() was also executed when not using DC_EXEC, resulting in an error about shortage of money instead of the estimation. This mostly is a problem for AI players, as they will have no way to know how much it would have cost.
This commit is contained in:
@@ -21,6 +21,9 @@
|
|||||||
* \li AICargo::GetName
|
* \li AICargo::GetName
|
||||||
* \li AIPriorityQueue
|
* \li AIPriorityQueue
|
||||||
*
|
*
|
||||||
|
* Other changes:
|
||||||
|
* \li AIVehicle::CloneVehicle now correctly returns estimate when short on cash
|
||||||
|
*
|
||||||
* \b 1.10.0
|
* \b 1.10.0
|
||||||
*
|
*
|
||||||
* API additions:
|
* API additions:
|
||||||
|
@@ -987,16 +987,14 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|||||||
|
|
||||||
/* Now clone the vehicle's name, if it has one. */
|
/* Now clone the vehicle's name, if it has one. */
|
||||||
if (!v_front->name.empty()) CloneVehicleName(v_front, w_front);
|
if (!v_front->name.empty()) CloneVehicleName(v_front, w_front);
|
||||||
}
|
|
||||||
|
|
||||||
/* Since we can't estimate the cost of cloning a vehicle accurately we must
|
/* Since we can't estimate the cost of cloning a vehicle accurately we must
|
||||||
* check whether the company has enough money manually. */
|
* check whether the company has enough money manually. */
|
||||||
if (!CheckCompanyHasMoney(total_cost)) {
|
if (!CheckCompanyHasMoney(total_cost)) {
|
||||||
if (flags & DC_EXEC) {
|
|
||||||
/* The vehicle has already been bought, so now it must be sold again. */
|
/* The vehicle has already been bought, so now it must be sold again. */
|
||||||
DoCommand(w_front->tile, w_front->index | 1 << 20, 0, flags, GetCmdSellVeh(w_front));
|
DoCommand(w_front->tile, w_front->index | 1 << 20, 0, flags, GetCmdSellVeh(w_front));
|
||||||
|
return total_cost;
|
||||||
}
|
}
|
||||||
return total_cost;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return total_cost;
|
return total_cost;
|
||||||
|
Reference in New Issue
Block a user