Fix #12305: Crash with large positive sprite x offset in engine preview window

This commit is contained in:
Jonathan G Rennison 2024-03-16 15:45:14 +00:00 committed by rubidium42
parent 0eaeeaabb6
commit e42aec5a89
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ struct EnginePreviewWindow : Window {
}
this->vehicle_space = std::max<int>(ScaleSpriteTrad(40), y - y_offs);
size->width = std::max(size->width, x - x_offs);
size->width = std::max(size->width, x + std::abs(x_offs));
SetDParam(0, GetEngineCategoryName(engine));
size->height = GetStringHeight(STR_ENGINE_PREVIEW_MESSAGE, size->width) + WidgetDimensions::scaled.vsep_wide + GetCharacterHeight(FS_NORMAL) + this->vehicle_space;
SetDParam(0, engine);