From 3246b689417a170fa0dc5af638cf708a032aad96 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Sun, 13 Feb 2022 21:20:56 +0100 Subject: Crew Selection: Use InitializeDef instead of Clonk appendto for creation --- CrewSelection.c4d/Script.c | 21 +++++++++++++++++++++ System.c4g/DTCrewSelection.c | 12 ------------ 2 files changed, 21 insertions(+), 12 deletions(-) delete mode 100644 System.c4g/DTCrewSelection.c diff --git a/CrewSelection.c4d/Script.c b/CrewSelection.c4d/Script.c index 920a604..d4362f5 100644 --- a/CrewSelection.c4d/Script.c +++ b/CrewSelection.c4d/Script.c @@ -1,5 +1,26 @@ #strict 3 +static CS7I_Instance; + +func InitializeDef() +{ + if (!CS7I_Instance) + { + CreateObject(GetID()); + } +} + +func Initialize() +{ + if (CS7I_Instance && CS7I_Instance != this) + { + RemoveObject(); + return; + } + + CS7I_Instance = this; +} + func Activate(int player) { var cursor = GetCursor(player); diff --git a/System.c4g/DTCrewSelection.c b/System.c4g/DTCrewSelection.c deleted file mode 100644 index 4e12db1..0000000 --- a/System.c4g/DTCrewSelection.c +++ /dev/null @@ -1,12 +0,0 @@ -#strict 2 -#appendto CLNK - -func Initialize() -{ - if(!FindObject(CS7I)) - { - CreateObject(CS7I, 0, 0, NO_OWNER); - } - - return _inherited(...); -} \ No newline at end of file -- cgit v1.2.3-54-g00ecf