[Scummvm-git-logs] scummvm master -> 5b731a1f44b44563937e2afc5604b4e98e37860d

dreammaster dreammaster at scummvm.org
Sat Mar 10 13:54:52 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5b731a1f44 XEEN: Fix use of globally constructed object


Commit: 5b731a1f44b44563937e2afc5604b4e98e37860d
    https://github.com/scummvm/scummvm/commit/5b731a1f44b44563937e2afc5604b4e98e37860d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-10T07:54:28-05:00

Commit Message:
XEEN: Fix use of globally constructed object

Changed paths:
    engines/xeen/font.cpp
    engines/xeen/font.h
    engines/xeen/window.cpp


diff --git a/engines/xeen/font.cpp b/engines/xeen/font.cpp
index 3a70c4c..ccdcbf4 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 ca2cf87..90bd24b 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 99ceb9a..47732dc 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() {





More information about the Scummvm-git-logs mailing list