summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2008-08-18 16:52:40 +0000
committercelestar <celestar@openttd.org>2008-08-18 16:52:40 +0000
commit1fa55e4ec0117d9c3607f8730db5aad69bd9340b (patch)
tree5b0ecf13a8ec0041ff1289769acbddf67dda4426 /src
parent141001d031455b954dc98647e9b9ea6581dae764 (diff)
downloadopenttd-1fa55e4ec0117d9c3607f8730db5aad69bd9340b.tar.xz
(svn r14098) -Fix: Make the 'Transfer Credit' display aware of the entire consist, not only the first vehicle
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_gui.cpp4
-rw-r--r--src/roadveh_gui.cpp5
-rw-r--r--src/train_gui.cpp4
3 files changed, 10 insertions, 3 deletions
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index e17e29a25..d4a484a31 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -28,6 +28,7 @@
void DrawAircraftDetails(const Vehicle *v, int x, int y)
{
int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;
+ Money feeder_share = 0;
for (const Vehicle *u = v ; u != NULL ; u = u->Next()) {
if (IsNormalAircraft(u)) {
@@ -53,11 +54,12 @@ void DrawAircraftDetails(const Vehicle *v, int x, int y)
SetDParam(1, cargo_count);
SetDParam(2, u->cargo.Source());
DrawString(x, y + 21 + y_offset, STR_8813_FROM, TC_FROMSTRING);
+ feeder_share += u->cargo.FeederShare();
}
}
}
- SetDParam(0, v->cargo.FeederShare());
+ SetDParam(0, feeder_share);
DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING);
}
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index c9190008b..7dd2239f5 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -25,6 +25,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
{
uint y_offset = RoadVehHasArticPart(v) ? 15 : 0;
StringID str;
+ Money feeder_share = 0;
SetDParam(0, v->engine_type);
SetDParam(1, v->build_year);
@@ -70,6 +71,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
SetDParam(1, u->cargo.Count());
SetDParam(2, u->cargo.Source());
str = STR_8813_FROM;
+ feeder_share += u->cargo.FeederShare();
}
DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING);
@@ -88,12 +90,13 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
SetDParam(1, v->cargo.Count());
SetDParam(2, v->cargo.Source());
str = STR_8813_FROM;
+ feeder_share += v->cargo.FeederShare();
}
DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING);
}
/* Draw Transfer credits text */
- SetDParam(0, v->cargo.FeederShare());
+ SetDParam(0, feeder_share);
DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING);
}
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 715263a13..d97ef36de 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -231,6 +231,7 @@ void DrawTrainDetails(const Vehicle *v, int x, int y, int vscroll_pos, uint16 vs
} else {
AcceptedCargo act_cargo;
AcceptedCargo max_cargo;
+ Money feeder_share = 0;
memset(max_cargo, 0, sizeof(max_cargo));
memset(act_cargo, 0, sizeof(act_cargo));
@@ -238,6 +239,7 @@ void DrawTrainDetails(const Vehicle *v, int x, int y, int vscroll_pos, uint16 vs
for (const Vehicle *u = v; u != NULL ; u = u->Next()) {
act_cargo[u->cargo_type] += u->cargo.Count();
max_cargo[u->cargo_type] += u->cargo_cap;
+ feeder_share += u->cargo.FeederShare();
}
/* draw total cargo tab */
@@ -253,7 +255,7 @@ void DrawTrainDetails(const Vehicle *v, int x, int y, int vscroll_pos, uint16 vs
DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_TOTAL_CAPACITY, TC_FROMSTRING);
}
}
- SetDParam(0, v->cargo.FeederShare());
+ SetDParam(0, feeder_share);
DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING);
}
}