# HG changeset patch # User bjarni # Date 1131491889 0 # Node ID 7546b838230b516db11b2f842a58906d5d640f00 # Parent a9e1a187de99024aa8e3c99d0833b395e28b5aa7 (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 diff -r a9e1a187de99 -r 7546b838230b aircraft_cmd.c --- a/aircraft_cmd.c Mon Nov 07 23:20:47 2005 +0000 +++ b/aircraft_cmd.c Tue Nov 08 23:18:09 2005 +0000 @@ -291,7 +291,8 @@ 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 @@ // 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 -r a9e1a187de99 -r 7546b838230b roadveh_cmd.c --- a/roadveh_cmd.c Mon Nov 07 23:20:47 2005 +0000 +++ b/roadveh_cmd.c Tue Nov 08 23:18:09 2005 +0000 @@ -193,7 +193,8 @@ 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 @@ 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 -r a9e1a187de99 -r 7546b838230b ship_cmd.c --- a/ship_cmd.c Mon Nov 07 23:20:47 2005 +0000 +++ b/ship_cmd.c Tue Nov 08 23:18:09 2005 +0000 @@ -921,7 +921,8 @@ 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 @@ 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 -r a9e1a187de99 -r 7546b838230b train_cmd.c --- a/train_cmd.c Mon Nov 07 23:20:47 2005 +0000 +++ b/train_cmd.c Tue Nov 08 23:18:09 2005 +0000 @@ -773,12 +773,13 @@ 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 @@ 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);