mirror of https://github.com/OpenTTD/OpenTTD
(svn r1556) -Fix: Vehicle list updates should now really work
parent
4559279686
commit
5bcf3d2bc0
|
@ -299,6 +299,7 @@ static void DoDeleteAircraft(Vehicle *v)
|
|||
RebuildVehicleLists();
|
||||
InvalidateWindow(WC_COMPANY, v->owner);
|
||||
DeleteVehicleChain(v);
|
||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||
}
|
||||
|
||||
// p1 = vehicle
|
||||
|
@ -343,6 +344,7 @@ int32 CmdStartStopAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
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 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ void OnNewDay_Aircraft(Vehicle *v)
|
|||
SubtractMoneyFromPlayerFract(v->owner, cost);
|
||||
|
||||
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||
}
|
||||
|
||||
void AircraftYearlyLoop()
|
||||
|
@ -1068,7 +1058,7 @@ static void ProcessAircraftOrder(Vehicle *v)
|
|||
|
||||
InvalidateVehicleOrder(v);
|
||||
|
||||
InvalidateAircraftWindows(v);
|
||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||
}
|
||||
|
||||
static void HandleAircraftLoading(Vehicle *v, int mode)
|
||||
|
@ -1206,6 +1196,7 @@ static void AircraftEntersTerminal(Vehicle *v)
|
|||
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 @@ static void AircraftEnterHangar(Vehicle *v)
|
|||
Order old_order;
|
||||
|
||||
ServiceAircraft(v);
|
||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||
|
||||
MaybeReplaceVehicle(v);
|
||||
|
||||
|
@ -1229,7 +1221,7 @@ static void AircraftEnterHangar(Vehicle *v)
|
|||
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 @@ static void AircraftLeaveHangar(Vehicle *v)
|
|||
VehicleServiceInDepot(v);
|
||||
SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
|
||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1034,7 +1034,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
|
|||
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;
|
||||
|
|
|
@ -343,8 +343,8 @@ int32 CmdSkipOrder(int x, int y, uint32 flags, uint32 vehicle_id, uint32 not_use
|
|||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
|
23
ship_cmd.c
23
ship_cmd.c
|
@ -21,19 +21,6 @@ static byte GetTileShipTrackStatus(uint tile) {
|
|||
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 @@ void OnNewDay_Ship(Vehicle *v)
|
|||
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 @@ static void HandleBrokenShip(Vehicle *v)
|
|||
if (!(v->tick_counter & 1)) {
|
||||
if (!--v->breakdown_delay) {
|
||||
v->breakdown_ctr = 0;
|
||||
InvalidateShipWindows(v);
|
||||
InvalidateWindowClasses(WC_SHIPS_LIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +257,7 @@ static void ProcessShipOrder(Vehicle *v)
|
|||
|
||||
InvalidateVehicleOrder(v);
|
||||
|
||||
InvalidateShipWindows(v);
|
||||
InvalidateWindowClasses(WC_SHIPS_LIST);
|
||||
}
|
||||
|
||||
static void HandleShipLoading(Vehicle *v)
|
||||
|
@ -370,6 +359,7 @@ static void CheckShipLeaveDepot(Vehicle *v)
|
|||
|
||||
PlayShipSound(v);
|
||||
VehicleServiceInDepot(v);
|
||||
InvalidateWindowClasses(WC_SHIPS_LIST);
|
||||
}
|
||||
|
||||
static bool ShipAccelerate(Vehicle *v)
|
||||
|
@ -443,6 +433,7 @@ static void ShipEnterDepot(Vehicle *v)
|
|||
}
|
||||
}
|
||||
}
|
||||
InvalidateWindowClasses(WC_SHIPS_LIST);
|
||||
}
|
||||
|
||||
static void ShipArrivesAt(Vehicle *v, Station *st)
|
||||
|
@ -931,7 +922,7 @@ int32 CmdStartStopShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
||||
}
|
||||
|
||||
InvalidateShipWindows(v);
|
||||
InvalidateWindowClasses(WC_SHIPS_LIST);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -982,7 +982,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
|
|||
DrawVehicleProfitButton(v, x, y + 13);
|
||||
|
||||
SetDParam(0, v->unitnumber);
|
||||
if (IsShipDepotTile(v->tile))
|
||||
if (IsShipDepotTile(v->tile) && (v->vehstatus & VS_HIDDEN))
|
||||
str = STR_021F;
|
||||
else
|
||||
str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2;
|
||||
|
|
Loading…
Reference in New Issue