@@ -70,11 +70,11 @@ CWallmarksEngine::~CWallmarksEngine()
70
70
void CWallmarksEngine::clear ()
71
71
{
72
72
{
73
- for (auto p_it = marks. begin (); p_it != marks. end (); p_it++ )
73
+ for (auto & p_it : marks)
74
74
{
75
- for (auto m_it = (* p_it) ->static_items . begin (); m_it != (*p_it)-> static_items . end (); m_it++ )
76
- static_wm_destroy (* m_it);
77
- xr_delete (* p_it);
75
+ for (auto & m_it : p_it->static_items )
76
+ static_wm_destroy (m_it);
77
+ xr_delete (p_it);
78
78
}
79
79
marks.clear ();
80
80
}
@@ -110,13 +110,13 @@ void CWallmarksEngine::static_wm_render(CWallmarksEngine::static_wallmark* W, FV
110
110
int aC = iFloor (a * 255 .f );
111
111
clamp (aC, 0 , 255 );
112
112
u32 C = color_rgba (128 , 128 , 128 , aC);
113
- FVF::LIT* S = &*W->verts .begin ();
114
- FVF::LIT* E = &*W->verts .end ();
115
- for (; S != E; S++, V++)
113
+
114
+ for (auto &i : W->verts )
116
115
{
117
- V->p .set (S-> p );
116
+ V->p .set (i. p );
118
117
V->color = C;
119
- V->t .set (S->t );
118
+ V->t .set (i.t );
119
+ V++;
120
120
}
121
121
}
122
122
// --------------------------------------------------------------------------------
@@ -255,10 +255,8 @@ void CWallmarksEngine::AddWallmark_internal(
255
255
Fbox bb;
256
256
bb.invalidate ();
257
257
258
- FVF::LIT* I = &*W->verts .begin ();
259
- FVF::LIT* E = &*W->verts .end ();
260
- for (; I != E; I++)
261
- bb.modify (I->p );
258
+ for (auto &i : W->verts )
259
+ bb.modify (i.p );
262
260
bb.getsphere (W->bounds .P , W->bounds .R );
263
261
}
264
262
@@ -268,15 +266,13 @@ void CWallmarksEngine::AddWallmark_internal(
268
266
wm_slot* slot = FindSlot (hShader);
269
267
if (slot)
270
268
{
271
- auto it = slot->static_items .begin ();
272
- auto end = slot->static_items .end ();
273
- for (; it != end; it++)
269
+ for (auto &it : slot->static_items )
274
270
{
275
- static_wallmark* wm = * it;
271
+ static_wallmark* wm = it;
276
272
if (wm->bounds .P .similar (W->bounds .P , 0 .02f ))
277
273
{ // replace
278
274
static_wm_destroy (wm);
279
- * it = W;
275
+ it = W;
280
276
return ;
281
277
}
282
278
}
@@ -394,16 +390,17 @@ void CWallmarksEngine::Render()
394
390
395
391
lock.Enter (); // Physics may add wallmarks in parallel with rendering
396
392
397
- for (auto slot_it = marks. begin (); slot_it != marks. end (); slot_it++ )
393
+ for (auto & slot_it : marks)
398
394
{
399
395
u32 w_offset;
400
396
FVF::LIT *w_verts, *w_start;
401
397
BeginStream (hGeom, w_offset, w_verts, w_start);
402
- wm_slot* slot = *slot_it;
398
+ wm_slot* slot = slot_it;
399
+
403
400
// static wallmarks
404
- for (auto w_it = slot->static_items . begin (); w_it != slot-> static_items . end (); )
401
+ for (auto & w_it : slot->static_items )
405
402
{
406
- static_wallmark* W = * w_it;
403
+ static_wallmark* W = w_it;
407
404
if (RImplementation.ViewBase .testSphere_dirty (W->bounds .P , W->bounds .R ))
408
405
{
409
406
RImplementation.BasicStats .StaticWMCount ++;
@@ -429,12 +426,9 @@ void CWallmarksEngine::Render()
429
426
if (W->ttl <= EPS)
430
427
{
431
428
static_wm_destroy (W);
432
- * w_it = slot->static_items .back ();
429
+ w_it = slot->static_items .back ();
433
430
slot->static_items .pop_back ();
434
- }
435
- else
436
- {
437
- w_it++;
431
+ break ;
438
432
}
439
433
}
440
434
// Flush stream
@@ -443,10 +437,9 @@ void CWallmarksEngine::Render()
443
437
BeginStream (hGeom, w_offset, w_verts, w_start);
444
438
445
439
// dynamic wallmarks
446
- for (xr_vector<intrusive_ptr<CSkeletonWallmark>>::iterator w_it = slot->skeleton_items .begin ();
447
- w_it != slot->skeleton_items .end (); w_it++)
440
+ for (auto &w_it : slot->skeleton_items )
448
441
{
449
- intrusive_ptr<CSkeletonWallmark> W = * w_it;
442
+ intrusive_ptr<CSkeletonWallmark> W = w_it;
450
443
if (!W)
451
444
{
452
445
continue ;
0 commit comments