|
|
|
@ -305,7 +305,7 @@ public:
|
|
|
|
|
old_dpi = _cur_dpi;
|
|
|
|
|
_cur_dpi = &tmp_dpi;
|
|
|
|
|
|
|
|
|
|
int y = 4 - this->vscroll->GetPosition();
|
|
|
|
|
int y = ScaleGUITrad(4) - this->vscroll->GetPosition();
|
|
|
|
|
bool buildable = true;
|
|
|
|
|
Money buy_cost = 0;
|
|
|
|
|
for (Train *train = this->virtual_train; train != nullptr; train = train->GetNextUnit()) {
|
|
|
|
@ -360,7 +360,7 @@ public:
|
|
|
|
|
for (const Train *tmp = this->virtual_train; tmp != nullptr; tmp = tmp->Next()) {
|
|
|
|
|
cargo_caps[tmp->cargo_type] += tmp->cargo_cap;
|
|
|
|
|
}
|
|
|
|
|
y += 26;
|
|
|
|
|
y += FONT_HEIGHT_NORMAL * 2;
|
|
|
|
|
for (CargoID i = 0; i < NUM_CARGO; ++i) {
|
|
|
|
|
if (cargo_caps[i] > 0) {
|
|
|
|
|
SetDParam(0, i);
|
|
|
|
@ -488,19 +488,22 @@ public:
|
|
|
|
|
virtual void OnPaint() override
|
|
|
|
|
{
|
|
|
|
|
uint min_width = 32;
|
|
|
|
|
uint min_height = 30;
|
|
|
|
|
uint width = 0;
|
|
|
|
|
uint height = 30;
|
|
|
|
|
uint height = ScaleGUITrad(8) + (3 * FONT_HEIGHT_NORMAL);
|
|
|
|
|
CargoArray cargo_caps;
|
|
|
|
|
|
|
|
|
|
if (virtual_train != nullptr) {
|
|
|
|
|
bool buildable = true;
|
|
|
|
|
for (Train *train = virtual_train; train != nullptr; train = train->Next()) {
|
|
|
|
|
uint32 full_cargo_weight = 0;
|
|
|
|
|
for (Train *train = virtual_train; train != nullptr; train = train->GetNextUnit()) {
|
|
|
|
|
width += train->GetDisplayImageWidth();
|
|
|
|
|
cargo_caps[train->cargo_type] += train->cargo_cap;
|
|
|
|
|
if (!IsEngineBuildable(train->engine_type, VEH_TRAIN, train->owner)) buildable = false;
|
|
|
|
|
full_cargo_weight += train->GetCargoWeight(train->cargo_cap);
|
|
|
|
|
}
|
|
|
|
|
if (!buildable) height += FONT_HEIGHT_NORMAL;
|
|
|
|
|
if (full_cargo_weight > 0 || _settings_client.gui.show_train_weight_ratios_in_details) height += FONT_HEIGHT_NORMAL;
|
|
|
|
|
if (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL) height += FONT_HEIGHT_NORMAL;
|
|
|
|
|
|
|
|
|
|
for (CargoID i = 0; i < NUM_CARGO; ++i) {
|
|
|
|
|
if (cargo_caps[i] > 0) {
|
|
|
|
@ -512,8 +515,7 @@ public:
|
|
|
|
|
min_width = std::max(min_width, width);
|
|
|
|
|
this->hscroll->SetCount(min_width + 50);
|
|
|
|
|
|
|
|
|
|
min_height = std::max(min_height, height);
|
|
|
|
|
this->vscroll->SetCount(min_height);
|
|
|
|
|
this->vscroll->SetCount(height);
|
|
|
|
|
|
|
|
|
|
this->DrawWidgets();
|
|
|
|
|
}
|
|
|
|
|