[Scummvm-git-logs] scummvm master -> f93e757aff2067144696dcc51cbadb768c7522ce

dreammaster noreply at scummvm.org
Sun May 29 22:44:58 UTC 2022


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:
f93e757aff AGS: Fix global constructor/destructor warnings


Commit: f93e757aff2067144696dcc51cbadb768c7522ce
    https://github.com/scummvm/scummvm/commit/f93e757aff2067144696dcc51cbadb768c7522ce
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-05-29T15:44:45-07:00

Commit Message:
AGS: Fix global constructor/destructor warnings

Changed paths:
    engines/ags/globals.h
    engines/ags/shared/core/asset_manager.cpp
    engines/ags/shared/font/fonts.cpp
    engines/ags/shared/font/wfn_font.cpp
    engines/ags/shared/font/wfn_font.h
    engines/ags/shared/util/wgt2_allg.cpp


diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index bf6e7642e15..2ee36e60fa9 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -31,6 +31,7 @@
 #include "ags/shared/util/string.h"
 #include "ags/shared/util/string_types.h"
 #include "ags/shared/util/version.h"
+#include "ags/shared/font/wfn_font.h"
 #include "ags/shared/gui/gui_main.h"
 #include "ags/shared/script/cc_script.h"
 #include "ags/engine/ac/event.h"
@@ -710,6 +711,8 @@ public:
 	TTFFontRenderer *_ttfRenderer;
 	WFNFontRenderer *_wfnRenderer;
 	SplitLines *_Lines;
+	const WFNChar _emptyChar; // a dummy character to substitute bad symbols
+	Shared::Bitmap _wputblock_wrapper; // [IKM] argh! :[
 
 	/**@}*/
 
