From 4b51a3eda8c422a17bdfd6b1f9ae9230accdd7a2 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 3 Jan 2023 01:37:06 +0000 Subject: [PATCH] VarAction2: Mark applicable rail station variables as expensive --- src/newgrf_optimiser.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/newgrf_optimiser.cpp b/src/newgrf_optimiser.cpp index caaf530914..5c38951ebe 100644 --- a/src/newgrf_optimiser.cpp +++ b/src/newgrf_optimiser.cpp @@ -37,6 +37,20 @@ static bool IsExpensiveVehicleVariable(uint16 variable) } } +static bool IsExpensiveStationVariable(uint16 variable) +{ + switch (variable) { + case 0x66: + case 0x67: + case 0x68: + case 0x6A: + return true; + + default: + return false; + } +} + static bool IsExpensiveIndustryTileVariable(uint16 variable) { switch (variable) { @@ -89,6 +103,7 @@ static bool IsExpensiveRoadStopsVariable(uint16 variable) static bool IsExpensiveVariable(uint16 variable, GrfSpecFeature feature, VarSpriteGroupScope var_scope) { if ((feature >= GSF_TRAINS && feature <= GSF_AIRCRAFT) && IsExpensiveVehicleVariable(variable)) return true; + if (feature == GSF_STATIONS && var_scope == VSG_SCOPE_SELF && IsExpensiveStationVariable(variable)) return true; if (feature == GSF_INDUSTRYTILES && var_scope == VSG_SCOPE_SELF && IsExpensiveIndustryTileVariable(variable)) return true; if (feature == GSF_OBJECTS && var_scope == VSG_SCOPE_SELF && IsExpensiveObjectVariable(variable)) return true; if (feature == GSF_ROADSTOPS && var_scope == VSG_SCOPE_SELF && IsExpensiveRoadStopsVariable(variable)) return true;