diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h index cd171a04c7e..21d6c434cc8 100644 --- a/engines/dreamweb/runtime.h +++ b/engines/dreamweb/runtime.h @@ -117,9 +117,15 @@ public: } }; -struct Segment { +class Segment { Common::Array data; +public: + Segment(uint size = 0) { + if (size > 0) + data.resize(size); + } + inline void assign(const uint8 *b, const uint8 *e) { data.assign(b, e); } @@ -276,8 +282,7 @@ public: _freeSegments.pop_front(); } assert(!_segments.contains(id)); - SegmentPtr seg(new Segment()); - seg->data.resize(size); + SegmentPtr seg(new Segment(size)); _segments[id] = seg; return SegmentRef(this, id, seg); }