From f6cd3357e8d99b91dc3f35c4af691364c17530cb Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Mon, 18 Jul 2011 15:04:19 +0200 Subject: [PATCH] COMPOSER: Some more sorting fixes. --- engines/composer/composer.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index 5c686241e7b..683e30f8fec 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -658,7 +658,11 @@ void ComposerEngine::removeSprite(uint16 id, uint16 animId) { } const Sprite *ComposerEngine::getSpriteAtPos(const Common::Point &pos) { - for (Common::List::iterator i = _sprites.begin(); i != _sprites.end(); i++) { + for (Common::List::iterator i = _sprites.reverse_begin(); i != _sprites.end(); --i) { + // avoid highest-level objects (e.g. the cursor) + if (!i->_zorder) + continue; + if (i->contains(pos)) return &(*i); } @@ -966,7 +970,17 @@ void ComposerEngine::loadLibrary(uint id) { uint16 buttonId = buttonResources[i]; Common::SeekableReadStream *stream = library._archive->getResource(ID_BUTN, buttonId); Button button(stream, buttonId); - _buttons.push_back(button); + + bool inserted = false; + for (Common::List