summaryrefslogtreecommitdiff
path: root/ship_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-10-04 12:01:59 +0000
committerbjarni <bjarni@openttd.org>2006-10-04 12:01:59 +0000
commitf8f0bd4943cc5c6ccdcf4f9fe8dc4b03c64f6f3f (patch)
treede1248467189ac58bfefca72dc98668d05a651bf /ship_cmd.c
parent5bb5da02ad2f1a02462aa1d39777ec5d1d897266 (diff)
downloadopenttd-f8f0bd4943cc5c6ccdcf4f9fe8dc4b03c64f6f3f.tar.xz
(svn r6637) -Codechange: merged all (vehicle type)EnterDepot into VehicleEnterDepot()
This revealed duplicated code like aircraft lists got invalidated twice Moved invalidation of the vehicle detail window to VehicleServiceInDepot() as it should always be updated when serviced
Diffstat (limited to 'ship_cmd.c')
-rw-r--r--ship_cmd.c48
1 files changed, 2 insertions, 46 deletions
diff --git a/ship_cmd.c b/ship_cmd.c
index 913fa93ce..857e1d385 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -316,7 +316,7 @@ static void UpdateShipDeltaXY(Vehicle *v, int dir)
v->sprite_height = GB(x, 24, 8);
}
-static void RecalcShipStuff(Vehicle *v)
+void RecalcShipStuff(Vehicle *v)
{
UpdateShipDeltaXY(v, v->direction);
v->cur_image = GetShipImage(v, v->direction);
@@ -391,50 +391,6 @@ static int32 EstimateShipCost(EngineID engine_type)
return ShipVehInfo(engine_type)->base_cost * (_price.ship_base>>3)>>5;
}
-static void ShipEnterDepot(Vehicle *v)
-{
- v->u.ship.state = 0x80;
- v->vehstatus |= VS_HIDDEN;
- v->cur_speed = 0;
- RecalcShipStuff(v);
-
- VehicleServiceInDepot(v);
-
- InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-
- TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT);
-
- if (v->current_order.type == OT_GOTO_DEPOT) {
- Order t;
- int32 cost;
-
- InvalidateWindow(WC_VEHICLE_VIEW, v->index);
-
- t = v->current_order;
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
-
- _current_player = v->owner;
- cost = DoCommand(v->tile, v->index, t.refit_cargo | t.refit_subtype << 8, DC_EXEC, CMD_REFIT_SHIP);
- if (!CmdFailed(cost) && v->owner == _local_player && cost != 0) ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost);
-
- if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
- v->cur_order_index++;
- } else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
- v->vehstatus |= VS_STOPPED;
- if (v->owner == _local_player) {
- SetDParam(0, v->unitnumber);
- AddNewsItem(
- STR_981C_SHIP_IS_WAITING_IN_DEPOT,
- NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
- v->index,
- 0);
- }
- }
- }
- InvalidateWindowClasses(WC_SHIPS_LIST);
-}
-
static void ShipArrivesAt(const Vehicle* v, Station* st)
{
/* Check if station was ever visited before */
@@ -731,7 +687,7 @@ static void ShipController(Vehicle *v)
if (v->dest_tile == gp.new_tile) {
if (v->current_order.type == OT_GOTO_DEPOT) {
if ((gp.x&0xF)==8 && (gp.y&0xF)==8) {
- ShipEnterDepot(v);
+ VehicleEnterDepot(v);
return;
}
} else if (v->current_order.type == OT_GOTO_STATION) {