diff options
author | bjarni <bjarni@openttd.org> | 2005-11-08 23:18:09 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2005-11-08 23:18:09 +0000 |
commit | 1b3e626ff93738d4e549833d43f9f7fba7a70a43 (patch) | |
tree | 285ee5a9f639c628b2201866501b9654709c0787 | |
parent | df6c48fdba7933e30a16c82e69d8d57ab9515e6d (diff) | |
download | openttd-1b3e626ff93738d4e549833d43f9f7fba7a70a43.tar.xz |
(svn r3156) -Fix: removed some cases where autoreplace windows were redrawn when nothing was changed
due to the FOR_ALL_VEHICLES(), redrawing those windows are slow
-rw-r--r-- | aircraft_cmd.c | 6 | ||||
-rw-r--r-- | roadveh_cmd.c | 6 | ||||
-rw-r--r-- | ship_cmd.c | 6 | ||||
-rw-r--r-- | train_cmd.c | 7 |
4 files changed, 17 insertions, 8 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c index f096b92d4..4dc24106f 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -291,7 +291,8 @@ int32 CmdBuildAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2) InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Aircraft); //updates the replace Aircraft window + if (IsLocalPlayer()) + InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Aircraft); //updates the replace Aircraft window } return value; @@ -348,7 +349,8 @@ int32 CmdSellAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2) // Invalidate depot InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); DoDeleteAircraft(v); - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Aircraft); // updates the replace Aircraft window + if (IsLocalPlayer()) + InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Aircraft); // updates the replace Aircraft window } return -(int32)v->value; diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 32a2fd25d..9ed41a694 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -193,7 +193,8 @@ int32 CmdBuildRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2) InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road); // updates the replace Road window + if (IsLocalPlayer()) + InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road); // updates the replace Road window } return cost; @@ -263,8 +264,9 @@ int32 CmdSellRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2) DeleteWindowById(WC_VEHICLE_VIEW, v->index); ClearSlot(v, v->u.road.slot); DeleteVehicle(v); + if (IsLocalPlayer()) + InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road); // updates the replace Road window } - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road); // updates the replace Road window return -(int32)v->value; } diff --git a/ship_cmd.c b/ship_cmd.c index e0e099009..887fd70d2 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -921,7 +921,8 @@ int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2) InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window + if (IsLocalPlayer()) + InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window } return value; @@ -953,7 +954,8 @@ int32 CmdSellShip(int x, int y, uint32 flags, uint32 p1, uint32 p2) InvalidateWindow(WC_COMPANY, v->owner); DeleteWindowById(WC_VEHICLE_VIEW, v->index); DeleteVehicle(v); - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window + if (IsLocalPlayer()) + InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window } return -(int32)v->value; diff --git a/train_cmd.c b/train_cmd.c index e5daaf014..71013483d 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -773,12 +773,13 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) InvalidateWindow(WC_VEHICLE_DEPOT, tile); RebuildVehicleLists(); InvalidateWindow(WC_COMPANY, v->owner); + if (IsLocalPlayer()) { + InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window + } } } _cmd_build_rail_veh_score = _railveh_score[p1]; - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window - return value; } @@ -1128,6 +1129,8 @@ int32 CmdSellRailWagon(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (flags & DC_EXEC) { if (v == first && first->subtype == TS_Front_Engine) { DeleteWindowById(WC_VEHICLE_VIEW, first->index); + } + if (IsLocalPlayer() && (p1 == 1 || !(RailVehInfo(v->engine_type)->flags & RVI_WAGON))) { InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); } InvalidateWindow(WC_VEHICLE_DEPOT, first->tile); |