summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-27 14:37:46 +0000
committerrubidium <rubidium@openttd.org>2007-06-27 14:37:46 +0000
commit0c8ca15c18692fb720d5054da2b9ce8308960cc2 (patch)
tree1b863a0cac6079c3a98197e3fcb30139a8ab1899
parent52fbdd62a2efcd0b22452095eb6efbd6930e13a8 (diff)
downloadopenttd-0c8ca15c18692fb720d5054da2b9ce8308960cc2.tar.xz
(svn r10354) -Fix [FS#950]: loading indicator showed "^" when the train would load at the given station.
-rw-r--r--src/vehicle.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 9ed457f18..79e10a1e0 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2272,22 +2272,27 @@ uint8 CalcPercentVehicleFilled(Vehicle *v, StringID *color)
int max = 0;
int cars = 0;
int unloading = 0;
+ bool loading = false;
assert(color != NULL);
+ const Vehicle *u = v;
+ const Station *st = GetStation(v->last_station_visited);
+
/* Count up max and used */
for (; v != NULL; v = v->next) {
count += v->cargo.Count();
max += v->cargo_cap;
if (v->cargo_cap != 0) {
unloading += HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0;
+ loading |= (u->current_order.flags & OF_UNLOAD) == 0 && st->goods[v->cargo_type].days_since_pickup != 255;
cars++;
}
}
- if (unloading == 0) *color = STR_PERCENT_UP;
- else if (cars == unloading) *color = STR_PERCENT_DOWN;
- else *color = STR_PERCENT_UP_DOWN;
+ if (unloading == 0 && loading) *color = STR_PERCENT_UP;
+ else if (cars == unloading || !loading) *color = STR_PERCENT_DOWN;
+ else *color = STR_PERCENT_UP_DOWN;
/* Train without capacity */
if (max == 0) return 100;