TRACKER.CPP 6.3 KB

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