From 91c9ecf7e1e335230cff6bebfa9f2a24e9f688cf Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 2 Dec 2011 21:08:57 +0100 Subject: DREAMWEB: Simplify SegmentRef class --- engines/dreamweb/runtime.h | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h index 21d6c434cc..3fab4ecc60 100644 --- a/engines/dreamweb/runtime.h +++ b/engines/dreamweb/runtime.h @@ -158,19 +158,7 @@ public: SegmentRef(Context *ctx, uint16 value = 0, SegmentPtr segment = SegmentPtr()): _context(ctx), _value(value), _segment(segment) { } - inline void reset(uint16 value); - - inline SegmentRef& operator=(const uint16 id) { - reset(id); - return *this; - } - - inline SegmentRef& operator=(const SegmentRef &ref) { - _context = ref._context; - _value = ref._value; - _segment = ref._segment; - return *this; - } + inline SegmentRef& operator=(const uint16 id); inline uint8 &byte(unsigned index) { assert(_segment != 0); @@ -259,10 +247,10 @@ public: inline Context(): engine(0), al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx), cs(this), ds(this), es(this), data(this) { _segments[kDefaultDataSegment] = SegmentPtr(new Segment()); - cs.reset(kDefaultDataSegment); - ds.reset(kDefaultDataSegment); - es.reset(kDefaultDataSegment); - data.reset(kDefaultDataSegment); + cs = kDefaultDataSegment; + ds = kDefaultDataSegment; + es = kDefaultDataSegment; + data = kDefaultDataSegment; } SegmentRef getSegment(uint16 value) { @@ -565,8 +553,9 @@ public: } }; -inline void SegmentRef::reset(uint16 value) { - *this = _context->getSegment(value); +inline SegmentRef& SegmentRef::operator=(const uint16 id) { + *this = _context->getSegment(id); + return *this; } class StackChecker { -- cgit v1.2.3