diff --git a/engines/ags/shared/core/asset_manager.cpp b/engines/ags/shared/core/asset_manager.cpp
index ed88ad47f65..9896a350a92 100644
--- a/engines/ags/shared/core/asset_manager.cpp
+++ b/engines/ags/shared/core/asset_manager.cpp
@@ -36,9 +36,6 @@ namespace Shared {
 inline static bool IsAssetLibDir(const AssetLibInfo *lib) {
 	return lib->BaseFileName.IsEmpty();
 }
-//inline static bool IsAssetLibFile(const AssetLibInfo *lib) {
-//	return !lib->BaseFileName.IsEmpty();
-//}
 
 bool AssetManager::AssetLibEx::TestFilter(const String &filter) const {
 	return filter == "*" ||
diff --git a/engines/ags/shared/font/fonts.cpp b/engines/ags/shared/font/fonts.cpp
index de90e545718..cd8e9b3fef6 100644
--- a/engines/ags/shared/font/fonts.cpp
+++ b/engines/ags/shared/font/fonts.cpp
@@ -248,12 +248,6 @@ int get_text_lines_surf_height(size_t fontNumber, size_t numlines) {
 			2 * _GP(fonts)[fontNumber].Info.AutoOutlineThickness);
 }
 
-namespace AGS {
-namespace Shared {
-SplitLines Lines;
-} // namespace Shared
-} // namespace AGS
-
 // Replaces AGS-specific linebreak tags with common '\n'
 void unescape_script_string(const char *cstr, std::vector<char> &out) {
 	out.clear();
diff --git a/engines/ags/shared/font/wfn_font.cpp b/engines/ags/shared/font/wfn_font.cpp
index 0435a92a934..5af1f849aad 100644
--- a/engines/ags/shared/font/wfn_font.cpp
+++ b/engines/ags/shared/font/wfn_font.cpp
@@ -24,6 +24,7 @@
 #include "ags/shared/debugging/out.h"
 #include "ags/shared/util/memory.h"
 #include "ags/shared/util/stream.h"
+#include "ags/globals.h"
 
 namespace AGS3 {
 
@@ -44,7 +45,9 @@ void WFNChar::RestrictToBytes(size_t bytes) {
 		Height = static_cast<uint16_t>(bytes / GetRowByteCount());
 }
 
-const WFNChar WFNFont::_emptyChar;
+const WFNChar &WFNFont::GetChar(uint8_t code) const {
+	return code < _refs.size() ? *_refs[code] : _G(emptyChar);
+}
 
 void WFNFont::Clear() {
 	_refs.clear();
@@ -169,7 +172,7 @@ WFNError WFNFont::ReadFromFile(Stream *in, const soff_t data_size) {
 		const uint16_t off = offset_table[i];
 		// if bad character offset - reference empty character
 		if (off < raw_data_offset || (soff_t)(off + MinCharDataSize) > table_addr) {
-			_refs[i] = &_emptyChar;
+			_refs[i] = &_G(emptyChar);
 		} else {
 			// in usual case the offset table references items in strict order
 			if (i < _items.size() && offs[i] == off)
diff --git a/engines/ags/shared/font/wfn_font.h b/engines/ags/shared/font/wfn_font.h
index c08cc667cea..0113ed6d21e 100644
--- a/engines/ags/shared/font/wfn_font.h
+++ b/engines/ags/shared/font/wfn_font.h
@@ -90,9 +90,7 @@ public:
 	}
 
 	// Get WFN character for the given code; if the character is missing, returns empty character
-	inline const WFNChar &GetChar(uint8_t code) const {
-		return code < _refs.size() ? *_refs[code] : _emptyChar;
-	}
+	const WFNChar &GetChar(uint8_t code) const;
 
 	void Clear();
 	// Reads WFNFont object, using data_size bytes from stream; if data_size = 0,
@@ -103,8 +101,6 @@ protected:
 	std::vector<const WFNChar *> _refs;      // reference array, contains pointers to elements of _items
 	std::vector<WFNChar>        _items;     // actual character items
 	std::vector<uint8_t>        _pixelData; // pixel data array
-
-	static const WFNChar        _emptyChar; // a dummy character to substitute bad symbols
 };
 
 } // namespace AGS3
diff --git a/engines/ags/shared/util/wgt2_allg.cpp b/engines/ags/shared/util/wgt2_allg.cpp
index 48155e49418..bc39b67bd43 100644
--- a/engines/ags/shared/util/wgt2_allg.cpp
+++ b/engines/ags/shared/util/wgt2_allg.cpp
@@ -21,6 +21,7 @@
 
 #include "ags/shared/util/wgt2_allg.h"
 #include "ags/shared/gfx/bitmap.h"
+#include "ags/globals.h"
 
 namespace AGS3 {
 
@@ -79,13 +80,12 @@ void wputblock(Bitmap *ds, int xx, int yy, Bitmap *bll, int xray) {
 		ds->Blit(bll, 0, 0, xx, yy, bll->GetWidth(), bll->GetHeight());
 }
 
-Bitmap wputblock_wrapper; // [IKM] argh! :[
 void wputblock_raw(Bitmap *ds, int xx, int yy, BITMAP *bll, int xray) {
-	wputblock_wrapper.WrapAllegroBitmap(bll, true);
+	_G(wputblock_wrapper).WrapAllegroBitmap(bll, true);
 	if (xray)
-		ds->Blit(&wputblock_wrapper, xx, yy, kBitmap_Transparency);
+		ds->Blit(&_G(wputblock_wrapper), xx, yy, kBitmap_Transparency);
 	else
-		ds->Blit(&wputblock_wrapper, 0, 0, xx, yy, wputblock_wrapper.GetWidth(), wputblock_wrapper.GetHeight());
+		ds->Blit(&_G(wputblock_wrapper), 0, 0, xx, yy, _G(wputblock_wrapper).GetWidth(), _G(wputblock_wrapper).GetHeight());
 }
 
 const int col_lookups[32] = {




More information about the Scummvm-git-logs mailing list