From 2c0033c7bad5b15c9bcccbce804e244a17a7f891 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Tue, 21 Aug 2012 23:00:29 -0400 Subject: LASTEXPRESS: Add const modifiers --- engines/lastexpress/entities/chapters.cpp | 2 +- engines/lastexpress/entities/chapters.h | 2 +- engines/lastexpress/entities/entity.cpp | 14 +++++++------- engines/lastexpress/entities/entity.h | 14 +++++++------- engines/lastexpress/game/beetle.cpp | 2 +- engines/lastexpress/game/entities.cpp | 2 +- engines/lastexpress/game/entities.h | 2 +- engines/lastexpress/game/scenes.cpp | 2 +- engines/lastexpress/game/scenes.h | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) (limited to 'engines') diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp index a2f3a3d871..d373432710 100644 --- a/engines/lastexpress/entities/chapters.cpp +++ b/engines/lastexpress/entities/chapters.cpp @@ -1851,7 +1851,7 @@ void Chapters::enterExitHelper(bool isEnteringStation) { callbackAction(); } -void Chapters::playSteam() { +void Chapters::playSteam() const { getSoundQueue()->resetState(); getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4)); ENTITY_PARAM(0, 2) = 0; diff --git a/engines/lastexpress/entities/chapters.h b/engines/lastexpress/entities/chapters.h index ddb3de3bea..fb52ea3ee4 100644 --- a/engines/lastexpress/entities/chapters.h +++ b/engines/lastexpress/entities/chapters.h @@ -157,7 +157,7 @@ private: bool timeCheckExitStation(TimeValue timeValue, uint ¶meter, byte callback, const char *sequence); void enterExitStation(const SavePoint &savepoint, bool isEnteringStation); void enterExitHelper(bool isEnteringStation); - void playSteam(); + void playSteam() const; }; } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp index 552e1a8a82..88b2ada185 100644 --- a/engines/lastexpress/entities/entity.cpp +++ b/engines/lastexpress/entities/entity.cpp @@ -50,7 +50,7 @@ EntityData::EntityCallData::~EntityCallData() { SAFE_DELETE(sequence3); } -void EntityData::EntityCallData::syncString(Common::Serializer &s, Common::String &string, int length) { +void EntityData::EntityCallData::syncString(Common::Serializer &s, Common::String &string, int length) const { char seqName[13]; memset(&seqName, 0, length); @@ -825,7 +825,7 @@ void Entity::setupIISS(const char *name, uint index, uint param1, uint param2, c // Helper functions ////////////////////////////////////////////////////////////////////////// -bool Entity::updateParameter(uint ¶meter, uint timeType, uint delta) { +bool Entity::updateParameter(uint ¶meter, uint timeType, uint delta) const { if (!parameter) parameter = (uint)(timeType + delta); @@ -837,7 +837,7 @@ bool Entity::updateParameter(uint ¶meter, uint timeType, uint delta) { return true; } -bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint ¶meter, uint delta) { +bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint ¶meter, uint delta) const { if (getState()->time <= timeValue) { if (check || !parameter) parameter = (uint)(getState()->time + delta); @@ -851,7 +851,7 @@ bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint ¶mete return true; } -bool Entity::updateParameterCheck(uint ¶meter, uint timeType, uint delta) { +bool Entity::updateParameterCheck(uint ¶meter, uint timeType, uint delta) const { if (parameter && parameter >= timeType) return false; @@ -861,7 +861,7 @@ bool Entity::updateParameterCheck(uint ¶meter, uint timeType, uint delta) { return true; } -bool Entity::timeCheck(TimeValue timeValue, uint ¶meter, Common::Functor0 *function) { +bool Entity::timeCheck(TimeValue timeValue, uint ¶meter, Common::Functor0 *function) const { if (getState()->time > timeValue && !parameter) { parameter = 1; (*function)(); @@ -936,14 +936,14 @@ bool Entity::timeCheckCar(TimeValue timeValue, uint ¶meter, byte callback, C return false; } -void Entity::timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) { +void Entity::timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) const { if (getState()->time > timeValue && !parameter) { parameter = 1; getSavePoints()->push(entity1, entity2, action); } } -void Entity::timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex object, ObjectLocation location) { +void Entity::timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex object, ObjectLocation location) const { if (getState()->time > timeValue && !parameter) { parameter = 1; getObjects()->updateLocation2(object, location); diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index e5c097b50a..c45367c43c 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -822,7 +822,7 @@ public: * @param string The string. * @param length Length of the string. */ - void syncString(Common::Serializer &s, Common::String &string, int length); + void syncString(Common::Serializer &s, Common::String &string, int length) const; // Serializable void saveLoadWithSerializer(Common::Serializer &s); @@ -1084,18 +1084,18 @@ protected: // Helper functions ////////////////////////////////////////////////////////////////////////// - bool updateParameter(uint ¶meter, uint timeType, uint delta); - bool updateParameterCheck(uint ¶meter, uint timeType, uint delta); - bool updateParameterTime(TimeValue timeValue, bool check, uint ¶meter, uint delta); + bool updateParameter(uint ¶meter, uint timeType, uint delta) const; + bool updateParameterCheck(uint ¶meter, uint timeType, uint delta) const; + bool updateParameterTime(TimeValue timeValue, bool check, uint ¶meter, uint delta) const; - bool timeCheck(TimeValue timeValue, uint ¶meter, Common::Functor0 *function); + bool timeCheck(TimeValue timeValue, uint ¶meter, Common::Functor0 *function) const; bool timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function); bool timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, const char *str, Common::Functor1 *function); bool timeCheckCallback(TimeValue timeValue, uint ¶meter, byte callback, bool check, Common::Functor1 *function); bool timeCheckCallbackInventory(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function); bool timeCheckCar(TimeValue timeValue, uint ¶meter, byte callback, Common::Functor0 *function); - void timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action); - void timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex index, ObjectLocation location); + void timeCheckSavepoint(TimeValue timeValue, uint ¶meter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) const; + void timeCheckObject(TimeValue timeValue, uint ¶meter, ObjectIndex index, ObjectLocation location) const; bool timeCheckCallbackAction(TimeValue timeValue, uint ¶meter); bool timeCheckPlaySoundUpdatePosition(TimeValue timeValue, uint ¶meter, byte callback, const char* sound, EntityPosition position); diff --git a/engines/lastexpress/game/beetle.cpp b/engines/lastexpress/game/beetle.cpp index 7cdd67caf5..d7a369ba40 100644 --- a/engines/lastexpress/game/beetle.cpp +++ b/engines/lastexpress/game/beetle.cpp @@ -94,7 +94,7 @@ void Beetle::load() { // Check that all sequences are loaded properly _data->isLoaded = true; - for (int i = 0; i < (int)_data->sequences.size(); i++) { + for (uint i = 0; i < _data->sequences.size(); i++) { if (!_data->sequences[i]->isLoaded()) { _data->isLoaded = false; break; diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp index 51db635bed..de30792405 100644 --- a/engines/lastexpress/game/entities.cpp +++ b/engines/lastexpress/game/entities.cpp @@ -669,7 +669,7 @@ void Entities::executeCallbacks() { ////////////////////////////////////////////////////////////////////////// // Processing ////////////////////////////////////////////////////////////////////////// -void Entities::incrementDirectionCounter(EntityData::EntityCallData *data) { +void Entities::incrementDirectionCounter(EntityData::EntityCallData *data) const { data->doProcessEntity = false; if (data->direction == kDirectionRight || (data->direction == kDirectionSwitch && data->directionSwitch == kDirectionRight)) diff --git a/engines/lastexpress/game/entities.h b/engines/lastexpress/game/entities.h index a9de7931f0..81aed627aa 100644 --- a/engines/lastexpress/game/entities.h +++ b/engines/lastexpress/game/entities.h @@ -344,7 +344,7 @@ private: uint _positions[_positionsCount]; void executeCallbacks(); - void incrementDirectionCounter(EntityData::EntityCallData *data); + void incrementDirectionCounter(EntityData::EntityCallData *data) const; void processEntity(EntityIndex entity); void drawSequence(EntityIndex entity, const char *sequence, EntityDirection direction) const; diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp index 3cda900757..a2c7226b93 100644 --- a/engines/lastexpress/game/scenes.cpp +++ b/engines/lastexpress/game/scenes.cpp @@ -739,7 +739,7 @@ void SceneManager::resetQueue() { _queue.clear(); } -void SceneManager::setCoordinates(Common::Rect rect) { +void SceneManager::setCoordinates(const Common::Rect &rect) { _flagCoordinates = true; if (_coords.right > rect.right) diff --git a/engines/lastexpress/game/scenes.h b/engines/lastexpress/game/scenes.h index a866c65111..1c7ae85f98 100644 --- a/engines/lastexpress/game/scenes.h +++ b/engines/lastexpress/game/scenes.h @@ -79,7 +79,7 @@ public: void removeAndRedraw(SequenceFrame **frame, bool doRedraw); void resetQueue(); void setCoordinates(SequenceFrame *frame); - void setCoordinates(Common::Rect rect); + void setCoordinates(const Common::Rect &rect); // Helpers SceneIndex getSceneIndexFromPosition(CarIndex car, Position position, int param3 = -1); -- cgit v1.2.3