From 53512b0841fdf90146220222f43721043d91f093 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Mon, 3 Dec 2012 10:42:58 +0100 Subject: WINTERMUTE: Const-ify member-functions that obviously should be const. --- engines/wintermute/base/base_dynamic_buffer.cpp | 2 +- engines/wintermute/base/base_dynamic_buffer.h | 2 +- engines/wintermute/base/base_fader.cpp | 2 +- engines/wintermute/base/base_fader.h | 2 +- engines/wintermute/base/base_script_holder.cpp | 4 ++-- engines/wintermute/base/base_script_holder.h | 4 ++-- engines/wintermute/base/base_scriptable.cpp | 2 +- engines/wintermute/base/base_scriptable.h | 2 +- engines/wintermute/base/base_transition_manager.cpp | 2 +- engines/wintermute/base/base_transition_manager.h | 2 +- engines/wintermute/base/base_viewport.cpp | 4 ++-- engines/wintermute/base/base_viewport.h | 4 ++-- engines/wintermute/base/file/base_file.h | 4 ++-- engines/wintermute/base/scriptables/script.cpp | 8 ++++---- engines/wintermute/base/scriptables/script.h | 8 ++++---- 15 files changed, 26 insertions(+), 26 deletions(-) (limited to 'engines/wintermute/base') diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp index fc48e93c2b..dc14a4e052 100644 --- a/engines/wintermute/base/base_dynamic_buffer.cpp +++ b/engines/wintermute/base/base_dynamic_buffer.cpp @@ -65,7 +65,7 @@ void BaseDynamicBuffer::cleanup() { ////////////////////////////////////////////////////////////////////////// -uint32 BaseDynamicBuffer::getSize() { +uint32 BaseDynamicBuffer::getSize() const { return _size; } diff --git a/engines/wintermute/base/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h index 2d1a7fbe48..ad78ebad00 100644 --- a/engines/wintermute/base/base_dynamic_buffer.h +++ b/engines/wintermute/base/base_dynamic_buffer.h @@ -43,7 +43,7 @@ public: void putString(const char *val); bool getBytes(byte *buffer, uint32 size); bool putBytes(const byte *buffer, uint32 size); - uint32 getSize(); + uint32 getSize() const; bool init(uint32 initSize = 0); void cleanup(); BaseDynamicBuffer(BaseGame *inGame, uint32 initSize = 1000, uint32 growBy = 1000); diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp index 985718fcab..8f74d71caf 100644 --- a/engines/wintermute/base/base_fader.cpp +++ b/engines/wintermute/base/base_fader.cpp @@ -164,7 +164,7 @@ bool BaseFader::fadeOut(uint32 targetColor, uint32 duration, bool system) { ////////////////////////////////////////////////////////////////////////// -uint32 BaseFader::getCurrentColor() { +uint32 BaseFader::getCurrentColor() const { return BYTETORGBA(_red, _green, _blue, _currentAlpha); } diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h index 116c8c963d..845ce2f244 100644 --- a/engines/wintermute/base/base_fader.h +++ b/engines/wintermute/base/base_fader.h @@ -36,7 +36,7 @@ namespace Wintermute { class BaseFader : public BaseObject { public: - uint32 getCurrentColor(); + uint32 getCurrentColor() const; bool fadeOut(uint32 targetColor, uint32 duration, bool system = false); bool fadeIn(uint32 sourceColor, uint32 duration, bool system = false); bool deactivate(); diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp index c5d5e82f76..abe5501b8d 100644 --- a/engines/wintermute/base/base_script_holder.cpp +++ b/engines/wintermute/base/base_script_holder.cpp @@ -342,7 +342,7 @@ bool BaseScriptHolder::removeScript(ScScript *script) { } ////////////////////////////////////////////////////////////////////////// -bool BaseScriptHolder::canHandleEvent(const char *EventName) { +bool BaseScriptHolder::canHandleEvent(const char *EventName) const { for (uint32 i = 0; i < _scripts.size(); i++) { if (!_scripts[i]->_thread && _scripts[i]->canHandleEvent(EventName)) { return true; @@ -353,7 +353,7 @@ bool BaseScriptHolder::canHandleEvent(const char *EventName) { ////////////////////////////////////////////////////////////////////////// -bool BaseScriptHolder::canHandleMethod(const char *MethodName) { +bool BaseScriptHolder::canHandleMethod(const char *MethodName) const { for (uint32 i = 0; i < _scripts.size(); i++) { if (!_scripts[i]->_thread && _scripts[i]->canHandleMethod(MethodName)) { return true; diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h index 5fd0dbec9c..320f0fb07a 100644 --- a/engines/wintermute/base/base_script_holder.h +++ b/engines/wintermute/base/base_script_holder.h @@ -43,8 +43,8 @@ public: virtual ~BaseScriptHolder(); virtual ScScript *invokeMethodThread(const char *methodName); virtual void makeFreezable(bool freezable); - bool canHandleEvent(const char *eventName); - virtual bool canHandleMethod(const char *eventMethod); + bool canHandleEvent(const char *eventName) const; + virtual bool canHandleMethod(const char *eventMethod) const; bool cleanup(); bool removeScript(ScScript *script); bool addScript(const char *filename); diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp index a2dd8b00e7..8c5ef7e45a 100644 --- a/engines/wintermute/base/base_scriptable.cpp +++ b/engines/wintermute/base/base_scriptable.cpp @@ -178,7 +178,7 @@ void BaseScriptable::scDebuggerDesc(char *buf, int bufSize) { } ////////////////////////////////////////////////////////////////////////// -bool BaseScriptable::canHandleMethod(const char *eventMethod) { +bool BaseScriptable::canHandleMethod(const char *eventMethod) const { return false; } diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h index fbe14fc299..b0b4e77ed2 100644 --- a/engines/wintermute/base/base_scriptable.h +++ b/engines/wintermute/base/base_scriptable.h @@ -48,7 +48,7 @@ public: virtual ~BaseScriptable(); // high level scripting interface - virtual bool canHandleMethod(const char *eventMethod); + virtual bool canHandleMethod(const char *eventMethod) const; virtual bool scSetProperty(const char *name, ScValue *value); virtual ScValue *scGetProperty(const Common::String &name); virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp index 7785f3d5af..6ae51d8e83 100644 --- a/engines/wintermute/base/base_transition_manager.cpp +++ b/engines/wintermute/base/base_transition_manager.cpp @@ -51,7 +51,7 @@ BaseTransitionMgr::~BaseTransitionMgr() { ////////////////////////////////////////////////////////////////////////// -bool BaseTransitionMgr::isReady() { +bool BaseTransitionMgr::isReady() const { return (_state == TRANS_MGR_READY); } diff --git a/engines/wintermute/base/base_transition_manager.h b/engines/wintermute/base/base_transition_manager.h index d16a44c88e..edb3045a58 100644 --- a/engines/wintermute/base/base_transition_manager.h +++ b/engines/wintermute/base/base_transition_manager.h @@ -41,7 +41,7 @@ public: bool _preserveInteractive; bool update(); bool start(TTransitionType type, bool nonInteractive = false); - bool isReady(); + bool isReady() const; TTransMgrState _state; BaseTransitionMgr(BaseGame *inGame); virtual ~BaseTransitionMgr(); diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp index 7ec995449f..b3c2cfa6c3 100644 --- a/engines/wintermute/base/base_viewport.cpp +++ b/engines/wintermute/base/base_viewport.cpp @@ -86,13 +86,13 @@ Rect32 *BaseViewport::getRect() { ////////////////////////////////////////////////////////////////////////// -int BaseViewport::getWidth() { +int BaseViewport::getWidth() const { return _rect.right - _rect.left; } ////////////////////////////////////////////////////////////////////////// -int BaseViewport::getHeight() { +int BaseViewport::getHeight() const { return _rect.bottom - _rect.top; } diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h index 98ad1c1e14..0182565a67 100644 --- a/engines/wintermute/base/base_viewport.h +++ b/engines/wintermute/base/base_viewport.h @@ -36,8 +36,8 @@ namespace Wintermute { class BaseObject; class BaseViewport : public BaseClass { public: - int getHeight(); - int getWidth(); + int getHeight() const; + int getWidth() const; Rect32 *getRect(); bool setRect(int left, int top, int right, int bottom, bool noCheck = false); DECLARE_PERSISTENT(BaseViewport, BaseClass) diff --git a/engines/wintermute/base/file/base_file.h b/engines/wintermute/base/file/base_file.h index 82f6ce3554..8eda6d51d9 100644 --- a/engines/wintermute/base/file/base_file.h +++ b/engines/wintermute/base/file/base_file.h @@ -45,10 +45,10 @@ protected: uint32 _pos; uint32 _size; public: - virtual uint32 getSize() { + virtual uint32 getSize() const { return _size; }; - virtual uint32 getPos() { + virtual uint32 getPos() const { return _pos; }; virtual bool seek(uint32 pos, int whence = SEEK_SET) = 0; diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp index 9469bd46a7..54d0a9cdc7 100644 --- a/engines/wintermute/base/scriptables/script.cpp +++ b/engines/wintermute/base/scriptables/script.cpp @@ -1108,7 +1108,7 @@ uint32 ScScript::getFuncPos(const Common::String &name) { ////////////////////////////////////////////////////////////////////////// -uint32 ScScript::getMethodPos(const Common::String &name) { +uint32 ScScript::getMethodPos(const Common::String &name) const { for (uint32 i = 0; i < _numMethods; i++) { if (name == _methods[i].name) { return _methods[i].pos; @@ -1332,7 +1332,7 @@ ScScript *ScScript::invokeEventHandler(const Common::String &eventName, bool unb ////////////////////////////////////////////////////////////////////////// -uint32 ScScript::getEventPos(const Common::String &name) { +uint32 ScScript::getEventPos(const Common::String &name) const { for (int i = _numEvents - 1; i >= 0; i--) { if (scumm_stricmp(name.c_str(), _events[i].name) == 0) { return _events[i].pos; @@ -1343,13 +1343,13 @@ uint32 ScScript::getEventPos(const Common::String &name) { ////////////////////////////////////////////////////////////////////////// -bool ScScript::canHandleEvent(const Common::String &eventName) { +bool ScScript::canHandleEvent(const Common::String &eventName) const { return getEventPos(eventName) != 0; } ////////////////////////////////////////////////////////////////////////// -bool ScScript::canHandleMethod(const Common::String &methodName) { +bool ScScript::canHandleMethod(const Common::String &methodName) const { return getMethodPos(methodName) != 0; } diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h index 0616bce58a..428eb9a17e 100644 --- a/engines/wintermute/base/scriptables/script.h +++ b/engines/wintermute/base/scriptables/script.h @@ -57,8 +57,8 @@ public: bool _freezable; bool resume(); bool pause(); - bool canHandleEvent(const Common::String &eventName); - bool canHandleMethod(const Common::String &methodName); + bool canHandleEvent(const Common::String &eventName) const; + bool canHandleMethod(const Common::String &methodName) const; bool createThread(ScScript *original, uint32 initIP, const Common::String &eventName); bool createMethodThread(ScScript *original, const Common::String &methodName); ScScript *invokeEventHandler(const Common::String &eventName, bool unbreakable = false); @@ -78,8 +78,8 @@ public: TScriptState _origState; ScValue *getVar(char *name); uint32 getFuncPos(const Common::String &name); - uint32 getEventPos(const Common::String &name); - uint32 getMethodPos(const Common::String &name); + uint32 getEventPos(const Common::String &name) const; + uint32 getMethodPos(const Common::String &name) const; typedef struct { uint32 magic; uint32 version; -- cgit v1.2.3