diff options
author | Gregory Montoir | 2004-08-06 11:28:33 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-08-06 11:28:33 +0000 |
commit | 79f235ef269b8c01dc7dff5b43a80c755fbcdb61 (patch) | |
tree | d7e2522fc8f6527773c04395a5c6de566270a2b9 /queen/graphics.cpp | |
parent | f0d7ee966b519563fb25f8ab448ecf62fb7262e6 (diff) | |
download | scummvm-rg350-79f235ef269b8c01dc7dff5b43a80c755fbcdb61.tar.gz scummvm-rg350-79f235ef269b8c01dc7dff5b43a80c755fbcdb61.tar.bz2 scummvm-rg350-79f235ef269b8c01dc7dff5b43a80c755fbcdb61.zip |
minor cleanup
svn-id: r14484
Diffstat (limited to 'queen/graphics.cpp')
-rw-r--r-- | queen/graphics.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/queen/graphics.cpp b/queen/graphics.cpp index a9dcebfd6b..737ba2b850 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -190,6 +190,11 @@ void BobSlot::clear() { box = _defaultBox; } +static int compareBobDrawOrder(const void *a, const void *b) { + const BobSlot *bob1 = *(const BobSlot * const *)a; + const BobSlot *bob2 = *(const BobSlot * const *)b; + return bob1->y - bob2->y; +} const Box Graphics::_gameScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, ROOM_ZONE_HEIGHT - 1); const Box Graphics::_fullScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, GAME_SCREEN_HEIGHT - 1); @@ -333,7 +338,6 @@ void Graphics::sortBobs() { // animate/move the bobs for (int32 i = 0; i < ARRAYSIZE(_bobs); ++i) { - BobSlot *pbs = &_bobs[i]; if (pbs->active) { _sortedBobs[_sortedBobsCount] = pbs; @@ -354,19 +358,7 @@ void Graphics::sortBobs() { } } } - - // bubble sort the bobs - for (int32 index = 0; index < _sortedBobsCount - 1; ++index) { - int32 smallest = index; - for (int32 compare = index + 1; compare <= _sortedBobsCount - 1; ++compare) { - if (_sortedBobs[compare]->y < _sortedBobs[smallest]->y) { - smallest = compare; - } - } - if (index != smallest) { - SWAP(_sortedBobs[index], _sortedBobs[smallest]); - } - } + qsort(_sortedBobs, _sortedBobsCount, sizeof(BobSlot *), compareBobDrawOrder); } void Graphics::drawBobs() { |