diff options
author | bjarni <bjarni@openttd.org> | 2006-10-04 12:01:59 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-10-04 12:01:59 +0000 |
commit | f8f0bd4943cc5c6ccdcf4f9fe8dc4b03c64f6f3f (patch) | |
tree | de1248467189ac58bfefca72dc98668d05a651bf /train_cmd.c | |
parent | 5bb5da02ad2f1a02462aa1d39777ec5d1d897266 (diff) | |
download | openttd-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 'train_cmd.c')
-rw-r--r-- | train_cmd.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/train_cmd.c b/train_cmd.c index 5c1abe6ae..e1c0ac017 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -3476,55 +3476,6 @@ void Train_Tick(Vehicle *v) } } - -void TrainEnterDepot(Vehicle *v, TileIndex tile) -{ - UpdateSignalsOnSegment(tile, GetRailDepotDirection(tile)); - - if (!IsFrontEngine(v)) v = GetFirstVehicleInChain(v); - - VehicleServiceInDepot(v); - - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - - v->load_unload_time_rem = 0; - v->cur_speed = 0; - - 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_RAIL_VEHICLE); - 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)) { // Part of the orderlist? - v->u.rail.days_since_order_progr = 0; - v->cur_order_index++; - } else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) { // User initiated? - v->vehstatus |= VS_STOPPED; - if (v->owner == _local_player) { - SetDParam(0, v->unitnumber); - AddNewsItem( - STR_8814_TRAIN_IS_WAITING_IN_DEPOT, - NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), - v->index, - 0 - ); - } - } - } - InvalidateWindowClasses(WC_TRAINS_LIST); -} - #define MAX_ACCEPTABLE_DEPOT_DIST 16 static void CheckIfTrainNeedsService(Vehicle *v) |