aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-10 07:54:28 -0500
committerPaul Gilbert2018-03-10 07:54:28 -0500
commit5b731a1f44b44563937e2afc5604b4e98e37860d (patch)
tree198c54b255807db8be32e800fe3ba1bcac283177
parent3bec5a7f9dcb0035f221cd001ff0b27a1a11c0a4 (diff)
downloadscummvm-rg350-5b731a1f44b44563937e2afc5604b4e98e37860d.tar.gz
scummvm-rg350-5b731a1f44b44563937e2afc5604b4e98e37860d.tar.bz2
scummvm-rg350-5b731a1f44b44563937e2afc5604b4e98e37860d.zip
XEEN: Fix use of globally constructed object
-rw-r--r--engines/xeen/font.cpp7
-rw-r--r--engines/xeen/font.h4
-rw-r--r--engines/xeen/window.cpp2
3 files changed, 9 insertions, 4 deletions
diff --git a/engines/xeen/font.cpp b/engines/xeen/font.cpp
index 3a70c4c8be..ccdcbf4627 100644
--- a/engines/xeen/font.cpp
+++ b/engines/xeen/font.cpp
@@ -27,18 +27,19 @@
namespace Xeen {
const byte *FontData::_fontData;
-Common::Point FontData::_writePos;
+Common::Point *FontData::_fontWritePos;
byte FontData::_textColors[4];
byte FontData::_bgColor;
bool FontData::_fontReduced;
Justify FontData::_fontJustify;
-FontSurface::FontSurface() : XSurface(), _msgWraps(false), _displayString(nullptr) {
+FontSurface::FontSurface() : XSurface(), _msgWraps(false), _displayString(nullptr),
+ _writePos(*FontData::_fontWritePos) {
setTextColor(0);
}
FontSurface::FontSurface(int wv, int hv) : XSurface(wv, hv),
- _msgWraps(false), _displayString(nullptr) {
+ _msgWraps(false), _displayString(nullptr), _writePos(*FontData::_fontWritePos) {
create(w, h);
setTextColor(0);
}
diff --git a/engines/xeen/font.h b/engines/xeen/font.h
index ca2cf87ad4..90bd24b67e 100644
--- a/engines/xeen/font.h
+++ b/engines/xeen/font.h
@@ -35,7 +35,7 @@ enum Justify { JUSTIFY_NONE = 0, JUSTIFY_CENTER = 1, JUSTIFY_RIGHT = 2 };
struct FontData {
static const byte *_fontData;
- static Common::Point _writePos;
+ static Common::Point *_fontWritePos;
static byte _textColors[4];
static byte _bgColor;
static bool _fontReduced;
@@ -77,6 +77,8 @@ private:
*/
void writeChar(char c, const Common::Rect &clipRect);
public:
+ Common::Point &_writePos;
+public:
FontSurface();
FontSurface(int wv, int hv);
virtual ~FontSurface() {}
diff --git a/engines/xeen/window.cpp b/engines/xeen/window.cpp
index 99ceb9a0be..47732dc841 100644
--- a/engines/xeen/window.cpp
+++ b/engines/xeen/window.cpp
@@ -31,6 +31,7 @@ Windows::Windows() {
byte *data = new byte[f.size()];
f.read(data, f.size());
_fontData = data;
+ _fontWritePos = new Common::Point();
Common::fill(&_textColors[0], &_textColors[4], 0);
_bgColor = DEFAULT_BG_COLOR;
@@ -87,6 +88,7 @@ Windows::Windows() {
Windows::~Windows() {
delete[] _fontData;
+ delete _fontWritePos;
}
void Windows::closeAll() {