aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lure/res_struct.cpp14
-rw-r--r--engines/lure/res_struct.h4
2 files changed, 12 insertions, 6 deletions
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index ec1a546d05..286489da82 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -827,9 +827,13 @@ void SequenceDelayList::loadFromStream(Common::ReadStream *stream) {
// The following classes hold the NPC schedules
-CharacterScheduleEntry::CharacterScheduleEntry(Action theAction, ...) {
+// The following function should really take a Action parameter, but the
+// behaviour is undefined if the last argument of a variadic function
+// undergoes default argument promotion, which might be the case for enum
+// types.
+CharacterScheduleEntry::CharacterScheduleEntry(int theAction, ...) {
_parent = NULL;
- _action = theAction;
+ _action = (Action)theAction;
va_list u_Arg;
va_start(u_Arg, theAction);
@@ -870,8 +874,10 @@ uint16 CharacterScheduleEntry::param(int index) {
return _params[index];
}
-void CharacterScheduleEntry::setDetails(Action theAction, ...) {
- _action = theAction;
+// The parameter to this function should really be an Action.
+// But... (see comment above for CharacterScheduleEntry(int, ...))
+void CharacterScheduleEntry::setDetails(int theAction, ...) {
+ _action = (Action)theAction;
_numParams = actionNumParams[_action];
va_list list;
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index 685c55ab13..a8a5e5aca8 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -404,7 +404,7 @@ private:
int _numParams;
public:
CharacterScheduleEntry() { _action = NONE; _parent = NULL; }
- CharacterScheduleEntry(Action theAction, ...);
+ CharacterScheduleEntry(int theAction, ...);
CharacterScheduleEntry(CharacterScheduleSet *parentSet,
CharacterScheduleResource *&rec);
CharacterScheduleEntry(CharacterScheduleEntry *src);
@@ -412,7 +412,7 @@ public:
Action action() { return _action; }
int numParams() { return _numParams; }
uint16 param(int index);
- void setDetails(Action theAction, ...);
+ void setDetails(int theAction, ...);
void setDetails2(Action theAction, int numParamEntries, uint16 *paramList);
CharacterScheduleEntry *next();
CharacterScheduleSet *parent() { return _parent; }