mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-19 16:18:45 +00:00
FULLPIPE: Proper use of copying consturctor for ExCommand
This commit is contained in:
parent
0745e61e70
commit
8515164117
@ -43,8 +43,8 @@ ExCommand::ExCommand(ExCommand *src) : Message(src) {
|
||||
_parId = src->_parId;
|
||||
}
|
||||
|
||||
ExCommand *ExCommand::createClone(ExCommand *src) {
|
||||
return new ExCommand(src);
|
||||
ExCommand *ExCommand::createClone() {
|
||||
return new ExCommand(this);
|
||||
}
|
||||
|
||||
ExCommand::ExCommand(int16 parentId, int messageKind, int messageNum, int x, int y, int a7, int a8, int sceneClickX, int sceneClickY, int a11) :
|
||||
@ -176,13 +176,8 @@ ExCommand2::~ExCommand2() {
|
||||
free(_points);
|
||||
}
|
||||
|
||||
ExCommand *ExCommand2::createClone(ExCommand *src) {
|
||||
if (_objtype == kObjTypeExCommand)
|
||||
return new ExCommand(src);
|
||||
else if (_objtype == kObjTypeExCommand2)
|
||||
return new ExCommand2((ExCommand2 *)src);
|
||||
|
||||
error("ExCommand2::createClone(): Wrong object type: %d", _objtype);
|
||||
ExCommand2 *ExCommand2::createClone() {
|
||||
return new ExCommand2(this);
|
||||
}
|
||||
|
||||
Message::Message() {
|
||||
@ -284,7 +279,7 @@ MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) {
|
||||
_field_38 = (field_38 == 0);
|
||||
|
||||
for (Common::List<ExCommand *>::iterator it = src->_exCommands.begin(); it != src->_exCommands.end(); ++it) {
|
||||
ExCommand *ex = new ExCommand(*it);
|
||||
ExCommand *ex = (*it)->createClone();
|
||||
ex->_excFlags |= 2;
|
||||
|
||||
_exCommands.push_back(ex);
|
||||
|
@ -69,7 +69,7 @@ class ExCommand : public Message {
|
||||
|
||||
virtual bool load(MfcArchive &file);
|
||||
|
||||
virtual ExCommand *createClone(ExCommand *src);
|
||||
virtual ExCommand *createClone();
|
||||
|
||||
bool handleMessage();
|
||||
void sendMessage();
|
||||
@ -89,7 +89,7 @@ class ExCommand2 : public ExCommand {
|
||||
ExCommand2(ExCommand2 *src);
|
||||
virtual ~ExCommand2();
|
||||
|
||||
virtual ExCommand *createClone(ExCommand *src);
|
||||
virtual ExCommand2 *createClone();
|
||||
};
|
||||
|
||||
class ObjstateCommand : public CObject {
|
||||
|
@ -210,7 +210,7 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos,
|
||||
|
||||
if (mq) {
|
||||
for (uint i = 0; i < closestP->_messageQueueObj->getCount(); i++) {
|
||||
ex = new ExCommand(closestP->_messageQueueObj->getExCommandByIndex(i));
|
||||
ex = closestP->_messageQueueObj->getExCommandByIndex(i)->createClone()
|
||||
ex->_excFlags |= 2;
|
||||
mq->addExCommandToEnd(ex);
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void sceneHandler04_walkClimbLadder(ExCommand *ex) {
|
||||
ExCommand *ex3;
|
||||
|
||||
if (ex) {
|
||||
ex3 = new ExCommand(ex);
|
||||
ex3 = ex->createClone();
|
||||
} else {
|
||||
ex3 = new ExCommand(0, 17, MSG_SC4_CLICKLADDER, 0, 0, 0, 1, 0, 0, 0);
|
||||
ex3->_excFlags |= 3;
|
||||
@ -498,7 +498,7 @@ void sceneHandler04_gotoLadder(ExCommand *ex) {
|
||||
mq->addExCommandToEnd(ex3);
|
||||
|
||||
if (ex) {
|
||||
ExCommand *ex4 = new ExCommand(ex);
|
||||
ExCommand *ex4 = ex->createClone();
|
||||
|
||||
mq->addExCommandToEnd(ex4);
|
||||
}
|
||||
@ -630,7 +630,7 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
|
||||
MessageQueue *mq2 = mgm.genMovement(&mgminfo);
|
||||
|
||||
if (mq1 && mq2) {
|
||||
mq1->addExCommandToEnd(new ExCommand(mq2->getExCommandByIndex(0)));
|
||||
mq1->addExCommandToEnd(mq2->getExCommandByIndex(0)->createClone());
|
||||
|
||||
delete mq2;
|
||||
|
||||
@ -890,7 +890,7 @@ void sceneHandler04_animOutOfBottle(ExCommand *ex) {
|
||||
MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC4_MANFROMBOTTLE), 0, 0);
|
||||
|
||||
if (ex) {
|
||||
ExCommand *newex = new ExCommand(ex);
|
||||
ExCommand *newex = ex->createClone();
|
||||
|
||||
mq->addExCommandToEnd(newex);
|
||||
}
|
||||
@ -1066,7 +1066,7 @@ void sceneHandler04_leaveLadder(ExCommand *ex) {
|
||||
MessageQueue *mq = g_vars->scene04_ladder->controllerWalkTo(g_fp->_aniMan, 0);
|
||||
|
||||
if (mq) {
|
||||
mq->addExCommandToEnd(new ExCommand(ex));
|
||||
mq->addExCommandToEnd(ex->createClone());
|
||||
|
||||
if (mq->chain(g_fp->_aniMan) )
|
||||
ex->_messageKind = 0;
|
||||
@ -1099,7 +1099,7 @@ void sceneHandler04_leaveLadder(ExCommand *ex) {
|
||||
ex1->_excFlags |= 2;
|
||||
mq->addExCommandToEnd(ex1);
|
||||
|
||||
ex1 = new ExCommand(ex);
|
||||
ex1 = ex->createClone();
|
||||
mq->addExCommandToEnd(ex1);
|
||||
|
||||
mq->setFlags(mq->getFlags() | 1);
|
||||
|
@ -282,7 +282,7 @@ void sceneHandler08_finishArcade() {
|
||||
void sceneHandler08_jumpOff(ExCommand *cmd) {
|
||||
MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
|
||||
|
||||
mq->addExCommandToEnd(new ExCommand(cmd));
|
||||
mq->addExCommandToEnd(cmd->createClone());
|
||||
mq->setFlags(mq->getFlags() | 1);
|
||||
|
||||
g_fp->_globalMessageQueueList->addMessageQueue(mq);
|
||||
|
@ -153,7 +153,7 @@ void sceneHandler22_fromStool(ExCommand *cmd) {
|
||||
if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
|
||||
MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC22_FROMSTOOL), 0, 0);
|
||||
|
||||
mq->addExCommandToEnd(new ExCommand(cmd));
|
||||
mq->addExCommandToEnd(cmd->createClone());
|
||||
mq->setFlags(mq->getFlags() | 1);
|
||||
mq->chain(0);
|
||||
}
|
||||
@ -196,7 +196,7 @@ void sceneHandler22_stoolLogic(ExCommand *cmd) {
|
||||
if (!mq)
|
||||
return;
|
||||
|
||||
mq->addExCommandToEnd(new ExCommand(cmd));
|
||||
mq->addExCommandToEnd(cmd->createClone));
|
||||
|
||||
postExCommand(g_fp->_aniMan->_id, 2, 841, 449, 0, -1);
|
||||
return;
|
||||
@ -282,7 +282,7 @@ void sceneHandler22_stoolLogic(ExCommand *cmd) {
|
||||
mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1010, 443, 1, ST_MAN_UP);
|
||||
|
||||
if (mq) {
|
||||
mq->addExCommandToEnd(new ExCommand(cmd));
|
||||
mq->addExCommandToEnd(cmd->createClone());
|
||||
|
||||
postExCommand(g_fp->_aniMan->_id, 2, 1010, 443, 0, -1);
|
||||
return;
|
||||
|
@ -708,7 +708,7 @@ void StaticANIObject::update(int counterdiff) {
|
||||
|
||||
ex = dyn->getExCommand();
|
||||
if (ex && ex->_messageKind != 35) {
|
||||
newex = new ExCommand(ex);
|
||||
newex = ex->createClone();
|
||||
newex->_excFlags |= 2;
|
||||
if (newex->_messageKind == 17) {
|
||||
newex->_parentId = _id;
|
||||
@ -741,7 +741,7 @@ void StaticANIObject::update(int counterdiff) {
|
||||
ex = dyn->getExCommand();
|
||||
if (ex) {
|
||||
if (ex->_messageKind == 35) {
|
||||
newex = new ExCommand(ex);
|
||||
newex = ex->createClone();
|
||||
newex->_excFlags |= 2;
|
||||
newex->sendMessage();
|
||||
}
|
||||
@ -1048,7 +1048,7 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase
|
||||
ExCommand *ex = _movement->_currDynamicPhase->getExCommand();
|
||||
if (ex) {
|
||||
if (ex->_messageKind == 35) {
|
||||
ExCommand *newex = new ExCommand(ex);
|
||||
ExCommand *newex = ex->createClone();
|
||||
newex->_excFlags |= 2;
|
||||
newex->sendMessage();
|
||||
}
|
||||
@ -1858,7 +1858,7 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) {
|
||||
_field_7C = src->_field_7C;
|
||||
|
||||
if (src->getExCommand())
|
||||
_exCommand = new ExCommand(src->getExCommand());
|
||||
_exCommand = src->getExCommand()->createClone();
|
||||
else
|
||||
_exCommand = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user