@@ -206,13 +206,9 @@ BOOL CObjectSpace::_RayQuery2(collide::rq_results& r_dest, const collide::ray_de
206206 {
207207 xrc.ray_options (R.flags );
208208 xrc.ray_query (&Static, R.start , R.dir , R.range );
209- if (xrc.r_count ())
210- {
211- CDB::RESULT* _I = xrc.r_begin ();
212- CDB::RESULT* _E = xrc.r_end ();
213- for (; _I != _E; _I++)
214- r_temp.append_result (rq_result ().set (0 , _I->range , _I->id ));
215- }
209+
210+ for (auto &i : *xrc.r_get ())
211+ r_temp.append_result (rq_result ().set (0 , i.range , i.id ));
216212 }
217213 // Test dynamic
218214 if (R.tgt & d_mask)
@@ -239,12 +235,10 @@ BOOL CObjectSpace::_RayQuery2(collide::rq_results& r_dest, const collide::ray_de
239235 if (r_temp.r_count ())
240236 {
241237 r_temp.r_sort ();
242- collide::rq_result* _I = r_temp.r_begin ();
243- collide::rq_result* _E = r_temp.r_end ();
244- for (; _I != _E; _I++)
238+ for (auto &i : *r_temp.r_get ())
245239 {
246- r_dest.append_result (*_I );
247- if (!(CB ? CB (*_I , user_data) : TRUE ))
240+ r_dest.append_result (i );
241+ if (!(CB ? CB (i , user_data) : TRUE ))
248242 return r_dest.r_count ();
249243 if (R.flags & (CDB::OPT_ONLYNEAREST | CDB::OPT_ONLYFIRST))
250244 return r_dest.r_count ();
@@ -332,12 +326,10 @@ BOOL CObjectSpace::_RayQuery3(collide::rq_results& r_dest, const collide::ray_de
332326 if (r_temp.r_count ())
333327 {
334328 r_temp.r_sort ();
335- collide::rq_result* _I = r_temp.r_begin ();
336- collide::rq_result* _E = r_temp.r_end ();
337- for (; _I != _E; _I++)
329+ for (auto &i : *r_temp.r_get ())
338330 {
339- r_dest.append_result (*_I );
340- if (!(CB ? CB (*_I , user_data) : TRUE ))
331+ r_dest.append_result (i );
332+ if (!(CB ? CB (i , user_data) : TRUE ))
341333 return r_dest.r_count ();
342334 if (R.flags & CDB::OPT_ONLYFIRST)
343335 return r_dest.r_count ();
0 commit comments