[Scummvm-git-logs] scummvm master -> f6c8326aa45ed204d8591f105ee34dcf1960e111
a-yyg
76591232+a-yyg at users.noreply.github.com
Thu Jul 1 18:34:37 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f6c8326aa4 SAGA2: Fix more global constructors warnings
Commit: f6c8326aa45ed204d8591f105ee34dcf1960e111
https://github.com/scummvm/scummvm/commit/f6c8326aa45ed204d8591f105ee34dcf1960e111
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-02T03:33:13+09:00
Commit Message:
SAGA2: Fix more global constructors warnings
Changed paths:
engines/saga2/beegee.cpp
engines/saga2/objproto.h
engines/saga2/patrol.cpp
engines/saga2/patrol.h
engines/saga2/spelcast.cpp
engines/saga2/tcoords.h
engines/saga2/tile.cpp
diff --git a/engines/saga2/beegee.cpp b/engines/saga2/beegee.cpp
index acc89f898e..ade533f1d1 100644
--- a/engines/saga2/beegee.cpp
+++ b/engines/saga2/beegee.cpp
@@ -42,13 +42,13 @@ namespace Saga2 {
struct auxAudioTheme {
bool active;
- Location l;
+ StaticLocation l;
soundSegment loopID;
};
static auxAudioTheme aats[AUXTHEMES] = {
- { false, Nowhere, 0 },
- { false, Nowhere, 0 }
+ {false, {Nowhere, 0}, 0},
+ {false, {Nowhere, 0}, 0}
};
void addAuxTheme(Location loc, soundSegment lid);
@@ -153,7 +153,7 @@ void initAudioEnvirons(void) {
void addAuxTheme(Location loc, soundSegment lid) {
for (int i = 0; i < AUXTHEMES; i++) {
if (!aats[i].active) {
- aats[i].l = loc;
+ aats[i].l.set(loc, loc.context);
aats[i].loopID = lid;
aats[i].active = true;
return;
@@ -239,7 +239,7 @@ void setAreaSound(const TilePoint &) {
if (aats[i].active) {
Location loc = getCenterActor()->notGetWorldLocation();
if (aats[i].l.context == Nothing || loc.context == aats[i].l.context) {
- TilePoint tp = (aats[i].l >> kTileUVShift) - baseCoords;
+ TilePoint tp = (aats[i].l.tile >> kTileUVShift) - baseCoords;
if (tp.magnitude() < dist.magnitude()) {
dist = tp;
loopID = USEAUXTHEME;
diff --git a/engines/saga2/objproto.h b/engines/saga2/objproto.h
index c841109590..4737531ffd 100644
--- a/engines/saga2/objproto.h
+++ b/engines/saga2/objproto.h
@@ -94,6 +94,16 @@ bool isWorld(GameObject *);
Location: Describes location of object within world or container
* ===================================================================== */
+struct StaticLocation {
+ StaticTilePoint tile;
+ ObjectID context;
+
+ void set(TilePoint t, ObjectID con) {
+ tile.set(t.u, t.v, t.z);
+ context = con;
+ }
+};
+
class Location : public TilePoint {
public:
// context = the ObjectID of containing context
@@ -134,6 +144,13 @@ public:
context = con;
}
+ Location(StaticLocation l) {
+ u = l.tile.u;
+ v = l.tile.v;
+ z = l.tile.z;
+ context = l.context;
+ }
+
};
/* ===================================================================== *
diff --git a/engines/saga2/patrol.cpp b/engines/saga2/patrol.cpp
index 3268ad7570..cefe2f7007 100644
--- a/engines/saga2/patrol.cpp
+++ b/engines/saga2/patrol.cpp
@@ -173,7 +173,7 @@ void PatrolRouteIterator::altDecrement(void) {
//-----------------------------------------------------------------------
// Return the coordinates of the current waypoint
-const TilePoint &PatrolRouteIterator::operator*(void) const {
+const TilePoint PatrolRouteIterator::operator*(void) const {
const PatrolRoute &route = patrolRouteList[_mapNum]->getRoute(_routeNo);
return _vertexNo >= 0 && _vertexNo < route.vertices() ? route[_vertexNo] : Nowhere;
diff --git a/engines/saga2/patrol.h b/engines/saga2/patrol.h
index cea107eca2..7bfedf4097 100644
--- a/engines/saga2/patrol.h
+++ b/engines/saga2/patrol.h
@@ -142,7 +142,7 @@ public:
}
// Return the coordinates of the current waypoint
- const TilePoint &operator*(void) const;
+ const TilePoint operator*(void) const;
// Iterate
const PatrolRouteIterator &operator++(void);
diff --git a/engines/saga2/spelcast.cpp b/engines/saga2/spelcast.cpp
index 99ff1c11ec..85065838a5 100644
--- a/engines/saga2/spelcast.cpp
+++ b/engines/saga2/spelcast.cpp
@@ -45,7 +45,7 @@ extern PlatformHandle platformList; // platform resource hunk
* ===================================================================== */
static int16 prevMapNum;
-static TilePoint prevCoords = Nowhere;
+static StaticTilePoint prevCoords = Nowhere;
static MetaTilePtr prevMeta;
/* ===================================================================== *
@@ -923,7 +923,7 @@ int16 tileNopeHeight(
// Look up the metatile on the map.
metaPtr = prevMeta = mapList[mapNum].lookupMeta(metaCoords);
prevMapNum = mapNum;
- prevCoords = metaCoords;
+ prevCoords.set(metaCoords.u, metaCoords.v, metaCoords.z);
}
if (metaPtr == NULL) return 0L;
diff --git a/engines/saga2/tcoords.h b/engines/saga2/tcoords.h
index d27cd7fc8f..d33892bc99 100644
--- a/engines/saga2/tcoords.h
+++ b/engines/saga2/tcoords.h
@@ -106,6 +106,14 @@ struct StaticTilePoint {
return p;
}
+ friend int operator==(StaticTilePoint a, StaticTilePoint b) {
+ return a.u == b.u && a.v == b.v && a.z == b.z;
+ }
+
+ friend int operator!=(StaticTilePoint a, StaticTilePoint b) {
+ return a.u != b.u || a.v != b.v || a.z != b.z;
+ }
+
void operator+=(StaticTilePoint a) {
u += a.u;
v += a.v;
@@ -191,7 +199,7 @@ struct TilePoint {
* ============================================================================ */
// A TilePoint defining a NULL location
-const extern TilePoint Nowhere;
+const extern StaticTilePoint Nowhere;
/* ============================================================================ *
TileRegion: Specifies a rectangular region of tiles using min/max
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 496890c6dc..7c234da5a0 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -79,7 +79,7 @@ const int slowScrollSpeed = 6,
fastThreshhold = 16,
snapThreshhold = 400;
-const TilePoint Nowhere((int16)minint16, (int16)minint16, (int16)minint16);
+const StaticTilePoint Nowhere = {(int16)minint16, (int16)minint16, (int16)minint16};
const MetaTileID NoMetaTile(nullID, nullID);
const ActiveItemID NoActiveItem(0, activeItemIndexNullID);
More information about the Scummvm-git-logs
mailing list