From 16a77c1e0f1f1be122c912d5021ed157d6d4eb73 Mon Sep 17 00:00:00 2001 From: Steam Deck User Date: Tue, 20 Dec 2022 15:43:15 -0500 Subject: [PATCH] Server: Populate Power-Up Array manually Overcomes what is likely an FTEQCC compiler bug where just using a = b copying would result in a mis-match of first-values (id). Fixes dogs not always dropping Max Ammo's on NON-FTE. --- source/server/entities/powerups.qc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/source/server/entities/powerups.qc b/source/server/entities/powerups.qc index 47db184..094eb3d 100644 --- a/source/server/entities/powerups.qc +++ b/source/server/entities/powerups.qc @@ -76,6 +76,23 @@ PU_AddToStruct = powerup_count++; }; +// +// PU_CopyStruct(to, from) +// Copies a powerup_struct from to. +// +powerup_struct(powerup_struct to, powerup_struct from) PU_CopyStruct = +{ + to.id = from.id; + to.occupied = from.occupied; + to.flash_screen = from.flash_screen; + to.model_path = from.model_path; + to.voiceover_path = from.voiceover_path; + to.function = from.function; + to.requirement_function = from.requirement_function; + + return to; +} + // // PU_PopulateArray() // Generates a Power-Up array with the Fisher-Yates shuffle @@ -89,9 +106,10 @@ void() PU_PopulateArray = amount -= 1; powerup_struct temp; - temp = powerup_array[i]; - powerup_array[i] = powerup_array[amount]; - powerup_array[amount] = temp; + + PU_CopyStruct(temp, powerup_array[i]); + PU_CopyStruct(powerup_array[i], powerup_array[amount]); + PU_CopyStruct(powerup_array[amount], temp); } };