From faa672ea12e5bd774a485bb5f0e2aa248c80fc25 Mon Sep 17 00:00:00 2001 From: ike709 Date: Fri, 17 Dec 2021 05:44:38 -0600 Subject: [PATCH] Fixes bad taste description logic for fruit wine (#63421) OpenDream sussed out a bug with switch cases and wixoa confirmed that it's actually a BYOND compiler bug: BYOND isn't handling it properly at all (it should throw a "expected constant expression" error), but converting the var to a const fixes it. Since, y'know, switch cases need to be consts. --- code/modules/reagents/chemistry/reagents/alcohol_reagents.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index cf5ad59f501..e4c646cd1c7 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -2152,7 +2152,8 @@ All effects don't start immediately, but rather get worse over time; the rate is generate_data_info(data) /datum/reagent/consumable/ethanol/fruit_wine/proc/generate_data_info(list/data) - var/minimum_percent = 0.15 //Percentages measured between 0 and 1. + // BYOND's compiler fails to catch non-consts in a ranged switch case, and it causes incorrect behavior. So this needs to explicitly be a constant. + var/const/minimum_percent = 0.15 //Percentages measured between 0 and 1. var/list/primary_tastes = list() var/list/secondary_tastes = list() glass_name = "glass of [name]"