diff options
author | frosch <frosch@openttd.org> | 2009-12-19 17:14:35 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-12-19 17:14:35 +0000 |
commit | f94677520555051c12886b57b4f4df87f7267e62 (patch) | |
tree | 998106bccb45dad5597c3ff3d1ea9aae30b03cce | |
parent | 07a2c21d245aa5aee397d2daf120e468d39f4176 (diff) | |
download | openttd-f94677520555051c12886b57b4f4df87f7267e62.tar.xz |
(svn r18540) -Codechange: resulting in better name for 'result'.
-rw-r--r-- | src/economy.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index c9e9fa572..76c32533e 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1135,7 +1135,8 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) int unloading_time = 0; Vehicle *u = v; - int result = 0; + bool dirty_vehicle = false; + bool dirty_station = false; bool completely_emptied = true; bool anything_unloaded = false; @@ -1175,7 +1176,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) /* The cargo has reached it's final destination, the packets may now be destroyed */ remaining = v->cargo.MoveTo<StationCargoList>(NULL, amount_unloaded, VehicleCargoList::MTA_FINAL_DELIVERY, payment, last_visited); - result |= 1; + dirty_vehicle = true; accepted = true; } @@ -1188,7 +1189,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded, u->current_order.GetUnloadType() & OUFB_TRANSFER ? VehicleCargoList::MTA_TRANSFER : VehicleCargoList::MTA_UNLOAD, payment); SetBit(ge->acceptance_pickup, GoodsEntry::PICKUP); - result |= 2; + dirty_vehicle = dirty_station = true; } else if (!accepted) { /* The order changed while unloading (unset unload/transfer) or the * station does not accept our goods. */ @@ -1279,7 +1280,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) unloading_time += cap; - result |= 2; + dirty_vehicle = dirty_station = true; } if (v->cargo.Count() >= v->cargo_cap) { @@ -1367,14 +1368,14 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) TriggerVehicle(v, VEHICLE_TRIGGER_EMPTY); } - if (result != 0) { + if (dirty_vehicle) { SetWindowDirty(GetWindowClassForVehicleType(v->type), v->owner); SetWindowDirty(WC_VEHICLE_DETAILS, v->index); - - st->MarkTilesDirty(true); v->MarkDirty(); - - if (result & 2) SetWindowDirty(WC_STATION_VIEW, last_visited); + } + if (dirty_station) { + st->MarkTilesDirty(true); + SetWindowDirty(WC_STATION_VIEW, last_visited); } } |