[Scummvm-git-logs] scummvm master -> 7c99060cd8b6ec63b2dfba0f6e307158f006b71f
sev-
sev at scummvm.org
Sun Jul 11 22:47:11 UTC 2021
This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fb37e70514 SAGA2: Fix task initializations. CID 1457866, 1457879, 1457959, 1458033
8d1ad08fe9 SAGA2: Init buffer before saving. CID 1458012
5ce5d6b1e0 SAGA2: Properly initialize VideoBox. CID 1457845
dc6c99f80e SAGA2: Remove useless assert. CID 1457977
539d99380e SAGA2: Remove useless check. CID 1457992
2c2f3e97d7 SAGA2: Fix potential buffer overrun. CID 1457896
28addf67cb SAGA2: Fix potential buffer overrun. CID 1457900 et al
2ca6bd2c9e SAGA2: Use safer string manipulation when constructing actor state. CID 1457846
9b244f5567 SAGA2: Unwrap unused loop in freeFall(). CID 1457883
f7aa3933b6 SAGA2: Removed useless null chack. CID 1458001
3c7e2ef033 SAGA2: Plug memory leak. CID 1458006
7c99060cd8 SAGA2: Remove logically dead code. CID 1457951
Commit: fb37e705142f9715348a510d70c5807c1180a69e
https://github.com/scummvm/scummvm/commit/fb37e705142f9715348a510d70c5807c1180a69e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:45+02:00
Commit Message:
SAGA2: Fix task initializations. CID 1457866, 1457879, 1457959, 1458033
Changed paths:
engines/saga2/task.h
diff --git a/engines/saga2/task.h b/engines/saga2/task.h
index 6456ea1a88..6de50c8127 100644
--- a/engines/saga2/task.h
+++ b/engines/saga2/task.h
@@ -790,9 +790,7 @@ class HuntTask : public Task {
public:
// Constructor -- initial construction
- HuntTask(TaskStack *ts) :
- Task(ts),
- huntFlags(0) {
+ HuntTask(TaskStack *ts) : Task(ts), huntFlags(0), subTask(nullptr) {
debugC(2, kDebugTasks, " - HuntTask");
_type = "HuntTask";
}
@@ -1381,7 +1379,7 @@ public:
int bandIndex;
public:
- BandingRepulsorIterator(Actor *actor) : a(actor) {}
+ BandingRepulsorIterator(Actor *actor) : a(actor), band(nullptr), bandIndex(0) {}
bool first(
TilePoint &repulsorVector,
@@ -1406,7 +1404,9 @@ public:
public:
BandAndAvoidEnemiesRepulsorIterator(Actor *actor) :
- BandingRepulsorIterator(actor) {
+ BandingRepulsorIterator(actor), numActors(0), actorIndex(0), iteratingThruEnemies(false) {
+ for (int i = 0; i < 6; i++)
+ actorArray[i] = 0;
}
private:
@@ -1565,7 +1565,7 @@ public:
Task(ts),
gotoWayPoint(NULL),
patrolIter(iter),
- lastWayPointNum(stopAt) {
+ lastWayPointNum(stopAt), counter(0) {
debugC(2, kDebugTasks, " - FollowPatrolRouteTask");
_type = "FollowPatrolRouteTask";
followPatrolRoute();
Commit: 8d1ad08fe9aa783a4aea68c6cf168b301979a159
https://github.com/scummvm/scummvm/commit/8d1ad08fe9aa783a4aea68c6cf168b301979a159
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:45+02:00
Commit Message:
SAGA2: Init buffer before saving. CID 1458012
Changed paths:
engines/saga2/tile.cpp
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 8487c2afcf..baeb34c856 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -1874,7 +1874,7 @@ void saveAutoMap(SaveFileConstructor &saveGame) {
// for each map metatile slot
archiveBufSize = (totalMapSize + 7) >> 3;
- archiveBuffer = (uint8 *)malloc(archiveBufSize);
+ archiveBuffer = (uint8 *)calloc(1, archiveBufSize);
if (archiveBuffer == nullptr)
error("Unable to allocate auto map archive buffer");
Commit: 5ce5d6b1e02640a03f92adffb21484b4f21f605a
https://github.com/scummvm/scummvm/commit/5ce5d6b1e02640a03f92adffb21484b4f21f605a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:45+02:00
Commit Message:
SAGA2: Properly initialize VideoBox. CID 1457845
Changed paths:
engines/saga2/videobox.cpp
diff --git a/engines/saga2/videobox.cpp b/engines/saga2/videobox.cpp
index fe5d0ce24a..3ae337ba2e 100644
--- a/engines/saga2/videobox.cpp
+++ b/engines/saga2/videobox.cpp
@@ -50,6 +50,9 @@ CVideoBox::CVideoBox(const Rect16 &box,
// null out the decRes pointer
decRes = NULL;
+
+ rInfo.result = -1;
+ rInfo.running = false;
}
CVideoBox::~CVideoBox(void) {
Commit: dc6c99f80e27a1cee1f680ab19b2c1691dba4acc
https://github.com/scummvm/scummvm/commit/dc6c99f80e27a1cee1f680ab19b2c1691dba4acc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:45+02:00
Commit Message:
SAGA2: Remove useless assert. CID 1457977
Changed paths:
engines/saga2/actor.cpp
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 1f6c838e97..417bd58447 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -1545,7 +1545,7 @@ void Actor::write(Common::OutSaveFile *out) {
if (flags & hasAssignment)
writeAssignment(this, out);
-
+
debugC(4, kDebugSaveload, "... faction = %d", faction);
debugC(4, kDebugSaveload, "... colorScheme = %d", colorScheme);
debugC(4, kDebugSaveload, "... appearanceID = %d", appearanceID);
@@ -3777,14 +3777,10 @@ void loadActors(SaveFileReader &saveGame) {
saveGame.read(archiveBuffer, archiveBufSize);
- for (i = 0, bufferPtr = archiveBuffer;
- i < actorCount;
- i++)
+ for (i = 0, bufferPtr = archiveBuffer; i < actorCount; i++)
// Initilize actors with archive data
new (&actorList[i]) Actor(&bufferPtr);
- assert(bufferPtr == &((char *)archiveBuffer)[archiveBufSize]);
-
// Deallocate the archive buffer
free(archiveBuffer);
}
Commit: 539d99380ef8f570629490390cb6057c5a92c30d
https://github.com/scummvm/scummvm/commit/539d99380ef8f570629490390cb6057c5a92c30d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:45+02:00
Commit Message:
SAGA2: Remove useless check. CID 1457992
There is an assert above which catches this condition
Changed paths:
engines/saga2/automap.cpp
diff --git a/engines/saga2/automap.cpp b/engines/saga2/automap.cpp
index 4aa5a925c8..838b10d489 100644
--- a/engines/saga2/automap.cpp
+++ b/engines/saga2/automap.cpp
@@ -234,7 +234,8 @@ void CAutoMap::locateRegion(void) {
}
free(trRes);
- if (areaRes) auxResFile->disposeContext(areaRes);
+
+ auxResFile->disposeContext(areaRes);
baseCoords.u = centerCoords.u - summaryRadius;
baseCoords.v = centerCoords.v - summaryRadius;
Commit: 2c2f3e97d7b77a2ad31bd9f2db919a9e12325999
https://github.com/scummvm/scummvm/commit/2c2f3e97d7b77a2ad31bd9f2db919a9e12325999
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:45+02:00
Commit Message:
SAGA2: Fix potential buffer overrun. CID 1457896
Changed paths:
engines/saga2/document.cpp
diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp
index 85009e835a..4c3d7d385a 100644
--- a/engines/saga2/document.cpp
+++ b/engines/saga2/document.cpp
@@ -473,7 +473,7 @@ void CDocument::makePages(void) {
bool newPage = false;
- while (offset >= 0 && pageIndex <= maxPages) {
+ while (offset >= 0 && pageIndex < maxPages) {
while (offset >= 0 &&
lineIndex < linesPerPage &&
!newPage) {
Commit: 28addf67cbe52748d1f5735d44123fb5e30b7e78
https://github.com/scummvm/scummvm/commit/28addf67cbe52748d1f5735d44123fb5e30b7e78
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:45+02:00
Commit Message:
SAGA2: Fix potential buffer overrun. CID 1457900 et al
Changed paths:
engines/saga2/document.cpp
diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp
index 4c3d7d385a..863720ba99 100644
--- a/engines/saga2/document.cpp
+++ b/engines/saga2/document.cpp
@@ -430,25 +430,26 @@ bool CDocument::checkForImage(char *string,
"book internal image");
numEat = 8;
}
- }
- // get the size of the image
- imageSizes[offPageIndex] =
- ((ImageHeader *)images[offPageIndex])->size;
+ // get the size of the image
+ imageSizes[offPageIndex] = ((ImageHeader *)images[offPageIndex])->size;
- // tie off the end
- strIndex[0] = 0;
+ // tie off the end
+ strIndex[0] = 0;
- // and string them together
- strcat(&strIndex[0], &strIndex[2 + 1 + numEat]);
+ // and string them together
+ strcat(&strIndex[0], &strIndex[2 + 1 + numEat]);
- // set new line length
- offset = index;
+ // set new line length
+ offset = index;
- // set the line offset
- lineOffset[offPageIndex] =
- imageSizes[offPageIndex].y / (textHeight + 1) +
- textPictureOffset;
+ // set the line offset
+ lineOffset[offPageIndex] =
+ imageSizes[offPageIndex].y / (textHeight + 1) +
+ textPictureOffset;
+ } else {
+ warning("CDocument: Document overflow");
+ }
// set the new page flag
return true;
Commit: 2ca6bd2c9e883201f4271c1b27020cc1bd075aa8
https://github.com/scummvm/scummvm/commit/2ca6bd2c9e883201f4271c1b27020cc1bd075aa8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:45+02:00
Commit Message:
SAGA2: Use safer string manipulation when constructing actor state. CID 1457846
Changed paths:
engines/saga2/intrface.cpp
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index 4ad8abcf7f..8575c52de4 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -556,16 +556,6 @@ void CPortrait::ORset(uint16 brotherID, PortraitType type) { // brotherID = post
setPortrait(brotherID);
}
-size_t appendToStr(char *dst, const char *src, size_t srcLen, size_t maxCpyLen) {
- size_t cpyLen;
-
- cpyLen = MIN(srcLen, maxCpyLen);
- memcpy(dst, src, cpyLen);
- dst[cpyLen] = '\0';
-
- return cpyLen;
-}
-
void CPortrait::getStateString(char buf[], int8 size, uint16 brotherID) {
static char asleepStr[] = ASLEEP_STATE;
static char paralysedStr[] = PARALY_STATE;
@@ -582,7 +572,6 @@ void CPortrait::getStateString(char buf[], int8 size, uint16 brotherID) {
PlayerActor *pa = getPlayerActorAddress(brotherID);
Actor *a = pa->getActor();
ActorAttributes &stats = pa->getBaseStats();
- size_t length = 0;
buf[size - 1] = '\0';
@@ -594,96 +583,43 @@ void CPortrait::getStateString(char buf[], int8 size, uint16 brotherID) {
buf[0] = '\0';
if (a->enchantmentFlags & (1 << actorAsleep)) {
- length += appendToStr(
- &buf[length],
- asleepStr,
- ARRAYSIZE(asleepStr) - 1,
- size - length - 1);
+ Common::strlcat(buf, asleepStr, size);
} else if (a->enchantmentFlags & (1 << actorParalyzed)) {
- length += appendToStr(
- &buf[length],
- paralysedStr,
- ARRAYSIZE(paralysedStr) - 1,
- size - length - 1);
+ Common::strlcat(buf, paralysedStr, size);
} else if (a->enchantmentFlags & (1 << actorBlind)) {
- length += appendToStr(
- &buf[length],
- blindStr,
- ARRAYSIZE(blindStr) - 1,
- size - length - 1);
+ Common::strlcat(buf, blindStr, size);
} else if (a->enchantmentFlags & (1 << actorFear)) {
- length += appendToStr(
- &buf[length],
- afraidStr,
- ARRAYSIZE(afraidStr) - 1,
- size - length - 1);
+ Common::strlcat(buf, afraidStr, size);
} else if (pa->isAggressive()) {
- length += appendToStr(
- &buf[length],
- angryStr,
- ARRAYSIZE(angryStr) - 1,
- size - length - 1);
+ Common::strlcat(buf, angryStr, size);
}
if (stats.vitality >= a->effectiveStats.vitality * 3) {
- if (length != 0)
- length += appendToStr(
- &buf[length],
- commaStr,
- ARRAYSIZE(commaStr) - 1,
- size - length - 1);
- length += appendToStr(
- &buf[length],
- badlyWoundedStr,
- ARRAYSIZE(badlyWoundedStr) - 1,
- size - length - 1);
+ if (buf[0] != '\0') // strlen(buf) > 0
+ Common::strlcat(buf, commaStr, size);
+
+ Common::strlcat(buf, badlyWoundedStr, size);
} else if (stats.vitality * 2 > a->effectiveStats.vitality * 3) {
- if (length != 0)
- length += appendToStr(
- &buf[length],
- commaStr,
- ARRAYSIZE(commaStr) - 1,
- size - length - 1);
- length += appendToStr(
- &buf[length],
- hurtStr,
- ARRAYSIZE(hurtStr) - 1,
- size - length - 1);
+ if (buf[0] != '\0') // strlen(buf) > 0
+ Common::strlcat(buf, commaStr, size);
+
+ Common::strlcat(buf, hurtStr, size);
}
if (a->enchantmentFlags & (1 << actorPoisoned)) {
- if (length != 0)
- length += appendToStr(
- &buf[length],
- commaStr,
- ARRAYSIZE(commaStr) - 1,
- size - length - 1);
- length += appendToStr(
- &buf[length],
- poisonedStr,
- ARRAYSIZE(poisonedStr) - 1,
- size - length - 1);
+ if (buf[0] != '\0') // strlen(buf) > 0
+ Common::strlcat(buf, commaStr, size);
+
+ Common::strlcat(buf, poisonedStr, size);
} else if (a->enchantmentFlags & (1 << actorDiseased)) {
- if (length != 0)
- length += appendToStr(
- &buf[length],
- commaStr,
- ARRAYSIZE(commaStr) - 1,
- size - length - 1);
- length += appendToStr(
- &buf[length],
- diseasedStr,
- ARRAYSIZE(diseasedStr) - 1,
- size - length - 1);
- }
-
- if (length == 0) {
- length += appendToStr(
- &buf[length],
- normalStr,
- ARRAYSIZE(normalStr) - 1,
- size - length - 1);
+ if (buf[0] != '\0') // strlen(buf) > 0
+ Common::strlcat(buf, commaStr, size);
+
+ Common::strlcat(buf, diseasedStr, size);
}
+
+ if (buf[0] == '\0') // strlen(buf) == 0
+ Common::strlcat(buf, normalStr, size);
}
/* ===================================================================== *
Commit: 9b244f55671de70ab14261fee4362ed650220fc9
https://github.com/scummvm/scummvm/commit/9b244f55671de70ab14261fee4362ed650220fc9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:46+02:00
Commit Message:
SAGA2: Unwrap unused loop in freeFall(). CID 1457883
Changed paths:
engines/saga2/motion.cpp
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index 9dbd888f4b..5b29120c0f 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -5196,101 +5196,99 @@ supported:
}
- for (;;) {
- // Otherwise, begin a fall sequence...
- tPos = newPos;
-
- // Attempt to solve cases where he gets stuck in falling,
- // by checking the contact of what he's about to fall on.
- if (tPos.z > tHeight) tPos.z--;
- // See if we fell on something.
- if (checkContact(object, tPos) == blockageNone) {
+ // Otherwise, begin a fall sequence...
+ tPos = newPos;
+
+ // Attempt to solve cases where he gets stuck in falling,
+ // by checking the contact of what he's about to fall on.
+ if (tPos.z > tHeight) tPos.z--;
+ // See if we fell on something.
+ if (checkContact(object, tPos) == blockageNone) {
falling:
- if (motionType != motionTypeWalk
- || newPos.z > gravity * 4
- || tHeight >= 0) {
- motionType = motionTypeThrown;
-
-// newPos = tPos;
- object->move(tPos);
- return true;
- } else {
- newPos = tPos;
- return false;
- }
- }
+ if (motionType != motionTypeWalk
+ || newPos.z > gravity * 4
+ || tHeight >= 0) {
+ motionType = motionTypeThrown;
- // If we fall on something, reduce velocity due to impact.
- // Try a couple of probes to see if we can fall in
- // other directions.
- objCrossSection = object->proto()->crossSection;
-
- tPos.u += objCrossSection;
- if (!checkBlocked(object, tPos)
- && !checkContact(object, tPos))
- goto falling;
-
- tPos.u -= objCrossSection * 2;
- if (!checkBlocked(object, tPos)
- && !checkContact(object, tPos))
- goto falling;
-
- tPos.u += objCrossSection;
- tPos.v += objCrossSection;
- if (!checkBlocked(object, tPos)
- && !checkContact(object, tPos))
- goto falling;
-
- tPos.v -= objCrossSection * 2;
- if (!checkBlocked(object, tPos)
- && !checkContact(object, tPos))
- goto falling;
-
- // There is no support for the object and there is no place to fall
- // so cheat and pretend this whole mess never happened.
- tPos = newPos;
-
- tPos.u += objCrossSection;
- tHeight = tileSlopeHeight(tPos, object, &sti);
- if (tHeight <= tPos.z + kMaxStepHeight
- && tHeight >= tPos.z - gravity * 4) {
+// newPos = tPos;
+ object->move(tPos);
+ return true;
+ } else {
newPos = tPos;
- goto supported;
+ return false;
}
+ }
- tPos.u -= objCrossSection * 2;
- tHeight = tileSlopeHeight(tPos, object, &sti);
- if (tHeight <= tPos.z + kMaxStepHeight
- && tHeight >= tPos.z - gravity * 4) {
- newPos = tPos;
- goto supported;
- }
+ // If we fall on something, reduce velocity due to impact.
+ // Try a couple of probes to see if we can fall in
+ // other directions.
+ objCrossSection = object->proto()->crossSection;
+
+ tPos.u += objCrossSection;
+ if (!checkBlocked(object, tPos)
+ && !checkContact(object, tPos))
+ goto falling;
+
+ tPos.u -= objCrossSection * 2;
+ if (!checkBlocked(object, tPos)
+ && !checkContact(object, tPos))
+ goto falling;
+
+ tPos.u += objCrossSection;
+ tPos.v += objCrossSection;
+ if (!checkBlocked(object, tPos)
+ && !checkContact(object, tPos))
+ goto falling;
+
+ tPos.v -= objCrossSection * 2;
+ if (!checkBlocked(object, tPos)
+ && !checkContact(object, tPos))
+ goto falling;
+
+ // There is no support for the object and there is no place to fall
+ // so cheat and pretend this whole mess never happened.
+ tPos = newPos;
+
+ tPos.u += objCrossSection;
+ tHeight = tileSlopeHeight(tPos, object, &sti);
+ if (tHeight <= tPos.z + kMaxStepHeight
+ && tHeight >= tPos.z - gravity * 4) {
+ newPos = tPos;
+ goto supported;
+ }
- tPos.u += objCrossSection;
- tPos.v += objCrossSection;
- tHeight = tileSlopeHeight(tPos, object, &sti);
- if (tHeight <= tPos.z + kMaxStepHeight
- && tHeight >= tPos.z - gravity * 4) {
- newPos = tPos;
- goto supported;
- }
+ tPos.u -= objCrossSection * 2;
+ tHeight = tileSlopeHeight(tPos, object, &sti);
+ if (tHeight <= tPos.z + kMaxStepHeight
+ && tHeight >= tPos.z - gravity * 4) {
+ newPos = tPos;
+ goto supported;
+ }
- tPos.v -= objCrossSection * 2;
- tHeight = tileSlopeHeight(tPos, object, &sti);
- if (tHeight <= tPos.z + kMaxStepHeight
- && tHeight >= tPos.z - gravity * 4) {
- newPos = tPos;
- goto supported;
- }
+ tPos.u += objCrossSection;
+ tPos.v += objCrossSection;
+ tHeight = tileSlopeHeight(tPos, object, &sti);
+ if (tHeight <= tPos.z + kMaxStepHeight
+ && tHeight >= tPos.z - gravity * 4) {
+ newPos = tPos;
+ goto supported;
+ }
- // If we STILL cannot find support for the object, change its
- // position and try again. This should be very rare.
- newPos.z--;
- object->move(newPos);
- unstickObject(object);
- newPos = object->getLocation();
- return true;
+ tPos.v -= objCrossSection * 2;
+ tHeight = tileSlopeHeight(tPos, object, &sti);
+ if (tHeight <= tPos.z + kMaxStepHeight
+ && tHeight >= tPos.z - gravity * 4) {
+ newPos = tPos;
+ goto supported;
}
+
+ // If we STILL cannot find support for the object, change its
+ // position and try again. This should be very rare.
+ newPos.z--;
+ object->move(newPos);
+ unstickObject(object);
+ newPos = object->getLocation();
+ return true;
}
//-----------------------------------------------------------------------
@@ -5461,7 +5459,7 @@ void saveMotionTasks(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving MotionTasks");
int32 archiveBufSize;
-
+
archiveBufSize = g_vm->_mTaskList->archiveSize();
out->write("MOTN", 4);
Commit: f7aa3933b6b2ca3c333a7cf564cf8bf3d2ec940c
https://github.com/scummvm/scummvm/commit/f7aa3933b6b2ca3c333a7cf564cf8bf3d2ec940c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:46+02:00
Commit Message:
SAGA2: Removed useless null chack. CID 1458001
Changed paths:
engines/saga2/motion.cpp
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index 5b29120c0f..1b4df7ee9c 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -4860,7 +4860,7 @@ void MotionTask::updatePositions(void) {
mt->o.directObject->useOn(
a->thisID(),
mt->o.indirectObject->thisID());
- if (mt && mt->motionType == motionTypeUseObjectOnObject)
+ if (mt->motionType == motionTypeUseObjectOnObject)
moveTaskDone = true;
else
g_vm->_nextMT = it;
@@ -4872,7 +4872,7 @@ void MotionTask::updatePositions(void) {
mt->o.directObject->useOn(
a->thisID(),
mt->o.indirectObject->thisID());
- if (mt && mt->motionType == motionTypeUseObjectOnObject)
+ if (mt->motionType == motionTypeUseObjectOnObject)
moveTaskDone = true;
else
g_vm->_nextMT = it;
@@ -4913,7 +4913,7 @@ void MotionTask::updatePositions(void) {
// The actor will now be uniterruptable
a->setActionPoints(2);
mt->o.directObject->useOn(a->thisID(), mt->o.TAI);
- if (mt && mt->motionType == motionTypeUseObjectOnTAI)
+ if (mt->motionType == motionTypeUseObjectOnTAI)
moveTaskDone = true;
else
g_vm->_nextMT = it;
@@ -4933,7 +4933,7 @@ void MotionTask::updatePositions(void) {
// The actor will now be uniterruptable
a->setActionPoints(2);
mt->o.directObject->useOn(a->thisID(), mt->targetLoc);
- if (mt && mt->motionType == motionTypeUseObjectOnLocation)
+ if (mt->motionType == motionTypeUseObjectOnLocation)
moveTaskDone = true;
else
g_vm->_nextMT = it;
@@ -4993,7 +4993,7 @@ void MotionTask::updatePositions(void) {
mt->o.directObject->drop(a->thisID(),
mt->targetLoc,
mt->moveCount);
- if (mt && mt->motionType == motionTypeDropObject)
+ if (mt->motionType == motionTypeDropObject)
moveTaskDone = true;
else
g_vm->_nextMT = it;
@@ -5004,7 +5004,7 @@ void MotionTask::updatePositions(void) {
mt->o.directObject->drop(a->thisID(),
mt->targetLoc,
mt->moveCount);
- if (mt && mt->motionType == motionTypeDropObject)
+ if (mt->motionType == motionTypeDropObject)
moveTaskDone = true;
else
g_vm->_nextMT = it;
@@ -5028,7 +5028,7 @@ void MotionTask::updatePositions(void) {
a->thisID(),
mt->o.indirectObject->thisID(),
mt->moveCount);
- if (mt && mt->motionType == motionTypeDropObjectOnObject)
+ if (mt->motionType == motionTypeDropObjectOnObject)
moveTaskDone = true;
else
g_vm->_nextMT = it;
@@ -5040,7 +5040,7 @@ void MotionTask::updatePositions(void) {
a->thisID(),
mt->o.indirectObject->thisID(),
mt->moveCount);
- if (mt && mt->motionType == motionTypeDropObjectOnObject)
+ if (mt->motionType == motionTypeDropObjectOnObject)
moveTaskDone = true;
else
g_vm->_nextMT = it;
@@ -5066,7 +5066,7 @@ void MotionTask::updatePositions(void) {
a->thisID(),
mt->o.TAI,
mt->targetLoc);
- if (mt && mt->motionType == motionTypeDropObjectOnTAI)
+ if (mt->motionType == motionTypeDropObjectOnTAI)
moveTaskDone = true;
else
g_vm->_nextMT = it;
Commit: 3c7e2ef0330c0cdd3bea3ff4de6c1dd41211fcdb
https://github.com/scummvm/scummvm/commit/3c7e2ef0330c0cdd3bea3ff4de6c1dd41211fcdb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:46+02:00
Commit Message:
SAGA2: Plug memory leak. CID 1458006
Changed paths:
engines/saga2/sprite.cpp
engines/saga2/sprite.h
diff --git a/engines/saga2/sprite.cpp b/engines/saga2/sprite.cpp
index bf063e34de..8ca66fcd76 100644
--- a/engines/saga2/sprite.cpp
+++ b/engines/saga2/sprite.cpp
@@ -645,6 +645,13 @@ ColorSchemeList::ColorSchemeList(int count, Common::SeekableReadStream *stream)
_schemes[i] = new ColorScheme(stream);
}
+ColorSchemeList::~ColorSchemeList() {
+ for (int i = 0; i < _count; ++i)
+ delete _schemes[i];
+
+ free(_schemes);
+}
+
ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
int16 bank;
int schemeListSize;
diff --git a/engines/saga2/sprite.h b/engines/saga2/sprite.h
index 589701f55e..6594450cba 100644
--- a/engines/saga2/sprite.h
+++ b/engines/saga2/sprite.h
@@ -186,6 +186,7 @@ public:
ColorScheme **_schemes;
ColorSchemeList(int count, Common::SeekableReadStream *stream);
+ ~ColorSchemeList();
};
/* ===================================================================== *
Commit: 7c99060cd8b6ec63b2dfba0f6e307158f006b71f
https://github.com/scummvm/scummvm/commit/7c99060cd8b6ec63b2dfba0f6e307158f006b71f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-12T00:46:46+02:00
Commit Message:
SAGA2: Remove logically dead code. CID 1457951
Changed paths:
engines/saga2/tile.cpp
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index baeb34c856..10b984857f 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -4970,10 +4970,8 @@ uint16 lineDist(
dist = v - u2 * u / v2;
} else if (u2 == 0)
dist = v;
- else if (v2 == 0)
+ else // here v2 == 0
dist = u;
- else
- dist = lineFar;
return ABS(dist);
}
More information about the Scummvm-git-logs
mailing list