@@ -75,15 +75,15 @@ namespace RTE {
75
75
if (g_FrameMan.GetDrawNetworkBackBuffer ()) { g_PostProcessMan.GetNetworkPostEffectsList (0 , screenRelativeEffectsList); }
76
76
77
77
// Adjust for the player screen's position on the final buffer
78
- for (list< PostEffect>::iterator eItr = screenRelativeEffectsList. begin (); eItr != screenRelativeEffectsList. end (); ++eItr ) {
78
+ for (const PostEffect &postEffect : screenRelativeEffectsList) {
79
79
// Make sure we won't be adding any effects to a part of the screen that is occluded by menus and such
80
- if ((*eItr) .m_Pos .m_X > screenOcclusionOffsetX && (*eItr) .m_Pos .m_Y > screenOcclusionOffsetY && (*eItr) .m_Pos .m_X < occludedOffsetX && (*eItr) .m_Pos .m_Y < occludedOffsetY) {
81
- g_PostProcessMan.GetPostScreenEffectsList ()->push_back (PostEffect ((*eItr) .m_Pos + targetBitmapOffset, (*eItr) .m_Bitmap , (*eItr) .m_BitmapHash , (*eItr) .m_Strength , (*eItr) .m_Angle ));
80
+ if (postEffect .m_Pos .m_X > screenOcclusionOffsetX && postEffect .m_Pos .m_Y > screenOcclusionOffsetY && postEffect .m_Pos .m_X < occludedOffsetX && postEffect .m_Pos .m_Y < occludedOffsetY) {
81
+ g_PostProcessMan.GetPostScreenEffectsList ()->push_back (PostEffect (postEffect .m_Pos + targetBitmapOffset, postEffect .m_Bitmap , postEffect .m_BitmapHash , postEffect .m_Strength , postEffect .m_Angle ));
82
82
}
83
83
}
84
84
// Adjust glow areas for the player screen's position on the final buffer
85
- for (list< Box>::iterator bItr = screenRelativeGlowBoxesList. begin (); bItr != screenRelativeGlowBoxesList. end (); ++bItr ) {
86
- g_PostProcessMan.GetPostScreenGlowBoxesList ()->push_back (*bItr );
85
+ for (const Box &glowBox : screenRelativeGlowBoxesList) {
86
+ g_PostProcessMan.GetPostScreenGlowBoxesList ()->push_back (glowBox );
87
87
// Adjust each added glow area for the player screen's position on the final buffer
88
88
g_PostProcessMan.GetPostScreenGlowBoxesList ()->back ().m_Corner += targetBitmapOffset;
89
89
}
@@ -153,15 +153,16 @@ namespace RTE {
153
153
154
154
// Account for wrapping in any registered glow IntRects, as well as on the box we're testing against
155
155
std::list<IntRect> wrappedGlowRects;
156
- for (std::list<IntRect>::iterator grItr = m_GlowAreas.begin (); grItr != m_GlowAreas.end (); ++grItr) {
157
- g_SceneMan.WrapRect ((*grItr), wrappedGlowRects);
156
+
157
+ for (const IntRect &glowArea : m_GlowAreas) {
158
+ g_SceneMan.WrapRect (glowArea, wrappedGlowRects);
158
159
}
159
160
std::list<IntRect> wrappedTestRects;
160
161
g_SceneMan.WrapRect (IntRect (boxPos.m_X , boxPos.m_Y , boxPos.m_X + boxWidth, boxPos.m_Y + boxHeight), wrappedTestRects);
161
162
162
163
// Check for intersections. If any are found, cut down the intersecting IntRect to the bounds of the IntRect we're testing against, then make and store a Box out of it
163
- for (IntRect wrappedTestRect : wrappedTestRects) {
164
- for (IntRect wrappedGlowRect : wrappedGlowRects) {
164
+ for (IntRect & wrappedTestRect : wrappedTestRects) {
165
+ for (IntRect & wrappedGlowRect : wrappedGlowRects) {
165
166
if (wrappedTestRect.Intersects (wrappedGlowRect)) {
166
167
IntRect cutRect (wrappedGlowRect);
167
168
cutRect.IntersectionCut (wrappedTestRect);
@@ -179,8 +180,8 @@ namespace RTE {
179
180
void PostProcessMan::GetNetworkPostEffectsList (short whichScreen, std::list<PostEffect> & outputList) {
180
181
ScreenRelativeEffectsMutex[whichScreen].lock ();
181
182
outputList.clear ();
182
- for (std::list< PostEffect>::iterator eItr = m_ScreenRelativeEffects[whichScreen]. begin (); eItr != m_ScreenRelativeEffects[whichScreen]. end (); ++eItr ) {
183
- outputList.push_back (PostEffect ((*eItr) .m_Pos , (*eItr) .m_Bitmap , (*eItr) .m_BitmapHash , (*eItr) .m_Strength , (*eItr) .m_Angle ));
183
+ for (const PostEffect &postEffect : m_ScreenRelativeEffects[whichScreen]) {
184
+ outputList.push_back (PostEffect (postEffect .m_Pos , postEffect .m_Bitmap , postEffect .m_BitmapHash , postEffect .m_Strength , postEffect .m_Angle ));
184
185
}
185
186
ScreenRelativeEffectsMutex[whichScreen].unlock ();
186
187
}
@@ -190,8 +191,8 @@ namespace RTE {
190
191
void PostProcessMan::SetNetworkPostEffectsList (short whichScreen, std::list<PostEffect> & inputList) {
191
192
ScreenRelativeEffectsMutex[whichScreen].lock ();
192
193
m_ScreenRelativeEffects[whichScreen].clear ();
193
- for (std::list< PostEffect>::iterator eItr = inputList. begin (); eItr != inputList. end (); ++eItr ) {
194
- m_ScreenRelativeEffects[whichScreen].push_back (PostEffect ((*eItr) .m_Pos , (*eItr) .m_Bitmap , (*eItr) .m_BitmapHash , (*eItr) .m_Strength , (*eItr) .m_Angle ));
194
+ for (const PostEffect &postEffect : inputList) {
195
+ m_ScreenRelativeEffects[whichScreen].push_back (PostEffect (postEffect .m_Pos , postEffect .m_Bitmap , postEffect .m_BitmapHash , postEffect .m_Strength , postEffect .m_Angle ));
195
196
}
196
197
ScreenRelativeEffectsMutex[whichScreen].unlock ();
197
198
}
@@ -203,13 +204,13 @@ namespace RTE {
203
204
bool unseen = false ;
204
205
Vector postEffectPosRelativeToBox;
205
206
206
- for (std::list< PostEffect>::iterator itr = m_PostSceneEffects. begin (); itr != m_PostSceneEffects. end (); ++itr ) {
207
- if (team != Activity::NOTEAM) { unseen = g_SceneMan.IsUnseen ((*itr) .m_Pos .m_X , (*itr) .m_Pos .m_Y , team); }
207
+ for (PostEffect &scenePostEffect : m_PostSceneEffects) {
208
+ if (team != Activity::NOTEAM) { unseen = g_SceneMan.IsUnseen (scenePostEffect .m_Pos .m_X , scenePostEffect .m_Pos .m_Y , team); }
208
209
209
- if (WithinBox ((*itr) .m_Pos , boxPos, boxWidth, boxHeight) && !unseen) {
210
+ if (WithinBox (scenePostEffect .m_Pos , boxPos, boxWidth, boxHeight) && !unseen) {
210
211
found = true ;
211
- postEffectPosRelativeToBox = (*itr) .m_Pos - boxPos;
212
- effectsList.push_back (PostEffect (postEffectPosRelativeToBox, (*itr) .m_Bitmap , (*itr) .m_BitmapHash , (*itr) .m_Strength , (*itr) .m_Angle ));
212
+ postEffectPosRelativeToBox = scenePostEffect .m_Pos - boxPos;
213
+ effectsList.push_back (PostEffect (postEffectPosRelativeToBox, scenePostEffect .m_Bitmap , scenePostEffect .m_BitmapHash , scenePostEffect .m_Strength , scenePostEffect .m_Angle ));
213
214
}
214
215
}
215
216
return found;
@@ -222,13 +223,13 @@ namespace RTE {
222
223
bool unseen = false ;
223
224
Vector postEffectPosRelativeToBox;
224
225
225
- for (std::list< PostEffect>::iterator itr = m_PostSceneEffects. begin (); itr != m_PostSceneEffects. end (); ++itr ) {
226
- if (team != Activity::NOTEAM) { unseen = g_SceneMan.IsUnseen ((*itr) .m_Pos .m_X , (*itr) .m_Pos .m_Y , team); }
226
+ for (PostEffect &scenePostEffect : m_PostSceneEffects) {
227
+ if (team != Activity::NOTEAM) { unseen = g_SceneMan.IsUnseen (scenePostEffect .m_Pos .m_X , scenePostEffect .m_Pos .m_Y , team); }
227
228
228
- if (WithinBox ((*itr) .m_Pos , left, top, right, bottom) && !unseen) {
229
+ if (WithinBox (scenePostEffect .m_Pos , left, top, right, bottom) && !unseen) {
229
230
found = true ;
230
- postEffectPosRelativeToBox = Vector ((*itr) .m_Pos .m_X - left, (*itr) .m_Pos .m_Y - top);
231
- effectsList.push_back (PostEffect (postEffectPosRelativeToBox, (*itr) .m_Bitmap , (*itr) .m_BitmapHash , (*itr) .m_Strength , (*itr) .m_Angle ));
231
+ postEffectPosRelativeToBox = Vector (scenePostEffect .m_Pos .m_X - left, scenePostEffect .m_Pos .m_Y - top);
232
+ effectsList.push_back (PostEffect (postEffectPosRelativeToBox, scenePostEffect .m_Bitmap , scenePostEffect .m_BitmapHash , scenePostEffect .m_Strength , scenePostEffect .m_Angle ));
232
233
}
233
234
}
234
235
return found;
@@ -309,12 +310,11 @@ namespace RTE {
309
310
310
311
// Randomly sample the entire backbuffer, looking for pixels to put a glow on.
311
312
// NOTE THIS IS SLOW, especially on higher resolutions!
312
- for (std::list<Box>::iterator bItr = m_PostScreenGlowBoxes.begin (); bItr != m_PostScreenGlowBoxes.end (); ++bItr) {
313
- startX = (*bItr).m_Corner .m_X ;
314
- startY = (*bItr).m_Corner .m_Y ;
315
- endX = startX + (*bItr).m_Width ;
316
- endY = startY + (*bItr).m_Height ;
317
- testpixel = 0 ;
313
+ for (const Box &glowBox : m_PostScreenGlowBoxes) {
314
+ startX = glowBox.m_Corner .m_X ;
315
+ startY = glowBox.m_Corner .m_Y ;
316
+ endX = startX + glowBox.m_Width ;
317
+ endY = startY + glowBox.m_Height ;
318
318
319
319
// Sanity check a little at least
320
320
if (startX < 0 || startX >= g_FrameMan.GetBackBuffer8 ()->w || startY < 0 || startY >= g_FrameMan.GetBackBuffer8 ()->h ||
0 commit comments