@@ -62,56 +62,33 @@ Radar *TheRadar = NULL; ///< the radar global singleton
6262#define RADAR_QUEUE_TERRAIN_REFRESH_DELAY (LOGICFRAMES_PER_SECOND * 3 .0f )
6363
6464// -------------------------------------------------------------------------------------------------
65- /* * Delete list resources used by the radar and return them to the memory pools */
6665// -------------------------------------------------------------------------------------------------
67- void Radar::deleteListResources ( void )
66+ void Radar::deleteList ( RadarObject **list )
6867{
69- RadarObject *nextObject;
70-
71- // delete entries from the local object list
72- while ( m_localObjectList )
68+ while ( *list )
7369 {
74-
75- // get next object
76- nextObject = m_localObjectList->friend_getNext ();
77-
78- // remove radar data from object
79- m_localObjectList->friend_getObject ()->friend_setRadarData ( NULL );
80-
81- // delete the head of the list
82- deleteInstance (m_localObjectList);
83-
84- // set head of the list to the next object
85- m_localObjectList = nextObject;
86-
70+ RadarObject *nextObject = (*list)->friend_getNext ();
71+ (*list)->friend_getObject ()->friend_setRadarData ( NULL );
72+ deleteInstance (*list);
73+ *list = nextObject;
8774 }
75+ }
8876
89- // delete entries from the regular object list
90- while ( m_objectList )
91- {
92-
93- // get next object
94- nextObject = m_objectList->friend_getNext ();
95-
96- // remove radar data from object
97- m_objectList->friend_getObject ()->friend_setRadarData ( NULL );
98-
99- // delete the head of the list
100- deleteInstance (m_objectList);
101-
102- // set head of the list to the next object
103- m_objectList = nextObject;
104-
105- }
77+ // -------------------------------------------------------------------------------------------------
78+ /* * Delete list resources used by the radar and return them to the memory pools */
79+ // -------------------------------------------------------------------------------------------------
80+ void Radar::deleteListResources ( void )
81+ {
82+ deleteList (&m_objectList);
83+ deleteList (&m_localObjectList);
10684
107- Object *obj;
108- for ( obj = TheGameLogic->getFirstObject (); obj; obj = obj->getNextObject () )
85+ # ifdef DEBUG_CRASHING
86+ for ( Object * obj = TheGameLogic->getFirstObject (); obj; obj = obj->getNextObject () )
10987 {
110-
111- DEBUG_ASSERTCRASH ( obj->friend_getRadarData () == NULL , (" oops" ) );
112-
88+ DEBUG_ASSERTCRASH ( obj->friend_getRadarData () == NULL ,
89+ (" Radar::deleteListResources: Unexpectedly an object still has radar data assigned" ) );
11390 }
114-
91+ # endif
11592}
11693
11794// PUBLIC METHODS /////////////////////////////////////////////////////////////////////////////////
0 commit comments