mirror of https://github.com/OpenTTD/OpenTTD
(svn r6794) - Fix: In the train detail window, split up articulated parts if they can contain cargo. This allows us to show the full cargo contents.
parent
ed9ddfaba1
commit
8072c6fe17
23
train_gui.c
23
train_gui.c
|
@ -998,7 +998,7 @@ static void DrawTrainDetailsWindow(Window *w)
|
||||||
do {
|
do {
|
||||||
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;
|
||||||
} while ((u = GetNextVehicle(u)) != NULL);
|
} while ((u = u->next) != NULL);
|
||||||
|
|
||||||
/* Set scroll-amount seperately from counting, as to not compute num double
|
/* Set scroll-amount seperately from counting, as to not compute num double
|
||||||
* for more carriages of the same type
|
* for more carriages of the same type
|
||||||
|
@ -1009,8 +1009,8 @@ static void DrawTrainDetailsWindow(Window *w)
|
||||||
num++; // needs one more because first line is description string
|
num++; // needs one more because first line is description string
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
num++;
|
if (!IsArticulatedPart(u) || u->cargo_cap != 0) num++;
|
||||||
} while ((u = GetNextVehicle(u)) != NULL);
|
} while ((u = u->next) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetVScrollCount(w, num);
|
SetVScrollCount(w, num);
|
||||||
|
@ -1070,19 +1070,30 @@ static void DrawTrainDetailsWindow(Window *w)
|
||||||
DrawSprite(GetTrainImage(u, DIR_W) | pal, x + 14 + WagonLengthToPixels(dx), y + 6 + (is_custom_sprite(RailVehInfo(u->engine_type)->image_index) ? _traininfo_vehicle_pitch : 0));
|
DrawSprite(GetTrainImage(u, DIR_W) | pal, x + 14 + WagonLengthToPixels(dx), y + 6 + (is_custom_sprite(RailVehInfo(u->engine_type)->image_index) ? _traininfo_vehicle_pitch : 0));
|
||||||
dx += u->u.rail.cached_veh_length;
|
dx += u->u.rail.cached_veh_length;
|
||||||
u = u->next;
|
u = u->next;
|
||||||
} while (u != NULL && IsArticulatedPart(u));
|
} while (u != NULL && IsArticulatedPart(u) && u->cargo_cap == 0);
|
||||||
|
|
||||||
px = x + WagonLengthToPixels(dx) + 2;
|
px = x + WagonLengthToPixels(dx) + 2;
|
||||||
py = y + 2;
|
py = y + 2;
|
||||||
switch (det_tab) {
|
switch (det_tab) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case 0: TrainDetailsCargoTab( v, px, py); break;
|
case 0: TrainDetailsCargoTab( v, px, py); break;
|
||||||
case 1: TrainDetailsInfoTab( v, px, py); break;
|
case 1:
|
||||||
|
// Only show name and value for the 'real' part
|
||||||
|
if (!IsArticulatedPart(v)) {
|
||||||
|
TrainDetailsInfoTab(v, px, py);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 2: TrainDetailsCapacityTab(v, px, py); break;
|
case 2: TrainDetailsCapacityTab(v, px, py); break;
|
||||||
}
|
}
|
||||||
y += 14;
|
y += 14;
|
||||||
|
|
||||||
|
v = u;
|
||||||
|
} else {
|
||||||
|
// Move to the next line
|
||||||
|
do {
|
||||||
|
v = v->next;
|
||||||
|
} while (v != NULL && IsArticulatedPart(v) && v->cargo_cap == 0);
|
||||||
}
|
}
|
||||||
v = GetNextVehicle(v);
|
|
||||||
if (v == NULL) return;
|
if (v == NULL) return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue