aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-06 14:38:08 +0000
committerEugene Sandulenko2010-10-12 22:36:30 +0000
commit7257ee345b9c71e0aa0677061de0a0466c183cb9 (patch)
treefd254b07f13f2dc01bebb4a32aceea8946b587f7
parent47904bc7b2992189bb554833f00a79ff0fea9fb8 (diff)
downloadscummvm-rg350-7257ee345b9c71e0aa0677061de0a0466c183cb9.tar.gz
scummvm-rg350-7257ee345b9c71e0aa0677061de0a0466c183cb9.tar.bz2
scummvm-rg350-7257ee345b9c71e0aa0677061de0a0466c183cb9.zip
SWORD25: More compilation fixes
svn-id: r53223
-rw-r--r--engines/sword25/gfx/animation.cpp33
-rw-r--r--engines/sword25/gfx/animationtemplateregistry.cpp7
-rw-r--r--engines/sword25/gfx/renderobject.cpp11
-rw-r--r--engines/sword25/gfx/renderobject.h8
-rw-r--r--engines/sword25/gfx/renderobjectmanager.cpp7
-rw-r--r--engines/sword25/gfx/renderobjectptr.cpp42
-rw-r--r--engines/sword25/gfx/renderobjectptr.h8
-rw-r--r--engines/sword25/gfx/rootrenderobject.h2
-rw-r--r--engines/sword25/module.mk1
9 files changed, 37 insertions, 82 deletions
diff --git a/engines/sword25/gfx/animation.cpp b/engines/sword25/gfx/animation.cpp
index f906f05828..cdfaf491ad 100644
--- a/engines/sword25/gfx/animation.cpp
+++ b/engines/sword25/gfx/animation.cpp
@@ -277,12 +277,11 @@ void BS_Animation::FrameNotification(int TimeElapsed) {
// Überläufe behandeln
if (TmpCurFrame < 0) {
// Loop-Point Callbacks
- Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = m_LoopPointCallbacks.begin();
- while (it != m_LoopPointCallbacks.end()) {
- if (((*it).Callback)((*it).Data) == false) {
- it = m_LoopPointCallbacks.erase(it);
+ for (uint i = 0; i < m_LoopPointCallbacks.size();) {
+ if ((m_LoopPointCallbacks[i].Callback)(m_LoopPointCallbacks[i].Data) == false) {
+ m_LoopPointCallbacks.remove_at(i);
} else
- it++;
+ i++;
}
// Ein Unterlauf darf nur auftreten, wenn der Animationstyp JOJO ist.
@@ -291,12 +290,11 @@ void BS_Animation::FrameNotification(int TimeElapsed) {
m_Direction = FORWARD;
} else if (static_cast<unsigned int>(TmpCurFrame) >= animationDescriptionPtr->GetFrameCount()) {
// Loop-Point Callbacks
- Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = m_LoopPointCallbacks.begin();
- while (it != m_LoopPointCallbacks.end()) {
- if (((*it).Callback)((*it).Data) == false)
- it = m_LoopPointCallbacks.erase(it);
- else
- it++;
+ for (uint i = 0; i < m_LoopPointCallbacks.size();) {
+ if ((m_LoopPointCallbacks[i].Callback)(m_LoopPointCallbacks[i].Data) == false) {
+ m_LoopPointCallbacks.remove_at(i);
+ } else
+ i++;
}
switch (animationDescriptionPtr->GetAnimationType()) {
@@ -325,12 +323,11 @@ void BS_Animation::FrameNotification(int TimeElapsed) {
if (animationDescriptionPtr->GetFrame(m_CurrentFrame).Action != "") {
// Action Callbacks
- Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = m_ActionCallbacks.begin();
- while (it != m_ActionCallbacks.end()) {
- if (((*it).Callback)((*it).Data) == false)
- it = m_ActionCallbacks.erase(it);
- else
- it++;
+ for (uint i = 0; i < m_ActionCallbacks.size();) {
+ if ((m_ActionCallbacks[i].Callback)(m_ActionCallbacks[i].Data) == false) {
+ m_ActionCallbacks.remove_at(i);
+ } else
+ i++;
}
}
}
@@ -679,7 +676,7 @@ void BS_Animation::PersistCallbackVector(BS_OutputPersistenceBlock &Writer, cons
// Alle Callbacks einzeln persistieren.
Common::Array<ANIMATION_CALLBACK_DATA>::const_iterator It = Vector.begin();
while (It != Vector.end()) {
- Writer.Write(BS_CallbackRegistry::GetInstance().ResolveCallbackPointer(It->Callback));
+ Writer.Write(BS_CallbackRegistry::GetInstance().ResolveCallbackPointer((void (*)(int))It->Callback));
Writer.Write(It->Data);
++It;
diff --git a/engines/sword25/gfx/animationtemplateregistry.cpp b/engines/sword25/gfx/animationtemplateregistry.cpp
index 32195e8166..be55381500 100644
--- a/engines/sword25/gfx/animationtemplateregistry.cpp
+++ b/engines/sword25/gfx/animationtemplateregistry.cpp
@@ -82,10 +82,10 @@ bool BS_AnimationTemplateRegistry::Persist(BS_OutputPersistenceBlock &Writer) {
HANDLE2PTR_MAP::const_iterator Iter = m_Handle2PtrMap.begin();
while (Iter != m_Handle2PtrMap.end()) {
// Handle persistieren.
- Writer.Write(Iter->first);
+ Writer.Write(Iter->_key);
// Objekt persistieren.
- Result &= Iter->second->Persist(Writer);
+ Result &= Iter->_value->Persist(Writer);
++Iter;
}
@@ -102,7 +102,8 @@ bool BS_AnimationTemplateRegistry::Unpersist(BS_InputPersistenceBlock &Reader) {
Reader.Read(m_NextHandle);
// Alle vorhandenen BS_AnimationTemplates zerstören.
- while (!m_Handle2PtrMap.empty()) delete m_Handle2PtrMap.begin()->second;
+ while (!m_Handle2PtrMap.empty())
+ delete m_Handle2PtrMap.begin()->_value;
// Anzahl an BS_AnimationTemplates einlesen.
unsigned int AnimationTemplateCount;
diff --git a/engines/sword25/gfx/renderobject.cpp b/engines/sword25/gfx/renderobject.cpp
index af70a4a047..8be0dfb380 100644
--- a/engines/sword25/gfx/renderobject.cpp
+++ b/engines/sword25/gfx/renderobject.cpp
@@ -84,7 +84,7 @@ BS_RenderObject::BS_RenderObject(BS_RenderObjectPtr<BS_RenderObject> ParentPtr,
// selben RenderObjektManager zuweisen.
if (m_ParentPtr.IsValid()) {
m_ManagerPtr = m_ParentPtr->GetManager();
- m_ParentPtr->AddObject(this);
+ m_ParentPtr->AddObject(this->GetHandle());
} else {
if (GetType() != TYPE_ROOT) {
BS_LOG_ERRORLN("Tried to create a non-root render object and has no parent. All non-root render objects have to have a parent.");
@@ -99,7 +99,7 @@ BS_RenderObject::BS_RenderObject(BS_RenderObjectPtr<BS_RenderObject> ParentPtr,
BS_RenderObject::~BS_RenderObject() {
// Objekt aus dem Elternobjekt entfernen.
- if (m_ParentPtr.IsValid()) m_ParentPtr->DetatchChildren(this);
+ if (m_ParentPtr.IsValid()) m_ParentPtr->DetatchChildren(this->GetHandle());
DeleteAllChildren();
@@ -128,7 +128,8 @@ bool BS_RenderObject::Render() {
// Dann müssen die Kinder gezeichnet werden
RENDEROBJECT_ITER it = m_Children.begin();
for (; it != m_Children.end(); ++it)
- if (!(*it)->Render()) return false;
+ if (!(*it)->Render())
+ return false;
return true;
}
@@ -251,7 +252,7 @@ bool BS_RenderObject::DetatchChildren(BS_RenderObjectPtr<BS_RenderObject> pObjec
}
void BS_RenderObject::SortRenderObjects() {
- std::sort(m_Children.begin(), m_Children.end(), Greater);
+ Common::sort(m_Children.begin(), m_Children.end(), Greater);
}
void BS_RenderObject::UpdateAbsolutePos() {
@@ -363,7 +364,7 @@ BS_RenderObjectPtr<BS_Panel> BS_RenderObject::AddPanel(int Width, int Height, un
// -----------------------------------------------------------------------------
-BS_RenderObjectPtr<BS_Text> BS_RenderObject::AddText(const Common::String &Font, const std::string &Text) {
+BS_RenderObjectPtr<BS_Text> BS_RenderObject::AddText(const Common::String &Font, const Common::String &Text) {
BS_RenderObjectPtr<BS_Text> TextPtr(new BS_Text(this));
if (TextPtr.IsValid() && TextPtr->GetInitSuccess() && TextPtr->SetFont(Font)) {
TextPtr->SetText(Text);
diff --git a/engines/sword25/gfx/renderobject.h b/engines/sword25/gfx/renderobject.h
index 9424303505..98c1828822 100644
--- a/engines/sword25/gfx/renderobject.h
+++ b/engines/sword25/gfx/renderobject.h
@@ -157,7 +157,7 @@ public:
Falls der Cast nicht zulässig ist, wird ein ungültiger BS_RenderObjectPtr zurückgegeben.
*/
BS_RenderObjectPtr<BS_Bitmap> ToBitmap() {
- if (m_Type == TYPE_STATICBITMAP || m_Type == TYPE_DYNAMICBITMAP) return BS_RenderObjectPtr<BS_Bitmap>(this);
+ if (m_Type == TYPE_STATICBITMAP || m_Type == TYPE_DYNAMICBITMAP) return BS_RenderObjectPtr<BS_Bitmap>(this->GetHandle());
else return BS_RenderObjectPtr<BS_Bitmap>();
}
/**
@@ -166,7 +166,7 @@ public:
Falls der Cast nicht zulässig ist, wird ein ungültiger BS_RenderObjectPtr zurückgegeben.
*/
BS_RenderObjectPtr<BS_Animation> ToAnimation() {
- if (m_Type == TYPE_ANIMATION) return BS_RenderObjectPtr<BS_Animation>(this);
+ if (m_Type == TYPE_ANIMATION) return BS_RenderObjectPtr<BS_Animation>(this->GetHandle());
else return BS_RenderObjectPtr<BS_Animation>();
}
/**
@@ -175,7 +175,7 @@ public:
Falls der Cast nicht zulässig ist, wird ein ungültiger BS_RenderObjectPtr zurückgegeben.
*/
BS_RenderObjectPtr<BS_Panel> ToPanel() {
- if (m_Type == TYPE_PANEL) return BS_RenderObjectPtr<BS_Panel>(this);
+ if (m_Type == TYPE_PANEL) return BS_RenderObjectPtr<BS_Panel>(this->GetHandle());
else return BS_RenderObjectPtr<BS_Panel>();
}
/**
@@ -184,7 +184,7 @@ public:
Falls der Cast nicht zulässig ist, wird ein ungültiger BS_RenderObjectPtr zurückgegeben.
*/
BS_RenderObjectPtr<BS_Text> ToText() {
- if (m_Type == TYPE_TEXT) return BS_RenderObjectPtr<BS_Text>(this);
+ if (m_Type == TYPE_TEXT) return BS_RenderObjectPtr<BS_Text>(this->GetHandle());
else return BS_RenderObjectPtr<BS_Text>();
}
diff --git a/engines/sword25/gfx/renderobjectmanager.cpp b/engines/sword25/gfx/renderobjectmanager.cpp
index 10b717c460..583cc77345 100644
--- a/engines/sword25/gfx/renderobjectmanager.cpp
+++ b/engines/sword25/gfx/renderobjectmanager.cpp
@@ -108,8 +108,11 @@ void BS_RenderObjectManager::AttatchTimedRenderObject(BS_RenderObjectPtr<BS_Time
// -----------------------------------------------------------------------------
void BS_RenderObjectManager::DetatchTimedRenderObject(BS_RenderObjectPtr<BS_TimedRenderObject> RenderObjectPtr) {
- RenderObjectList::iterator Iter = find(m_TimedRenderObjects.begin(), m_TimedRenderObjects.end(), RenderObjectPtr);
- if (Iter != m_TimedRenderObjects.end()) m_TimedRenderObjects.erase(Iter);
+ for (uint i = 0; i < m_TimedRenderObjects.size(); i++)
+ if (m_TimedRenderObjects[i] == RenderObjectPtr) {
+ m_TimedRenderObjects.remove_at(i);
+ break;
+ }
}
// -----------------------------------------------------------------------------
diff --git a/engines/sword25/gfx/renderobjectptr.cpp b/engines/sword25/gfx/renderobjectptr.cpp
deleted file mode 100644
index b32c185e47..0000000000
--- a/engines/sword25/gfx/renderobjectptr.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-/*
- * This code is based on Broken Sword 2.5 engine
- *
- * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
- *
- * Licensed under GNU GPL v2
- *
- */
-#include "sword25/gfx/renderobjectptr.h"
-
-namespace Sword25 {
-
-BS_RenderObjectPtr::BS_RenderObjectPtr(BS_RenderObject *RenderObjectPtr) {
- m_Handle = RenderObjectPtr->GetHandle();
-}
-
-} // End of namespace Sword25
diff --git a/engines/sword25/gfx/renderobjectptr.h b/engines/sword25/gfx/renderobjectptr.h
index 9dc0cf3aba..33746f19d1 100644
--- a/engines/sword25/gfx/renderobjectptr.h
+++ b/engines/sword25/gfx/renderobjectptr.h
@@ -57,13 +57,9 @@ class BS_RenderObject;
template<class T>
class BS_RenderObjectPtr {
public:
- BS_RenderObjectPtr() : m_Handle(0)
- {}
+ BS_RenderObjectPtr() : m_Handle(0) {}
- BS_RenderObjectPtr(unsigned int Handle) : m_Handle(Handle)
- {}
-
- BS_RenderObjectPtr(BS_RenderObject *RenderObjectPtr);
+ BS_RenderObjectPtr(unsigned int Handle) : m_Handle(Handle) {}
T *operator->() const {
return static_cast<T *>(BS_RenderObjectRegistry::GetInstance().ResolveHandle(m_Handle));
diff --git a/engines/sword25/gfx/rootrenderobject.h b/engines/sword25/gfx/rootrenderobject.h
index bbb92a3dab..5021f4f2d4 100644
--- a/engines/sword25/gfx/rootrenderobject.h
+++ b/engines/sword25/gfx/rootrenderobject.h
@@ -51,7 +51,7 @@ class BS_Kernel;
class BS_RenderObjectManager;
class BS_RootRenderObject : public BS_RenderObject {
- friend BS_RenderObjectManager;
+ friend class BS_RenderObjectManager;
private:
BS_RootRenderObject(BS_RenderObjectManager *ManagerPtr, int Width, int Height) :
diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk
index ab5d8cd9f8..6c2a531d93 100644
--- a/engines/sword25/module.mk
+++ b/engines/sword25/module.mk
@@ -21,7 +21,6 @@ MODULE_OBJS := \
gfx/panel.o \
gfx/renderobject.o \
gfx/renderobjectmanager.o \
- gfx/renderobjectptr.o \
gfx/renderobjectregistry.o \
gfx/screenshot.o \
gfx/staticbitmap.o \