[Scummvm-git-logs] scummvm master -> 304d82a9ba9eb91a1e128defbb62108546b86edb

dreammaster dreammaster at scummvm.org
Sat Jul 24 18:46:15 UTC 2021


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:
304d82a9ba AGS: Fix writing uninitialized data to savegames


Commit: 304d82a9ba9eb91a1e128defbb62108546b86edb
    https://github.com/scummvm/scummvm/commit/304d82a9ba9eb91a1e128defbb62108546b86edb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-24T11:45:26-07:00

Commit Message:
AGS: Fix writing uninitialized data to savegames

Changed paths:
    engines/ags/globals.cpp
    engines/ags/lib/allegro/color.h


diff --git a/engines/ags/globals.cpp b/engines/ags/globals.cpp
index a8fac3c3b4..7c8e62725b 100644
--- a/engines/ags/globals.cpp
+++ b/engines/ags/globals.cpp
@@ -173,8 +173,10 @@ Globals::Globals() {
 	_dynamicallyCreatedSurfaces = new AGS::Shared::Bitmap *[MAX_DYNAMIC_SURFACES];
 	Common::fill(_dynamicallyCreatedSurfaces, _dynamicallyCreatedSurfaces +
 	             MAX_DYNAMIC_SURFACES, (AGS::Shared::Bitmap *)nullptr);
-	_palette = new color[256];
 	_maincoltable = new COLOR_MAP();
+	_palette = new color[256];
+	for (int i = 0; i < PALETTE_COUNT; ++i)
+		_palette[i].clear();
 
 	// draw_software.cpp globals
 	_BlackRects = new DirtyRects();
diff --git a/engines/ags/lib/allegro/color.h b/engines/ags/lib/allegro/color.h
index aca8250b12..0080ce9bc7 100644
--- a/engines/ags/lib/allegro/color.h
+++ b/engines/ags/lib/allegro/color.h
@@ -53,6 +53,9 @@ struct color {
 
 	void readFromFile(AGS::Shared::Stream *file);
 	void writeToFile(AGS::Shared::Stream *file) const;
+	void clear() {
+		r = g = b = filler = 0;
+	}
 } PACKED_STRUCT;
 
 typedef color RGB;




More information about the Scummvm-git-logs mailing list