TRACKER.CPP 6.4 KB

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