[iortcw] 196/497: All: Add ColorIndexForNumber macro replacing '& 0x07'

Simon McVittie smcv at debian.org
Fri Sep 8 10:36:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit b11e62b90f5cdbf57ce82bdbea0a93b3f22d8c0c
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Fri Aug 29 17:10:19 2014 +0000

    All: Add ColorIndexForNumber macro replacing '& 0x07'
---
 MP/code/client/cl_console.c | 4 ++--
 MP/code/qcommon/q_shared.h  | 3 ++-
 SP/code/client/cl_console.c | 4 ++--
 SP/code/qcommon/q_shared.h  | 3 ++-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/MP/code/client/cl_console.c b/MP/code/client/cl_console.c
index 5e83365..34288bb 100644
--- a/MP/code/client/cl_console.c
+++ b/MP/code/client/cl_console.c
@@ -631,8 +631,8 @@ void Con_DrawNotify( void ) {
 			if ( ( text[x] & 0xff ) == ' ' ) {
 				continue;
 			}
-			if ( ( ( text[x] >> 8 ) & 7 ) != currentColor ) {
-				currentColor = ( text[x] >> 8 ) & 7;
+			if ( ColorIndexForNumber( text[x] >> 8 ) != currentColor ) {
+				currentColor = ColorIndexForNumber( text[x] >> 8 );
 				re.SetColor( g_color_table[currentColor] );
 			}
 			SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + ( x + 1 ) * SMALLCHAR_WIDTH, v, text[x] & 0xff );
diff --git a/MP/code/qcommon/q_shared.h b/MP/code/qcommon/q_shared.h
index ce39bd4..31b59f7 100644
--- a/MP/code/qcommon/q_shared.h
+++ b/MP/code/qcommon/q_shared.h
@@ -454,7 +454,8 @@ extern vec4_t colorDkGrey;
 #define COLOR_CYAN      '5'
 #define COLOR_MAGENTA   '6'
 #define COLOR_WHITE     '7'
-#define ColorIndex(c)	(((c) - '0') & 0x07)
+#define ColorIndexForNumber(c) ((c) & 0x07)
+#define ColorIndex(c) (ColorIndexForNumber((c) - '0'))
 
 #define S_COLOR_BLACK   "^0"
 #define S_COLOR_RED     "^1"
diff --git a/SP/code/client/cl_console.c b/SP/code/client/cl_console.c
index 07c2d22..8ac8bfd 100644
--- a/SP/code/client/cl_console.c
+++ b/SP/code/client/cl_console.c
@@ -616,8 +616,8 @@ void Con_DrawNotify( void ) {
 			if ( ( text[x] & 0xff ) == ' ' ) {
 				continue;
 			}
-			if ( ( ( text[x] >> 8 ) & 7 ) != currentColor ) {
-				currentColor = ( text[x] >> 8 ) & 7;
+			if ( ColorIndexForNumber( text[x] >> 8 ) != currentColor ) {
+				currentColor = ColorIndexForNumber( text[x] >> 8 );
 				re.SetColor( g_color_table[currentColor] );
 			}
 			SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + ( x + 1 ) * SMALLCHAR_WIDTH, v, text[x] & 0xff );
diff --git a/SP/code/qcommon/q_shared.h b/SP/code/qcommon/q_shared.h
index 0e80891..9e664bb 100644
--- a/SP/code/qcommon/q_shared.h
+++ b/SP/code/qcommon/q_shared.h
@@ -456,7 +456,8 @@ extern vec4_t colorDkGrey;
 #define COLOR_CYAN      '5'
 #define COLOR_MAGENTA   '6'
 #define COLOR_WHITE     '7'
-#define ColorIndex( c )   ( ( ( c ) - '0' ) & 0x07 )
+#define ColorIndexForNumber(c) ((c) & 0x07)
+#define ColorIndex(c) (ColorIndexForNumber((c) - '0'))
 
 #define S_COLOR_BLACK   "^0"
 #define S_COLOR_RED     "^1"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list