--- a/src/ship_cmd.cpp Wed Jun 13 12:05:56 2007 +0000
+++ b/src/ship_cmd.cpp Tue Jun 19 07:21:01 2007 +0000
@@ -175,7 +175,7 @@
void OnNewDay_Ship(Vehicle *v)
{
- int32 cost;
+ CommandCost cost;
if ((++v->day_counter & 7) == 0)
DecreaseVehicleValue(v);
@@ -280,7 +280,8 @@
if (order->type == v->current_order.type &&
order->flags == v->current_order.flags &&
- order->dest == v->current_order.dest)
+ order->dest == v->current_order.dest &&
+ (order->type != OT_GOTO_STATION || GetStation(order->dest)->dock_tile != 0))
return;
v->current_order = *order;
@@ -294,6 +295,8 @@
st = GetStation(order->dest);
if (st->dock_tile != 0) {
v->dest_tile = TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
+ } else {
+ v->cur_order_index++;
}
} else if (order->type == OT_GOTO_DEPOT) {
v->dest_tile = GetDepot(order->dest)->xy;
@@ -400,7 +403,7 @@
return (t < v->progress);
}
-static int32 EstimateShipCost(EngineID engine_type)
+static CommandCost EstimateShipCost(EngineID engine_type)
{
return GetEngineProperty(engine_type, 0x0A, ShipVehInfo(engine_type)->base_cost) * (_eco->GetPrice(CEconomy::SHIP_BASE) >> 3) >> 5;
}
@@ -806,9 +809,9 @@
* @param p1 ship type being built (engine)
* @param p2 bit 0 when set, the unitnumber will be 0, otherwise it will be a free number
*/
-int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
+CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- int32 value;
+ CommandCost value;
Vehicle *v;
UnitID unit_num;
Engine *e;
@@ -901,7 +904,7 @@
* @param p1 vehicle ID to be sold
* @param p2 unused
*/
-int32 CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
+CommandCost CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
@@ -935,7 +938,7 @@
* @param p1 ship ID to start/stop
* @param p2 unused
*/
-int32 CmdStartStopShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
+CommandCost CmdStartStopShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
uint16 callback;
@@ -976,7 +979,7 @@
* - p2 bit 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot)
*/
-int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
+CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
const Depot *dep;
@@ -1053,10 +1056,10 @@
* - p2 = (bit 16) - refit only this vehicle (ignored)
* @return cost of refit or error
*/
-int32 CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
+CommandCost CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
- int32 cost;
+ CommandCost cost;
CargoID new_cid = GB(p2, 0, 8); //gets the cargo number
byte new_subtype = GB(p2, 8, 8);
uint16 capacity = CALLBACK_FAILED;