From: Martin Taibr Date: Tue, 6 Feb 2018 21:37:07 +0000 (+0100) Subject: cleaner init X-Git-Tag: xonotic-v0.8.5~2341^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F527%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git cleaner init --- 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;