From 0745e61e70ae37a9c10448ad2c96d9e632c8ee58 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 4 Jan 2014 15:15:05 +0200 Subject: [PATCH] FULLPIPE: Implement ExCommand2 methods --- engines/fullpipe/messages.cpp | 24 ++++++++++++++++++++---- engines/fullpipe/messages.h | 2 +- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 7db168d92d4..dcca9252267 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -145,18 +145,34 @@ void ExCommand::firef34() { } } -ExCommand2::ExCommand2(int messageKind, int parentId, const Common::Point *points, int pointsSize) : ExCommand(parentId, messageKind, 0, 0, 0, 0, 1, 0, 0, 0) { - _points = 0; +ExCommand2::ExCommand2(int messageKind, int parentId, const Common::Point **points, int pointsSize) : ExCommand(parentId, messageKind, 0, 0, 0, 0, 1, 0, 0, 0) { _objtype = kObjTypeExCommand2; - warning("STUB: ExCommand2::ExCommand2()"); + _pointsSize = pointsSize; + _points = (Common::Point **)malloc(sizeof(Common::Point *) * pointsSize); + + for (int i = 0; i < pointsSize; i++) { + _points[i] = new Common::Point; + + *_points[i] = *points[i]; + } } ExCommand2::ExCommand2(ExCommand2 *src) : ExCommand(src) { - warning("STUB: ExCommand2::ExCommand2()"); + _pointsSize = src->_pointsSize; + _points = (Common::Point **)malloc(sizeof(Common::Point *) * _pointsSize); + + for (int i = 0; i < _pointsSize; i++) { + _points[i] = new Common::Point; + + *_points[i] = *src->_points[i]; + } } ExCommand2::~ExCommand2() { + for (int i = 0; i < _pointsSize; i++) + delete _points[i]; + free(_points); } diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index d03cb77334e..653bd9625e6 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -85,7 +85,7 @@ class ExCommand2 : public ExCommand { Common::Point **_points; int _pointsSize; - ExCommand2(int messageKind, int parentId, const Common::Point *points, int pointsSize); + ExCommand2(int messageKind, int parentId, const Common::Point **points, int pointsSize); ExCommand2(ExCommand2 *src); virtual ~ExCommand2();