[Scummvm-git-logs] scummvm master -> 933c9651791e542a45746adde29a316e4748ae3b

digitall noreply at scummvm.org
Sun Jul 24 00:27:24 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:
933c965179 SAGA2: Remove Undefined DEBUG Macro Symbol Usage from Spell Code


Commit: 933c9651791e542a45746adde29a316e4748ae3b
    https://github.com/scummvm/scummvm/commit/933c9651791e542a45746adde29a316e4748ae3b
Author: D G Turner (digitall at scummvm.org)
Date: 2022-07-24T01:25:17+01:00

Commit Message:
SAGA2: Remove Undefined DEBUG Macro Symbol Usage from Spell Code

This generates a warning if GCC is passed -Wundef.

This will now allow debugging of the Spell behaviour at runtime via
the debug console when code to allow this is added.

Changed paths:
    engines/saga2/spelcast.cpp
    engines/saga2/spellbuk.h


diff --git a/engines/saga2/spelcast.cpp b/engines/saga2/spelcast.cpp
index 67c0fa80443..3c362310bb0 100644
--- a/engines/saga2/spelcast.cpp
+++ b/engines/saga2/spelcast.cpp
@@ -30,9 +30,7 @@
 #include "saga2/spelshow.h"
 #include "saga2/spelvals.h"
 #include "saga2/tilevect.h"
-#if DEBUG
 #include "saga2/tileline.h"
-#endif
 
 namespace Saga2 {
 
@@ -76,6 +74,8 @@ SpellStuff::SpellStuff() {
 	size = 0;
 	range = 0;
 	sound = 0;
+
+	_debug = false;
 }
 
 //-----------------------------------------------------------------------
@@ -408,7 +408,6 @@ void SpellStuff::removeTargetList() {
 //-----------------------------------------------------------------------
 //	spell debugging
 
-#if DEBUG
 #define DSPELL_AREA_COLOR 3
 #define DSPELL_TARGET_COLOR 7
 
@@ -417,6 +416,8 @@ void showTarg(const TilePoint &tp) {
 }
 
 void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
+	if (!_debug) return;
+
 	int16 radius = size;
 	TilePoint tVect, orth, tBase;
 	switch (shape) {
@@ -570,11 +571,6 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
 	}
 	}
 }
-#else
-
-void SpellStuff::show(GameObject *, SpellTarget &) {}
-
-#endif
 
 /* ===================================================================== *
    SpellInstance implementation
diff --git a/engines/saga2/spellbuk.h b/engines/saga2/spellbuk.h
index 2e78d92d089..5ce324f46ec 100644
--- a/engines/saga2/spellbuk.h
+++ b/engines/saga2/spellbuk.h
@@ -123,6 +123,8 @@ class SpellStuff {
 	int32               range;
 	int16               sound;
 
+	bool _debug;
+
 public:
 
 	SpellStuff();




More information about the Scummvm-git-logs mailing list