Mercurial > hg > openttd
changeset 1055:f9adc7b96c71 draft
(svn r1556) -Fix: Vehicle list updates should now really work
author | Celestar <Celestar@openttd.org> |
---|---|
date | Tue, 18 Jan 2005 09:35:31 +0000 |
parents | d211e5b46ee1 |
children | 233dfe0cbb17 |
files | aircraft_cmd.c aircraft_gui.c order_cmd.c ship_cmd.c ship_gui.c vehicle.h |
diffstat | 6 files changed, 19 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -299,6 +299,7 @@ RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); DeleteVehicleChain(v); + InvalidateWindowClasses(WC_AIRCRAFT_LIST); } // p1 = vehicle @@ -343,6 +344,7 @@ v->vehstatus ^= VS_STOPPED; InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + InvalidateWindowClasses(WC_AIRCRAFT_LIST); } return 0; @@ -505,19 +507,6 @@ } } -void InvalidateAircraftWindows(const Vehicle *v) -{ - const Order *order; - - InvalidateWindow(WC_AIRCRAFT_LIST, v->owner); - - FOR_VEHICLE_ORDERS(v, order) { - if (order->type == OT_GOTO_STATION ) { - InvalidateWindow(WC_AIRCRAFT_LIST, (order->station << 16) | v->owner); - } - } -} - void OnNewDay_Aircraft(Vehicle *v) { int32 cost; @@ -545,6 +534,7 @@ SubtractMoneyFromPlayerFract(v->owner, cost); InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + InvalidateWindowClasses(WC_AIRCRAFT_LIST); } void AircraftYearlyLoop() @@ -1068,7 +1058,7 @@ InvalidateVehicleOrder(v); - InvalidateAircraftWindows(v); + InvalidateWindowClasses(WC_AIRCRAFT_LIST); } static void HandleAircraftLoading(Vehicle *v, int mode) @@ -1206,6 +1196,7 @@ SET_EXPENSES_TYPE(EXPENSES_AIRCRAFT_INC); LoadUnloadVehicle(v); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); + InvalidateWindowClasses(WC_AIRCRAFT_LIST); } static void AircraftEnterHangar(Vehicle *v) @@ -1213,6 +1204,7 @@ Order old_order; ServiceAircraft(v); + InvalidateWindowClasses(WC_AIRCRAFT_LIST); MaybeReplaceVehicle(v); @@ -1229,7 +1221,7 @@ v->cur_order_index++; } else if (old_order.flags & OF_FULL_LOAD) { // force depot visit v->vehstatus |= VS_STOPPED; - InvalidateAircraftWindows(v); + InvalidateWindowClasses(WC_AIRCRAFT_LIST); if (v->owner == _local_player) { SetDParam(0, v->unitnumber); @@ -1291,6 +1283,7 @@ VehicleServiceInDepot(v); SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + InvalidateWindowClasses(WC_AIRCRAFT_LIST); }
--- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -1034,7 +1034,7 @@ DrawVehicleProfitButton(v, x, y + 13); SetDParam(0, v->unitnumber); - if (IsAircraftHangarTile(v->tile)) + if (IsAircraftHangarTile(v->tile) && (v->vehstatus & VS_HIDDEN)) str = STR_021F; else str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2;
--- a/order_cmd.c +++ b/order_cmd.c @@ -343,8 +343,8 @@ } /* We have an aircraft/ship, they have a mini-schedule, so update them all */ - if (v->type == VEH_Aircraft) InvalidateAircraftWindows(v); - if (v->type == VEH_Ship) InvalidateShipWindows(v); + if (v->type == VEH_Aircraft) InvalidateWindowClasses(WC_AIRCRAFT_LIST); + if (v->type == VEH_Ship) InvalidateWindowClasses(WC_SHIPS_LIST); return 0; }
--- a/ship_cmd.c +++ b/ship_cmd.c @@ -21,19 +21,6 @@ return r | r >> 8; } -void InvalidateShipWindows(const Vehicle *v) -{ - const Order *order; - - InvalidateWindow(WC_SHIPS_LIST, v->owner); - - FOR_VEHICLE_ORDERS(v, order) { - if (order->type == OT_GOTO_STATION ) { - InvalidateWindow(WC_SHIPS_LIST, (order->station << 16) | v->owner); - } - } -} - void DrawShipEngine(int x, int y, int engine, uint32 image_ormod) { int spritenum = ShipVehInfo(engine)->image_index; @@ -159,6 +146,8 @@ SubtractMoneyFromPlayerFract(v->owner, cost); InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + //we need this for the profit + InvalidateWindowClasses(WC_SHIPS_LIST); } static void HandleBrokenShip(Vehicle *v) @@ -186,7 +175,7 @@ if (!(v->tick_counter & 1)) { if (!--v->breakdown_delay) { v->breakdown_ctr = 0; - InvalidateShipWindows(v); + InvalidateWindowClasses(WC_SHIPS_LIST); } } } @@ -268,7 +257,7 @@ InvalidateVehicleOrder(v); - InvalidateShipWindows(v); + InvalidateWindowClasses(WC_SHIPS_LIST); } static void HandleShipLoading(Vehicle *v) @@ -370,6 +359,7 @@ PlayShipSound(v); VehicleServiceInDepot(v); + InvalidateWindowClasses(WC_SHIPS_LIST); } static bool ShipAccelerate(Vehicle *v) @@ -443,6 +433,7 @@ } } } + InvalidateWindowClasses(WC_SHIPS_LIST); } static void ShipArrivesAt(Vehicle *v, Station *st) @@ -931,7 +922,7 @@ InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); } - InvalidateShipWindows(v); + InvalidateWindowClasses(WC_SHIPS_LIST); return 0; }