[Scummvm-git-logs] scummvm master -> dc210d1baf05797b704d767b8d8de4b8479ea228
mduggan
mgithub at guarana.org
Sun May 3 05:37:25 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f31db0c1db ULTIMA8: Const correctness
dc210d1baf ULTIMA1: Fix oob copy on startup
Commit: f31db0c1dbbc51f27ef8a252c15881194e3fc675
https://github.com/scummvm/scummvm/commit/f31db0c1dbbc51f27ef8a252c15881194e3fc675
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-05-03T14:37:07+09:00
Commit Message:
ULTIMA8: Const correctness
Changed paths:
engines/ultima/ultima8/misc/id_man.cpp
engines/ultima/ultima8/misc/id_man.h
engines/ultima/ultima8/usecode/uc_list.cpp
engines/ultima/ultima8/usecode/uc_list.h
engines/ultima/ultima8/usecode/uc_machine.cpp
engines/ultima/ultima8/usecode/uc_machine.h
engines/ultima/ultima8/world/actors/anim_action.cpp
engines/ultima/ultima8/world/actors/anim_action.h
engines/ultima/ultima8/world/actors/animation_tracker.cpp
engines/ultima/ultima8/world/actors/animation_tracker.h
engines/ultima/ultima8/world/actors/pathfinder.cpp
engines/ultima/ultima8/world/actors/pathfinder.h
diff --git a/engines/ultima/ultima8/misc/id_man.cpp b/engines/ultima/ultima8/misc/id_man.cpp
index 58a0a11145..55c85765d9 100644
--- a/engines/ultima/ultima8/misc/id_man.cpp
+++ b/engines/ultima/ultima8/misc/id_man.cpp
@@ -180,7 +180,7 @@ void idMan::clearID(uint16 id) {
assert(!_first || _last);
}
-void idMan::save(Common::WriteStream *ws) {
+void idMan::save(Common::WriteStream *ws) const {
ws->writeUint16LE(_begin);
ws->writeUint16LE(_end);
ws->writeUint16LE(_maxEnd);
diff --git a/engines/ultima/ultima8/misc/id_man.h b/engines/ultima/ultima8/misc/id_man.h
index 0fdbdb7f41..62350e584c 100644
--- a/engines/ultima/ultima8/misc/id_man.h
+++ b/engines/ultima/ultima8/misc/id_man.h
@@ -93,7 +93,7 @@ public:
_maxEnd = maxEnd;
}
- void save(Common::WriteStream *ws);
+ void save(Common::WriteStream *ws) const;
bool load(Common::ReadStream *rs, uint32 version);
private:
diff --git a/engines/ultima/ultima8/usecode/uc_list.cpp b/engines/ultima/ultima8/usecode/uc_list.cpp
index 01ab2ea89e..6f08a83032 100644
--- a/engines/ultima/ultima8/usecode/uc_list.cpp
+++ b/engines/ultima/ultima8/usecode/uc_list.cpp
@@ -114,7 +114,7 @@ void UCList::removeString(uint16 s, bool nodel) {
}
}
-void UCList::save(Common::WriteStream *ws) {
+void UCList::save(Common::WriteStream *ws) const {
ws->writeUint32LE(_elementSize);
ws->writeUint32LE(_size);
ws->write(&(_elements[0]), _size * _elementSize);
diff --git a/engines/ultima/ultima8/usecode/uc_list.h b/engines/ultima/ultima8/usecode/uc_list.h
index f499c8d3b1..7c7e45078c 100644
--- a/engines/ultima/ultima8/usecode/uc_list.h
+++ b/engines/ultima/ultima8/usecode/uc_list.h
@@ -155,7 +155,7 @@ public:
uint16 getStringIndex(uint32 index) const;
- void save(Common::WriteStream *ws);
+ void save(Common::WriteStream *ws) const;
bool load(Common::ReadStream *rs, uint32 version);
private:
diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index b65d6be2dc..dd4b0c9943 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -2247,11 +2247,11 @@ void UCMachine::usecodeStats() const {
#endif
}
-void UCMachine::saveGlobals(Common::WriteStream *ws) {
+void UCMachine::saveGlobals(Common::WriteStream *ws) const {
_globals->save(ws);
}
-void UCMachine::saveStrings(Common::WriteStream *ws) {
+void UCMachine::saveStrings(Common::WriteStream *ws) const {
_stringIDs->save(ws);
ws->writeUint32LE(static_cast<uint32>(_stringHeap.size()));
@@ -2263,7 +2263,7 @@ void UCMachine::saveStrings(Common::WriteStream *ws) {
}
}
-void UCMachine::saveLists(Common::WriteStream *ws) {
+void UCMachine::saveLists(Common::WriteStream *ws) const {
_listIDs->save(ws);
ws->writeUint32LE(_listHeap.size());
diff --git a/engines/ultima/ultima8/usecode/uc_machine.h b/engines/ultima/ultima8/usecode/uc_machine.h
index 5356576849..ea974fe8cc 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.h
+++ b/engines/ultima/ultima8/usecode/uc_machine.h
@@ -74,9 +74,9 @@ public:
bool assignPointer(uint32 ptr, const uint8 *data, uint32 size);
bool dereferencePointer(uint32 ptr, uint8 *data, uint32 size);
- void saveGlobals(Common::WriteStream *ws);
- void saveStrings(Common::WriteStream *ws);
- void saveLists(Common::WriteStream *ws);
+ void saveGlobals(Common::WriteStream *ws) const;
+ void saveStrings(Common::WriteStream *ws) const;
+ void saveLists(Common::WriteStream *ws) const;
bool loadGlobals(Common::ReadStream *rs, uint32 version);
bool loadStrings(Common::ReadStream *rs, uint32 version);
diff --git a/engines/ultima/ultima8/world/actors/anim_action.cpp b/engines/ultima/ultima8/world/actors/anim_action.cpp
index df45f56a80..ed12bb652e 100644
--- a/engines/ultima/ultima8/world/actors/anim_action.cpp
+++ b/engines/ultima/ultima8/world/actors/anim_action.cpp
@@ -59,7 +59,7 @@ void AnimAction::getAnimRange(unsigned int lastanim, int lastdir,
}
}
-void AnimAction::getAnimRange(Actor *actor, int dir,
+void AnimAction::getAnimRange(const Actor *actor, int dir,
unsigned int &startframe,
unsigned int &endframe) const {
getAnimRange(actor->getLastAnim(), actor->getDir(),
diff --git a/engines/ultima/ultima8/world/actors/anim_action.h b/engines/ultima/ultima8/world/actors/anim_action.h
index 1771453f4c..05633c11b6 100644
--- a/engines/ultima/ultima8/world/actors/anim_action.h
+++ b/engines/ultima/ultima8/world/actors/anim_action.h
@@ -68,7 +68,7 @@ struct AnimAction {
//! \param dir The direction
//! \param startframe The first frame to play
//! \param endframe The frame after the last frame to play
- void getAnimRange(Actor *actor, int dir,
+ void getAnimRange(const Actor *actor, int dir,
unsigned int &startframe, unsigned int &endframe) const;
//! return the range of the animation to play
diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.cpp b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
index b3b0dc0afa..2d98de4787 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.cpp
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
@@ -56,8 +56,8 @@ AnimationTracker::AnimationTracker() : _firstFrame(true), _done(false),
AnimationTracker::~AnimationTracker() {
}
-bool AnimationTracker::init(Actor *actor_, Animation::Sequence action_,
- uint32 dir_, PathfindingState *state_) {
+bool AnimationTracker::init(const Actor *actor_, Animation::Sequence action_,
+ uint32 dir_, const PathfindingState *state_) {
assert(actor_);
_actor = actor_->getObjId();
uint32 shape = actor_->getShape();
diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.h b/engines/ultima/ultima8/world/actors/animation_tracker.h
index d9fdba8933..8f5027ff86 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.h
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.h
@@ -41,8 +41,8 @@ public:
//! initialize the AnimationTracker for the given actor, action, dir
//! if state is non-zero, start from that state instead of the Actor's
//! current state
- bool init(Actor *actor, Animation::Sequence action, uint32 dir,
- PathfindingState *state = 0);
+ bool init(const Actor *actor, Animation::Sequence action, uint32 dir,
+ const PathfindingState *state = 0);
//! evaluate the maximum distance the actor will travel if the current
//! animation runs to completion by incremental calls to step
diff --git a/engines/ultima/ultima8/world/actors/pathfinder.cpp b/engines/ultima/ultima8/world/actors/pathfinder.cpp
index 472dcdea34..2fa546dfd6 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder.cpp
@@ -89,7 +89,7 @@ bool PathfindingState::checkItem(const Item *item, int xyRange, int zRange) cons
return (range <= xyRange);
}
-bool PathfindingState::checkHit(Actor *_actor, const Actor *target) {
+bool PathfindingState::checkHit(const Actor *_actor, const Actor *target) const {
assert(target);
#if 0
pout << "Trying hit in _direction " << _actor->getDirToItemCentre(*target) << Std::endl;
@@ -187,7 +187,7 @@ bool Pathfinder::alreadyVisited(int32 x, int32 y, int32 z) const {
return false;
}
-bool Pathfinder::checkTarget(PathNode *node) {
+bool Pathfinder::checkTarget(PathNode *node) const {
// TODO: these ranges are probably a bit too high,
// but otherwise it won't work properly yet -wjp
if (_targetItem) {
diff --git a/engines/ultima/ultima8/world/actors/pathfinder.h b/engines/ultima/ultima8/world/actors/pathfinder.h
index 670a896476..f0a74ff677 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.h
+++ b/engines/ultima/ultima8/world/actors/pathfinder.h
@@ -47,7 +47,7 @@ struct PathfindingState {
void load(const Actor *actor);
bool checkPoint(int32 x_, int32 y_, int32 z_, int range) const;
bool checkItem(const Item *item, int xyRange, int zRange) const;
- bool checkHit(Actor *actor, const Actor *target);
+ bool checkHit(const Actor *actor, const Actor *target) const;
};
struct PathfindingAction {
@@ -103,7 +103,7 @@ protected:
unsigned int steps);
void expandNode(PathNode *node);
unsigned int costHeuristic(PathNode *node);
- bool checkTarget(PathNode *node);
+ bool checkTarget(PathNode *node) const;
};
} // End of namespace Ultima8
Commit: dc210d1baf05797b704d767b8d8de4b8479ea228
https://github.com/scummvm/scummvm/commit/dc210d1baf05797b704d767b8d8de4b8479ea228
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-05-03T14:37:07+09:00
Commit Message:
ULTIMA1: Fix oob copy on startup
Changed paths:
engines/ultima/ultima1/core/resources.cpp
diff --git a/engines/ultima/ultima1/core/resources.cpp b/engines/ultima/ultima1/core/resources.cpp
index 88cc7f3ae3..e71d21de06 100644
--- a/engines/ultima/ultima1/core/resources.cpp
+++ b/engines/ultima/ultima1/core/resources.cpp
@@ -741,14 +741,14 @@ GameResources::GameResources(Shared::Resources *resManager) : LocalResourceFile(
Common::copy(SRC_RACE_NAMES, SRC_RACE_NAMES + 4, RACE_NAMES);
Common::copy(SRC_SEX_NAMES, SRC_SEX_NAMES + 3, SEX_NAMES);
Common::copy(SRC_CLASS_NAMES, SRC_CLASS_NAMES + 4, CLASS_NAMES);
- Common::copy(SRC_TRANSPORT_NAMES, SRC_TRANSPORT_NAMES + 10, TRANSPORT_NAMES);
+ Common::copy(SRC_TRANSPORT_NAMES, SRC_TRANSPORT_NAMES + 8, TRANSPORT_NAMES);
Common::copy(SRC_STAT_NAMES, SRC_STAT_NAMES + 11, STAT_NAMES);
Common::copy(SRC_STATUS_TEXT, SRC_STATUS_TEXT + 4, STATUS_TEXT);
Common::copy(SRC_DIRECTION_NAMES, SRC_DIRECTION_NAMES + 4, DIRECTION_NAMES);
Common::copy(SRC_DUNGEON_MOVES, SRC_DUNGEON_MOVES + 4, DUNGEON_MOVES);
- Common::copy(SRC_LOCATION_NAMES, SRC_LOCATION_NAMES + 85, LOCATION_NAMES);
- Common::copy(SRC_LOCATION_X, SRC_LOCATION_X + 84, LOCATION_X);
- Common::copy(SRC_LOCATION_Y, SRC_LOCATION_Y + 84, LOCATION_Y);
+ Common::copy(SRC_LOCATION_NAMES, SRC_LOCATION_NAMES + LOCATION_COUNT, LOCATION_NAMES);
+ Common::copy(SRC_LOCATION_X, SRC_LOCATION_X + LOCATION_COUNT, LOCATION_X);
+ Common::copy(SRC_LOCATION_Y, SRC_LOCATION_Y + LOCATION_COUNT, LOCATION_Y);
Common::copy(&SRC_LOCATION_PEOPLE[0][0], &SRC_LOCATION_PEOPLE[0][0] + 150 * 4, &LOCATION_PEOPLE[0][0]);
Common::copy(&SRC_DUNGEON_DRAW_DATA[0], &SRC_DUNGEON_DRAW_DATA[1964], DUNGEON_DRAW_DATA);
Common::copy(&SRC_DUNGEON_ITEM_NAMES[0], &SRC_DUNGEON_ITEM_NAMES[2], DUNGEON_ITEM_NAMES);
@@ -883,14 +883,14 @@ void GameResources::synchronize() {
syncStrings(RACE_NAMES, 4);
syncStrings(SEX_NAMES, 3);
syncStrings(CLASS_NAMES, 4);
- syncStrings(TRANSPORT_NAMES, 10);
+ syncStrings(TRANSPORT_NAMES, 8);
syncStrings(STAT_NAMES, 11);
syncStrings(STATUS_TEXT, 4);
syncStrings(DIRECTION_NAMES, 4);
syncStrings(DUNGEON_MOVES, 4);
syncStrings(LOCATION_NAMES, LOCATION_COUNT);
- syncBytes(LOCATION_X, 84);
- syncBytes(LOCATION_Y, 84);
+ syncBytes(LOCATION_X, LOCATION_COUNT);
+ syncBytes(LOCATION_Y, LOCATION_COUNT);
syncNumbers2D((int *)LOCATION_PEOPLE, 150, 4);
syncBytes(DUNGEON_DRAW_DATA, 1964);
syncStrings(DUNGEON_ITEM_NAMES, 2);
More information about the Scummvm-git-logs
mailing list