diff src/viewport.cpp @ 10196:d44af18ae6c7 draft

(svn r14409) -Codechange: Simplify a loop and correct a comment.
author frosch <frosch@openttd.org>
date Sun, 28 Sep 2008 12:38:56 +0000 (2008-09-28)
parents 7867701f63e4
children c54d140df948
line wrap: on
line diff
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1333,15 +1333,12 @@
 				}
 			}
 
-			/* Swap the two sprites ps and ps2 using bubble-sort algorithm. */
-			ParentSpriteToDraw **psd3 = psd;
-			do {
-				ParentSpriteToDraw *temp = *psd3;
-				*psd3 = ps2;
-				ps2 = temp;
-
-				psd3++;
-			} while (psd3 <= psd2);
+			/* Move ps2 in front of ps */
+			ParentSpriteToDraw *temp = ps2;
+			for (ParentSpriteToDraw **psd3 = psd2; psd3 > psd; psd3--) {
+				*psd3 = *(psd3 - 1);
+			}
+			*psd = temp;
 		}
 	}
 }