TRACKER.CPP (6552B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: /CounterStrike/TRACKER.CPP 1 3/03/97 10:26a Joe_bostic $ */ 17 /*********************************************************************************************** 18 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : TRACKER.CPP * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : 06/14/96 * 28 * * 29 * Last Update : June 14, 1996 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * Detach_This_From_All -- Detaches this object from all others. * 34 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 35 36 37 #include "function.h" 38 39 40 /*********************************************************************************************** 41 * Detach_This_From_All -- Detaches this object from all others. * 42 * * 43 * This routine sweeps through all game objects and makes sure that it is no longer * 44 * referenced by them. Typically, this is called in preparation for the object's death * 45 * or limbo state. * 46 * * 47 * INPUT: target -- This object expressed as a target number. * 48 * * 49 * all -- Is this object really in truly being removed from the game? The * 50 * answer would be false if the target was actually a stealth * 51 * tank that is cloaking. In such a case, the object should be removed * 52 * from all non-friendly tracking systems, but otherwise left alone. * 53 * * 54 * OUTPUT: none * 55 * * 56 * WARNINGS: none * 57 * * 58 * HISTORY: * 59 * 05/08/1995 JLB : Created. * 60 *=============================================================================================*/ 61 void Detach_This_From_All(TARGET target, bool all) 62 { 63 int index; 64 if (Target_Legal(target)) { 65 66 for (index = 0; index < Houses.Count(); index++) { 67 Houses.Ptr(index)->Detach(target, all); 68 } 69 for (index = 0; index < Teams.Count(); index++) { 70 Teams.Ptr(index)->Detach(target, all); 71 } 72 for (index = 0; index < TeamTypes.Count(); index++) { 73 TeamTypes.Ptr(index)->Detach(target, all); 74 } 75 for (index = 0; index < Units.Count(); index++) { 76 Units.Ptr(index)->Detach(target, all); 77 } 78 for (index = 0; index < Vessels.Count(); index++) { 79 Vessels.Ptr(index)->Detach(target, all); 80 } 81 for (index = 0; index < Aircraft.Count(); index++) { 82 Aircraft.Ptr(index)->Detach(target, all); 83 } 84 for (index = 0; index < Buildings.Count(); index++) { 85 Buildings.Ptr(index)->Detach(target, all); 86 } 87 for (index = 0; index < Bullets.Count(); index++) { 88 Bullets.Ptr(index)->Detach(target, all); 89 } 90 for (index = 0; index < Infantry.Count(); index++) { 91 Infantry.Ptr(index)->Detach(target, all); 92 } 93 for (index = 0; index < Anims.Count(); index++) { 94 Anims.Ptr(index)->Detach(target, all); 95 } 96 97 Map.Detach(target, all); 98 99 Logic.Detach(target, all); 100 101 ChronalVortex.Detach(target); 102 103 /* 104 ** Removing a trigger type must also remove all triggers that are dependant 105 ** upon that type. 106 */ 107 if (As_TriggerType(target) != NULL) { 108 for (int index = 0; index < Triggers.Count(); index++) { 109 TriggerClass * tp = Triggers.Ptr(index); 110 111 if (tp->Class->As_Target() == target) { 112 Detach_This_From_All(tp->As_Target()); 113 delete tp; 114 index--; 115 } 116 } 117 } 118 119 for (index = 0; index < Triggers.Count(); index++) { 120 Triggers.Ptr(index)->Detach(target, all); 121 } 122 for (index = 0; index < TriggerTypes.Count(); index++) { 123 TriggerTypes.Ptr(index)->Detach(target, all); 124 } 125 } 126 } 127 128 129 130 131