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

kelmer44 noreply at scummvm.org
Tue May 26 12:45:23 UTC 2026


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

Summary:
cc956499b2 PELROCK: Fix initialization of class members in cd, computer and background book. PVS-Studio V1077, V519


Commit: cc956499b2a9c9579a0be46849b0392468ff8842
    https://github.com/scummvm/scummvm/commit/cc956499b2a9c9579a0be46849b0392468ff8842
Author: kelmer (kelmer at gmail.com)
Date: 2026-05-26T14:45:15+02:00

Commit Message:
PELROCK: Fix initialization of class members in cd, computer and background book. PVS-Studio V1077, V519

Changed paths:
    engines/pelrock/backgroundbook.cpp
    engines/pelrock/cdplayer.cpp
    engines/pelrock/cdplayer.h
    engines/pelrock/computer.h


diff --git a/engines/pelrock/backgroundbook.cpp b/engines/pelrock/backgroundbook.cpp
index b66776d5f2d..bcf50b15a8c 100644
--- a/engines/pelrock/backgroundbook.cpp
+++ b/engines/pelrock/backgroundbook.cpp
@@ -33,7 +33,7 @@ static const uint32 kRoomNamesOffset = 299797;      // JUEGO.EXE — room name s
 static const uint32 kRoomNamesSize = 1297;
 
 BackgroundBook::BackgroundBook(PelrockEventManager *eventMan, ResourceManager *res, RoomManager *room)
-	: _events(eventMan), _res(res), _room(room) {
+	: _events(eventMan), _res(res), _room(room), _buttons{{nullptr}} {
 	init();
 }
 
@@ -91,7 +91,6 @@ void BackgroundBook::checkMouse(int x, int y) {
 			int itemIndex = (y - 72) / g_engine->_smallFont->getFontHeight();
 			int roomIndex = firstItem + itemIndex;
 			if (roomIndex < (int)_roomNames.size()) {
-				_events->_leftMouseClicked = false;
 				int finalRoomIndex = roomIndex < 10 ? roomIndex : roomIndex + 2;
 				showRoom(finalRoomIndex);
 			}
diff --git a/engines/pelrock/cdplayer.cpp b/engines/pelrock/cdplayer.cpp
index 25e98198aa7..c51c3fe1b9c 100644
--- a/engines/pelrock/cdplayer.cpp
+++ b/engines/pelrock/cdplayer.cpp
@@ -32,7 +32,7 @@ static const uint32 kCDPlayerTrackNamesOffset = 301203;  // JUEGO.EXE — track
 static const uint32 kCDPlayerControlsOffset   = 2214760; // ALFRED.7 — controls sprite
 
 CDPlayer::CDPlayer(PelrockEventManager *eventMan, ResourceManager *res, SoundManager *sound)
-	: _events(eventMan), _res(res), _sound(sound) {
+	: _events(eventMan), _res(res), _sound(sound), _buttons{{nullptr}}, _selectedTrack(2), _selectedButton(NO_CDBUTTON) {
 	init();
 }
 
@@ -98,9 +98,9 @@ void CDPlayer::drawScreen() {
 void CDPlayer::drawButtons() {
 	for (int i = 0; i < 5; i++) {
 		if (_selectedButton == i) {
-			drawSpriteToBuffer(_compositeScreen, buttons[i][1], _buttonRects[i].left, _buttonRects[i].top, _buttonRects[i].width(), _buttonRects[i].height(), 207);
+			drawSpriteToBuffer(_compositeScreen, _buttons[i][1], _buttonRects[i].left, _buttonRects[i].top, _buttonRects[i].width(), _buttonRects[i].height(), 207);
 		} else {
-			drawSpriteToBuffer(_compositeScreen, buttons[i][0], _buttonRects[i].left, _buttonRects[i].top, _buttonRects[i].width(), _buttonRects[i].height(), 207);
+			drawSpriteToBuffer(_compositeScreen, _buttons[i][0], _buttonRects[i].left, _buttonRects[i].top, _buttonRects[i].width(), _buttonRects[i].height(), 207);
 		}
 	}
 }
@@ -122,8 +122,8 @@ void CDPlayer::cleanup() {
 	}
 
 	for (int i = 0; i < 5; i++) {
-		delete[] buttons[i][0];
-		delete[] buttons[i][1];
+		delete[] _buttons[i][0];
+		delete[] _buttons[i][1];
 	}
 
 	g_engine->_screen->markAllDirty();
@@ -203,8 +203,8 @@ void CDPlayer::loadControls() {
 		for (int j = 0; j < 2; j++) {
 			int w = _buttonRects[i].width();
 			int h = _buttonRects[i].height();
-			buttons[i][j] = new byte[w * h];
-			Common::copy(rawData + pos, rawData + pos + w * h, buttons[i][j]);
+			_buttons[i][j] = new byte[w * h];
+			Common::copy(rawData + pos, rawData + pos + w * h, _buttons[i][j]);
 			pos += w * h;
 		}
 	}
diff --git a/engines/pelrock/cdplayer.h b/engines/pelrock/cdplayer.h
index 23e781f8689..afc519f36f3 100644
--- a/engines/pelrock/cdplayer.h
+++ b/engines/pelrock/cdplayer.h
@@ -65,7 +65,7 @@ private:
 	byte *_palette;
 	byte *_controls;
 	Common::String trackNames[31];
-	byte *buttons[5][2];
+	byte *_buttons[5][2];
 	Common::Rect _buttonRects[5] = {
 		Common::Rect(Common::Point(17, 46), 37, 26),  // Stop
 		Common::Rect(Common::Point(57, 48), 33, 23),  // Pause
diff --git a/engines/pelrock/computer.h b/engines/pelrock/computer.h
index f2905a1426f..3c5603bcd02 100644
--- a/engines/pelrock/computer.h
+++ b/engines/pelrock/computer.h
@@ -80,7 +80,7 @@ private:
 	Common::Array<LibraryBook> _libraryBooks;
 	uint _currentResult;
 	int _memorizedBookIndex; // Index of book that was memorized (-1 if none)
-	int _lineHeight;
+	int _lineHeight = 0;
 	Common::String _titleMsg;
 	Common::String _authorMsg;
 




More information about the Scummvm-git-logs mailing list