diff options
author | frosch <frosch@openttd.org> | 2008-09-28 12:38:56 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-09-28 12:38:56 +0000 |
commit | a370f32c154e0c3e724f222a6053e60e5cd1019c (patch) | |
tree | cda5f7cf2818cb6a980d50b390703df843b9aa9d | |
parent | f2d7c48b319f01bc91a51669630e0e024724b4f9 (diff) | |
download | openttd-a370f32c154e0c3e724f222a6053e60e5cd1019c.tar.xz |
(svn r14409) -Codechange: Simplify a loop and correct a comment.
-rw-r--r-- | src/viewport.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index ba4d44f82..ae7df8a6e 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1333,15 +1333,12 @@ static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv) } } - /* 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; } } } |