@@ -62,56 +62,39 @@ 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-
7570 // get next object
76- nextObject = m_localObjectList ->friend_getNext ();
71+ RadarObject * nextObject = (*list) ->friend_getNext ();
7772
7873 // remove radar data from object
79- m_localObjectList ->friend_getObject ()->friend_setRadarData ( NULL );
74+ (*list) ->friend_getObject ()->friend_setRadarData ( NULL );
8075
8176 // delete the head of the list
82- deleteInstance (m_localObjectList );
77+ deleteInstance (*list );
8378
8479 // set head of the list to the next object
85- m_localObjectList = nextObject;
86-
80+ *list = nextObject;
8781 }
82+ }
8883
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- }
84+ // -------------------------------------------------------------------------------------------------
85+ /* * Delete list resources used by the radar and return them to the memory pools */
86+ // -------------------------------------------------------------------------------------------------
87+ void Radar::deleteListResources ( void )
88+ {
89+ deleteList (&m_objectList);
90+ deleteList (&m_localObjectList);
10691
107- Object *obj;
108- for ( obj = TheGameLogic->getFirstObject (); obj; obj = obj->getNextObject () )
92+ # ifdef DEBUG_CRASHING
93+ for ( Object * obj = TheGameLogic->getFirstObject (); obj; obj = obj->getNextObject () )
10994 {
110-
11195 DEBUG_ASSERTCRASH ( obj->friend_getRadarData () == NULL , (" oops" ) );
112-
11396 }
114-
97+ # endif
11598}
11699
117100// PUBLIC METHODS /////////////////////////////////////////////////////////////////////////////////
0 commit comments