--- a/aircraft_cmd.c Sat Jan 15 08:58:31 2005 +0000
+++ b/aircraft_cmd.c Sat Jan 15 09:28:08 2005 +0000
@@ -508,13 +508,13 @@
}
}
-void InvalidateAircraftWindows(Vehicle *v)
+void InvalidateAircraftWindows(const Vehicle *v)
{
- Order *o;
+ const Order *o;
InvalidateWindow(WC_AIRCRAFT_LIST, v->owner);
- for ( o = v->schedule_ptr; o->type != OT_NOTHING; o++, i++) {
+ for ( o = v->schedule_ptr; o->type != OT_NOTHING; o++) {
if (o->type == OT_GOTO_STATION ) {
InvalidateWindow(WC_AIRCRAFT_LIST, o->station << 16 | v->owner);
}
@@ -548,8 +548,6 @@
SubtractMoneyFromPlayerFract(v->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-
- InvalidateAircraftWindows(v);
}
void AircraftYearlyLoop()
@@ -1084,6 +1082,8 @@
}
InvalidateVehicleOrderWidget(v);
+
+ InvalidateAircraftWindows(v);
}
static void HandleAircraftLoading(Vehicle *v, int mode)
--- a/order_cmd.c Sat Jan 15 08:58:31 2005 +0000
+++ b/order_cmd.c Sat Jan 15 09:28:08 2005 +0000
@@ -140,9 +140,9 @@
/* p1 = vehicle */
int32 CmdSkipOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
+ Vehicle *v = GetVehicle(p1);
+
if (flags & DC_EXEC) {
- Vehicle *v = GetVehicle(p1);
-
{
byte b = v->cur_order_index + 1;
if (b >= v->num_orders) b = 0;
@@ -159,6 +159,13 @@
InvalidateWindow(WC_VEHICLE_ORDERS, v->index);
}
+
+ //we have an aircraft, they have a mini-schedule, so update them all
+ if (v->type == VEH_Aircraft) InvalidateAircraftWindows(v);
+
+ //same goes for ships
+ if (v->type == VEH_Ship) InvalidateShipWindows(v);
+
return 0;
}
--- a/ship_cmd.c Sat Jan 15 08:58:31 2005 +0000
+++ b/ship_cmd.c Sat Jan 15 09:28:08 2005 +0000
@@ -21,6 +21,19 @@
return r | r >> 8;
}
+void InvalidateShipWindows(const Vehicle *v)
+{
+ const Order *o;
+
+ InvalidateWindow(WC_SHIPS_LIST, v->owner);
+
+ for ( o = v->schedule_ptr; o->type != OT_NOTHING; o++) {
+ if (o->type == OT_GOTO_STATION ) {
+ InvalidateWindow(WC_SHIPS_LIST, o->station << 16 | v->owner);
+ }
+ }
+}
+
void DrawShipEngine(int x, int y, int engine, uint32 image_ormod)
{
int spritenum = ShipVehInfo(engine)->image_index;
@@ -146,7 +159,6 @@
SubtractMoneyFromPlayerFract(v->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
- InvalidateWindow(WC_SHIPS_LIST, v->owner);
}
static void HandleBrokenShip(Vehicle *v)
@@ -174,7 +186,7 @@
if (!(v->tick_counter & 1)) {
if (!--v->breakdown_delay) {
v->breakdown_ctr = 0;
- InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+ InvalidateShipWindows(v);
}
}
}
@@ -253,6 +265,8 @@
v->dest_tile = 0;
}
InvalidateVehicleOrderWidget(v);
+
+ InvalidateShipWindows(v);
}
static void HandleShipLoading(Vehicle *v)
@@ -918,6 +932,8 @@
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
}
+ InvalidateShipWindows(v);
+
return 0;
}
--- a/vehicle.h Sat Jan 15 08:58:31 2005 +0000
+++ b/vehicle.h Sat Jan 15 09:28:08 2005 +0000
@@ -402,6 +402,9 @@
bool VehicleNeedsService(const Vehicle *v);
+void InvalidateAircraftWindows(const Vehicle *v);
+void InvalidateShipWindows(const Vehicle *v);
+
typedef struct GetNewVehiclePosResult {
int x,y;
uint old_tile;