From 343c42534f49eae166c209946752ab26359381f7 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Tue, 6 Feb 2018 22:37:07 +0100 Subject: [PATCH] cleaner init --- qcsrc/common/t_items.qc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index b52ad7b64..62b02c379 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -671,14 +671,10 @@ void Item_ScheduleRespawn(entity e) AUTOCVAR(g_pickup_respawntime_initial_random, int, 1, "For items that don't start spawned: 0: spawn after their normal respawntime; 1: spawn after `random * respawntime` with the *same* random; 2: same as 1 but each item has separate random"); -float shared_random = -1; +float shared_random; +STATIC_INIT(shared_random) { shared_random = random(); } void Item_ScheduleInitialRespawn(entity e) { - // initializing during declaration causes the compiler to segfault - if (shared_random == -1) { - shared_random = random(); - } - Item_Show(e, 0); float spawn_in; -- 2.39.2