aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
authorThierry Crozat2017-11-10 22:20:54 +0000
committerGitHub2017-11-10 22:20:54 +0000
commit2b00829f09609447758dc55956dd6a345b878c4b (patch)
tree06de1770adfa05ba89df7398dc48eb9fef1da133 /engines/tsage
parentb73892e441bc3fde3b36f76aa675c59a652ca95c (diff)
parentb1ba071ea8a128f94f70f9a28270644e5d70b6fb (diff)
downloadscummvm-rg350-2b00829f09609447758dc55956dd6a345b878c4b.tar.gz
scummvm-rg350-2b00829f09609447758dc55956dd6a345b878c4b.tar.bz2
scummvm-rg350-2b00829f09609447758dc55956dd6a345b878c4b.zip
Merge pull request #1041 from criezy/variadic-undefined
Fix undefined behaviour in variadic functions
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/core.cpp7
-rw-r--r--engines/tsage/core.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 985d16b031..a3ed3abb5b 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2358,8 +2358,11 @@ int SceneObject::checkRegion(const Common::Point &pt) {
return regionIndex;
}
-void SceneObject::animate(AnimateMode animMode, ...) {
- _animateMode = animMode;
+// The parameter to the function below should really be an AnimateMode value.
+// However passing an enum type as last argument of a variadic function may
+// result in undefined behaviour.
+void SceneObject::animate(int animMode, ...) {
+ _animateMode = (AnimateMode)animMode;
_updateStartFrame = g_globals->_events.getFrameNumber();
if (_numFrames)
_updateStartFrame += 60 / _numFrames;
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 8b1deadaeb..1cee491b4c 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -577,7 +577,7 @@ public:
void getHorizBounds();
int getRegionIndex();
int checkRegion(const Common::Point &pt);
- void animate(AnimateMode animMode, ...);
+ void animate(int animMode, ...);
void checkAngle(const SceneObject *obj);
void checkAngle(const Common::Point &pt);
void hide();