From 6a13c509a20a78f62599f8696e94851e2e3478d3 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Mon, 8 Aug 2022 04:54:52 +0700 Subject: [PATCH] Remove `selfReference` from `Packages` mutator This variable didn't serve any really useful purpose, but has led to game crashes. While adding proper cleanup could also solve these crashes, there is no real point to keeping it at all. NOTE: It's only purpose was to make sure only one instance of corresponding mutator exists, but duplicates shouldn't happen in the first place. --- sources/Packages.uc | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/sources/Packages.uc b/sources/Packages.uc index 90a8052..58c11eb 100644 --- a/sources/Packages.uc +++ b/sources/Packages.uc @@ -22,13 +22,6 @@ class Packages extends Mutator config(Acedia); -// Default value of this variable will be used to store -// reference to the active Acedia mutator, -// as well as to ensure there's only one copy of it. -// We can't use 'Singleton' class for that, -// as we have to derive from 'Mutator'. -var private Packages selfReference; - // Acedia's reference to a `Global` object. var private Global _; var private ServerGlobal _server; @@ -56,11 +49,6 @@ struct FeatureConfigPair var public Text configName; }; -static public final function Packages GetInstance() -{ - return default.selfReference; -} - // "Constructor" simulated function PreBeginPlay() { @@ -74,13 +62,6 @@ simulated function PreBeginPlay() private simulated function InitializeClient() { - // Enforce one copy rule and remember a reference to that copy - if (default.selfReference != none) - { - Destroy(); - return; - } - default.selfReference = self; _ = class'Global'.static.GetInstance(); class'ClientLevelCore'.static.CreateLevelCore(self); } @@ -95,13 +76,6 @@ private function InitializeServer() AddToPackageMap("Acedia"); } CheckForGarbage(); - // Enforce one copy rule and remember a reference to that copy - if (default.selfReference != none) - { - Destroy(); - return; - } - default.selfReference = self; // Launch and setup core Acedia _ = class'Global'.static.GetInstance(); _server = class'ServerGlobal'.static.GetInstance(); @@ -147,7 +121,6 @@ function ServerTraveling(string URL, bool bItems) _.memory.Free(votingAdapter); votingAdapter = none; } - default.selfReference = none; _.environment.ShutDown(); if (nextMutator != none) { nextMutator.ServerTraveling(URL, bItems);