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

Strangerke noreply at scummvm.org
Mon Jan 13 22:50:48 UTC 2025


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

Summary:
04885f68bb GOT: Remove unused include in sd_data
f29d7099d7 GOT: fix several CppCheck issues in setup, events, back and boss2


Commit: 04885f68bb5174546a55808575f7c1b55ba4741e
    https://github.com/scummvm/scummvm/commit/04885f68bb5174546a55808575f7c1b55ba4741e
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-13T23:50:35+01:00

Commit Message:
GOT: Remove unused include in sd_data

Changed paths:
    engines/got/data/sd_data.cpp


diff --git a/engines/got/data/sd_data.cpp b/engines/got/data/sd_data.cpp
index f97c442bd1e..9c1863ab016 100644
--- a/engines/got/data/sd_data.cpp
+++ b/engines/got/data/sd_data.cpp
@@ -20,7 +20,6 @@
  */
 
 #include "got/data/sd_data.h"
-#include "common/memstream.h"
 #include "got/utils/file.h"
 
 namespace Got {


Commit: f29d7099d72891ebada314845c0e13a0d9cc2949
    https://github.com/scummvm/scummvm/commit/f29d7099d72891ebada314845c0e13a0d9cc2949
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-13T23:50:36+01:00

Commit Message:
GOT: fix several CppCheck issues in setup, events, back and boss2

Changed paths:
    engines/got/data/setup.h
    engines/got/events.cpp
    engines/got/events.h
    engines/got/game/back.cpp
    engines/got/game/boss2.cpp


diff --git a/engines/got/data/setup.h b/engines/got/data/setup.h
index 90ad19b9728..14c5cb34064 100644
--- a/engines/got/data/setup.h
+++ b/engines/got/data/setup.h
@@ -94,7 +94,7 @@ struct SetupFlags {
 	bool &f63 = _flags[63];
 
 	SetupFlags() {}
-	void sync(Common::Serializer &s);
+	virtual void sync(Common::Serializer &s);
 	SetupFlags &operator=(const Got::SetupFlags &src);
 };
 
@@ -113,7 +113,7 @@ struct SETUP : public SetupFlags {
 	byte game_over = 0;
 	byte future[19] = {}; //probably not needed
 
-	void sync(Common::Serializer &s);
+	void sync(Common::Serializer &s) override;
 };
 
 } // namespace Got
diff --git a/engines/got/events.cpp b/engines/got/events.cpp
index 35463e04d8b..0acff0796c9 100644
--- a/engines/got/events.cpp
+++ b/engines/got/events.cpp
@@ -352,6 +352,11 @@ bool Events::isPresent(const Common::String &name) const {
 	return false;
 }
 
+void Events::drawElements() {
+	if (!_views.empty())
+		focusedView()->drawElements();
+}
+
 void Events::clearViews() {
 	if (!_views.empty())
 		focusedView()->msgUnfocus(UnfocusMessage());
diff --git a/engines/got/events.h b/engines/got/events.h
index d7cd9c00e61..bc438d37213 100644
--- a/engines/got/events.h
+++ b/engines/got/events.h
@@ -123,7 +123,7 @@ private:
      * Outer method for doing drawing
      *
      */
-	void drawElements();
+	virtual void drawElements();
 
 	/**
      * Finds a view globally
@@ -166,14 +166,14 @@ public:
 	/**
      * Sets the focus to a new view
      */
-	void replaceView(UIElement *ui, bool replaceAllViews = false, bool fadeOutIn = false);
-	void replaceView(const Common::String &name, bool replaceAllViews = false, bool fadeOutIn = false);
+	virtual void replaceView(UIElement *ui, bool replaceAllViews = false, bool fadeOutIn = false);
+	virtual void replaceView(const Common::String &name, bool replaceAllViews = false, bool fadeOutIn = false);
 
 	/**
      * Adds a focused view to the view stack without replacing current one
      */
-	void addView(UIElement *ui);
-	void addView(const Common::String &name);
+	virtual void addView(UIElement *ui);
+	virtual void addView(const Common::String &name);
 	void addView();
 	void open() {
 		addView();
@@ -345,14 +345,14 @@ public:
 	/**
      * Sets the focus to a new view
      */
-	void replaceView(UIElement *ui, bool replaceAllViews = false, bool fadeOutIn = false);
-	void replaceView(const Common::String &name, bool replaceAllViews = false, bool fadeOutIn = false);
+	void replaceView(UIElement *ui, bool replaceAllViews = false, bool fadeOutIn = false) override;
+	void replaceView(const Common::String &name, bool replaceAllViews = false, bool fadeOutIn = false) override;
 
 	/**
      * Adds a focused view to the view stack without replacing current one
      */
-	void addView(UIElement *ui);
-	void addView(const Common::String &name);
+	void addView(UIElement *ui) override;
+	void addView(const Common::String &name) override;
 
 	/**
      * Clears the view list
@@ -415,10 +415,7 @@ public:
 	/**
      * Draws the focused view
      */
-	void drawElements() {
-		if (!_views.empty())
-			focusedView()->drawElements();
-	}
+	void drawElements() override;
 
 	/**
      * Add a keypress to the event queue
diff --git a/engines/got/game/back.cpp b/engines/got/game/back.cpp
index 286f0a6e62d..2e6c348cdb3 100644
--- a/engines/got/game/back.cpp
+++ b/engines/got/game/back.cpp
@@ -303,7 +303,7 @@ void place_tile(int x, int y, int tile) {
 }
 
 int bgtile(int x, int y) {
-	if (x < 0 || x > 319 || y < 0 || y > 191)
+	if (x < 0 || x >= 319 || y < 0 || y >= 191)
 		return 0;
 
 	x = (x + 1) >> 4;
diff --git a/engines/got/game/boss2.cpp b/engines/got/game/boss2.cpp
index 1904d403477..0c32b5867a9 100644
--- a/engines/got/game/boss2.cpp
+++ b/engines/got/game/boss2.cpp
@@ -111,13 +111,16 @@ int boss2_movement(ACTOR *actr) {
 		}
 	}
 
-	actr->frame_count--;
-	if (actr->frame_count <= 0) {
+	const int count = actr->frame_count - 1;
+	
+	if (count <= 0) {
 		actr->next++;
 		if (actr->next > 2)
 			actr->next = 0;
 		actr->frame_count = actr->frame_speed;
-	}
+	} else
+		actr->frame_count = count;
+	
 	x = actr->x;
 	if (actr->num_shots < num_skulls && !drop_flag) {
 		if (x == 48 || x == 112 || x == 176 || x == 240) {




More information about the Scummvm-git-logs mailing list