SAGA: Add some const qualifiers to SagaEngine methods

svn-id: r53737
This commit is contained in:
Max Horn 2010-10-23 15:45:22 +00:00
parent da31121507
commit efcfb40da9
4 changed files with 14 additions and 15 deletions

View file

@ -56,9 +56,9 @@ struct SAGAGameDescription {
bool SagaEngine::isBigEndian() const { return isMacResources() && getGameId() == GID_ITE; } bool SagaEngine::isBigEndian() const { return isMacResources() && getGameId() == GID_ITE; }
bool SagaEngine::isMacResources() const { return (getPlatform() == Common::kPlatformMacintosh); } bool SagaEngine::isMacResources() const { return (getPlatform() == Common::kPlatformMacintosh); }
const GameResourceDescription *SagaEngine::getResourceDescription() { return _gameDescription->resourceDescription; } const GameResourceDescription *SagaEngine::getResourceDescription() const { return _gameDescription->resourceDescription; }
const GameFontDescription *SagaEngine::getFontDescription(int index) { const GameFontDescription *SagaEngine::getFontDescription(int index) const {
assert(index < _gameDescription->fontsCount); assert(index < _gameDescription->fontsCount);
return &_gameDescription->fontDescriptions[index]; return &_gameDescription->fontDescriptions[index];
} }

View file

@ -461,7 +461,7 @@ void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPoin
} }
} }
const char *SagaEngine::getObjectName(uint16 objectId) { const char *SagaEngine::getObjectName(uint16 objectId) const {
ActorData *actor; ActorData *actor;
ObjectData *obj; ObjectData *obj;
const HitZone *hitZone; const HitZone *hitZone;
@ -616,7 +616,7 @@ void SagaEngine::setTalkspeed(int talkspeed) {
ConfMan.setInt("talkspeed", (talkspeed * 255 + 3 / 2) / 3); ConfMan.setInt("talkspeed", (talkspeed * 255 + 3 / 2) / 3);
} }
int SagaEngine::getTalkspeed() { int SagaEngine::getTalkspeed() const {
return (ConfMan.getInt("talkspeed") * 3 + 255 / 2) / 255; return (ConfMan.getInt("talkspeed") * 3 + 255 / 2) / 255;
} }

View file

@ -486,15 +486,14 @@ public:
void save(const char *fileName, const char *saveName); void save(const char *fileName, const char *saveName);
void load(const char *fileName); void load(const char *fileName);
uint32 getCurrentLoadVersion() { uint32 getCurrentLoadVersion() const {
return _saveHeader.version; return _saveHeader.version;
} }
void fillSaveList(); void fillSaveList();
char *calcSaveFileName(uint slotNumber); char *calcSaveFileName(uint slotNumber);
SaveFileData *getSaveFile(uint idx); SaveFileData *getSaveFile(uint idx);
uint getSaveSlotNumber(uint idx); uint getNewSaveSlotNumber() const;
uint getNewSaveSlotNumber();
bool locateSaveFile(char *saveName, uint &titleNumber); bool locateSaveFile(char *saveName, uint &titleNumber);
bool isSaveListFull() const { bool isSaveListFull() const {
return _saveFilesCount == MAX_SAVES; return _saveFilesCount == MAX_SAVES;
@ -503,7 +502,7 @@ public:
return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1; return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1;
} }
bool isIHNMDemo() { return _isIHNMDemo; } bool isIHNMDemo() const { return _isIHNMDemo; }
int16 _framesEsc; int16 _framesEsc;
@ -559,12 +558,12 @@ public:
const byte *getImagePal(const byte *image_data, size_t image_size); const byte *getImagePal(const byte *image_data, size_t image_size);
void loadStrings(StringsTable &stringsTable, const byte *stringsPointer, size_t stringsLength); void loadStrings(StringsTable &stringsTable, const byte *stringsPointer, size_t stringsLength);
const char *getObjectName(uint16 objectId); const char *getObjectName(uint16 objectId) const;
public: public:
int processInput(); int processInput();
Point mousePos() const; Point mousePos() const;
int getMouseClickCount() { int getMouseClickCount() const {
return _mouseClickCount; return _mouseClickCount;
} }
@ -588,7 +587,7 @@ public:
return _leftMouseButtonPressed || _rightMouseButtonPressed; return _leftMouseButtonPressed || _rightMouseButtonPressed;
} }
inline int ticksToMSec(int tick) { inline int ticksToMSec(int tick) const {
if (getGameId() == GID_ITE) if (getGameId() == GID_ITE)
return tick * 1000 / kScriptTimeTicksPerSecond; return tick * 1000 / kScriptTimeTicksPerSecond;
else else
@ -619,9 +618,9 @@ public:
bool isBigEndian() const; bool isBigEndian() const;
bool isMacResources() const; bool isMacResources() const;
bool isSaga2() const { return getGameId() == GID_DINO || getGameId() == GID_FTA2; } bool isSaga2() const { return getGameId() == GID_DINO || getGameId() == GID_FTA2; }
const GameResourceDescription *getResourceDescription(); const GameResourceDescription *getResourceDescription() const;
const GameFontDescription *getFontDescription(int index); const GameFontDescription *getFontDescription(int index) const;
int getFontsCount() const; int getFontsCount() const;
int getGameId() const; int getGameId() const;
@ -650,7 +649,7 @@ private:
public: public:
ColorId KnownColor2ColorId(KnownColor knownColor); ColorId KnownColor2ColorId(KnownColor knownColor);
void setTalkspeed(int talkspeed); void setTalkspeed(int talkspeed);
int getTalkspeed(); int getTalkspeed() const;
}; };
} // End of namespace Saga } // End of namespace Saga

View file

@ -82,7 +82,7 @@ bool SagaEngine::locateSaveFile(char *saveName, uint &titleNumber) {
return false; return false;
} }
uint SagaEngine::getNewSaveSlotNumber() { uint SagaEngine::getNewSaveSlotNumber() const {
uint i, j; uint i, j;
bool found; bool found;
for (i = 0; i < MAX_SAVES; i++) { for (i = 0; i < MAX_SAVES; i++) {