From 4b2e2f7503dead8ccedeff48677ed563aa8aa202 Mon Sep 17 00:00:00 2001 From: athile Date: Mon, 30 Aug 2010 11:37:48 +0100 Subject: [PATCH 1/2] Windows fixes --- gui/events.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/events.cpp b/gui/events.cpp index 73274ee505..713db85858 100644 --- a/gui/events.cpp +++ b/gui/events.cpp @@ -11,8 +11,8 @@ EventInjector::EventInjector(MyGUI::Gui *g) : gui(g), mouseX(0), mouseY(0), enabled(true) { assert(gui); - maxX = gui->getViewWidth(); - maxY = gui->getViewHeight(); + maxX = gui->getViewSize().width; + maxY = gui->getViewSize().height; } template From bf32845d07fa5fd5f2af9747cc2ad51ed1b72cd3 Mon Sep 17 00:00:00 2001 From: athile Date: Tue, 31 Aug 2010 01:47:18 +0100 Subject: [PATCH 2/2] Workaround for sound crash --- sound/sndmanager.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/sound/sndmanager.cpp b/sound/sndmanager.cpp index fe5ad80915..12708f10ce 100644 --- a/sound/sndmanager.cpp +++ b/sound/sndmanager.cpp @@ -1,6 +1,7 @@ #include "sndmanager.hpp" #include "../misc/list.hpp" +#include #include using namespace OEngine::Sound; @@ -126,8 +127,8 @@ public: struct SoundManager::SoundManagerList { private: - // A linked list of ManagedSound objects. - typedef Misc::List SoundList; + // A list of ManagedSound objects. + typedef std::set SoundList; SoundList list; public: @@ -140,24 +141,38 @@ public: // Remove a sound from the list void remove(ManagedSound *snd) { - list.remove(snd); + SoundList::iterator it = list.find(snd); + if (it != list.end()) + list.erase(it); } // Number of sounds in the list - int numSounds() { return list.getNum(); } + int numSounds() { return (int)list.size(); } // Update all sounds void updateAll() { - for(ManagedSound *s = list.getHead(); s != NULL; s=s->next) - s->update(); + // Iterate over a copy of the list since sounds may remove themselves + // from the master list during the iteration + SoundList tmp = list; + for (SoundList::iterator it = tmp.begin(); it != tmp.end(); ++it) + { + ManagedSound* pSound = *it; + pSound->update(); + } } // Detach and unlock all sounds void detachAll() { - for(ManagedSound *s = list.getHead(); s != NULL; s=s->next) - s->detach(); + // Iterate over a copy of the list since sounds may remove themselves + // from the master list during the iteration + SoundList tmp = list; + for (SoundList::iterator it = tmp.begin(); it != tmp.end(); ++it) + { + ManagedSound* pSound = *it; + pSound->detach(); + } } };