Fix vertical scrollbar extents in template window info sections
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
@@ -321,12 +321,14 @@ public:
|
||||
this->vscroll[2]->SetCount(24);
|
||||
} else {
|
||||
const TemplateVehicle *tmp = this->templates[this->selected_template_index];
|
||||
uint min_height = 30;
|
||||
uint height = 30;
|
||||
uint height = ScaleGUITrad(8) + (3 * FONT_HEIGHT_NORMAL);
|
||||
CargoArray cargo_caps;
|
||||
short count_columns = 0;
|
||||
short max_columns = 2;
|
||||
|
||||
if (tmp->full_weight > tmp->empty_weight || _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 (; tmp != nullptr; tmp = tmp->Next()) {
|
||||
cargo_caps[tmp->cargo_type] += tmp->cargo_cap;
|
||||
}
|
||||
@@ -341,8 +343,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
min_height = std::max(min_height, height);
|
||||
this->vscroll[2]->SetCount(min_height);
|
||||
this->vscroll[2]->SetCount(height);
|
||||
}
|
||||
|
||||
this->DrawWidgets();
|
||||
@@ -774,7 +775,7 @@ public:
|
||||
}
|
||||
|
||||
/* Draw cargo summary */
|
||||
top += ScaleGUITrad(26);
|
||||
top += FONT_HEIGHT_NORMAL * 2;
|
||||
short count_columns = 0;
|
||||
short max_columns = 2;
|
||||
|
||||
|
Reference in New Issue
Block a user