mirror of https://github.com/OpenTTD/OpenTTD
(svn r14098) -Fix: Make the 'Transfer Credit' display aware of the entire consist, not only the first vehicle
parent
99efe9aaae
commit
23a48b2815
|
@ -28,6 +28,7 @@
|
||||||
void DrawAircraftDetails(const Vehicle *v, int x, int y)
|
void DrawAircraftDetails(const Vehicle *v, int x, int y)
|
||||||
{
|
{
|
||||||
int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;
|
int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;
|
||||||
|
Money feeder_share = 0;
|
||||||
|
|
||||||
for (const Vehicle *u = v ; u != NULL ; u = u->Next()) {
|
for (const Vehicle *u = v ; u != NULL ; u = u->Next()) {
|
||||||
if (IsNormalAircraft(u)) {
|
if (IsNormalAircraft(u)) {
|
||||||
|
@ -53,11 +54,12 @@ void DrawAircraftDetails(const Vehicle *v, int x, int y)
|
||||||
SetDParam(1, cargo_count);
|
SetDParam(1, cargo_count);
|
||||||
SetDParam(2, u->cargo.Source());
|
SetDParam(2, u->cargo.Source());
|
||||||
DrawString(x, y + 21 + y_offset, STR_8813_FROM, TC_FROMSTRING);
|
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);
|
DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
|
||||||
{
|
{
|
||||||
uint y_offset = RoadVehHasArticPart(v) ? 15 : 0;
|
uint y_offset = RoadVehHasArticPart(v) ? 15 : 0;
|
||||||
StringID str;
|
StringID str;
|
||||||
|
Money feeder_share = 0;
|
||||||
|
|
||||||
SetDParam(0, v->engine_type);
|
SetDParam(0, v->engine_type);
|
||||||
SetDParam(1, v->build_year);
|
SetDParam(1, v->build_year);
|
||||||
|
@ -70,6 +71,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
|
||||||
SetDParam(1, u->cargo.Count());
|
SetDParam(1, u->cargo.Count());
|
||||||
SetDParam(2, u->cargo.Source());
|
SetDParam(2, u->cargo.Source());
|
||||||
str = STR_8813_FROM;
|
str = STR_8813_FROM;
|
||||||
|
feeder_share += u->cargo.FeederShare();
|
||||||
}
|
}
|
||||||
DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING);
|
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(1, v->cargo.Count());
|
||||||
SetDParam(2, v->cargo.Source());
|
SetDParam(2, v->cargo.Source());
|
||||||
str = STR_8813_FROM;
|
str = STR_8813_FROM;
|
||||||
|
feeder_share += v->cargo.FeederShare();
|
||||||
}
|
}
|
||||||
DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING);
|
DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw Transfer credits text */
|
/* 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);
|
DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,6 +231,7 @@ void DrawTrainDetails(const Vehicle *v, int x, int y, int vscroll_pos, uint16 vs
|
||||||
} else {
|
} else {
|
||||||
AcceptedCargo act_cargo;
|
AcceptedCargo act_cargo;
|
||||||
AcceptedCargo max_cargo;
|
AcceptedCargo max_cargo;
|
||||||
|
Money feeder_share = 0;
|
||||||
|
|
||||||
memset(max_cargo, 0, sizeof(max_cargo));
|
memset(max_cargo, 0, sizeof(max_cargo));
|
||||||
memset(act_cargo, 0, sizeof(act_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()) {
|
for (const Vehicle *u = v; u != NULL ; u = u->Next()) {
|
||||||
act_cargo[u->cargo_type] += u->cargo.Count();
|
act_cargo[u->cargo_type] += u->cargo.Count();
|
||||||
max_cargo[u->cargo_type] += u->cargo_cap;
|
max_cargo[u->cargo_type] += u->cargo_cap;
|
||||||
|
feeder_share += u->cargo.FeederShare();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw total cargo tab */
|
/* 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);
|
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);
|
DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue