Bug#550583: hex-a-hop: Fix for some compilation warnings

root russell at coker.com.au
Sun Oct 11 11:12:42 UTC 2009


Package: hex-a-hop
Version: 0.0.20070315-7
Severity: normal

The following patch fixes some compile warnings and also adds "make dep"
support to the Makefile.

diff -ru hex-a-hop-0.0.20070315.bak/gfx.cpp hex-a-hop-0.0.20070315.new/gfx.cpp
--- hex-a-hop-0.0.20070315.bak/gfx.cpp	2009-10-11 18:01:54.000000000 +1100
+++ hex-a-hop-0.0.20070315.new/gfx.cpp	2009-10-11 22:01:42.000000000 +1100
@@ -193,7 +193,7 @@
 {
 	// Workaround for possible crash, see
 	// http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439071
-	if (text_utf8.size() == 0 || text_utf8.size() == 1 && text_utf8[0]==127)
+	if (text_utf8.size() == 0 || (text_utf8.size() == 1 && text_utf8[0]==127))
 		return;
 	assert(text_utf8.find("\n") == std::string::npos);
 	SDLPango_SetMinimumSize(context, SCREEN_W, 0);
@@ -220,7 +220,7 @@
 {
 	// Workaround for possible crash, see
 	// http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439071
-	if (text_utf8.size() == 0 || text_utf8.size() == 1 && text_utf8[0]==127)
+	if (text_utf8.size() == 0 || (text_utf8.size() == 1 && text_utf8[0]==127))
 		return;
 	if (width<=0)
 		return;
@@ -343,7 +343,7 @@
 			0x1ffffff1,
 		};
 		for (int i=0; i<32; i++)
-			mask[i] = mask[i]>>24 | (mask[i]>>8)&0xff00 | (mask[i]<<8)&0xff0000 | (mask[i]<<24)&0xff000000;
+			mask[i] = mask[i]>>24 | ((mask[i]>>8)&0xff00) | ((mask[i]<<8)&0xff0000) | ((mask[i]<<24)&0xff000000);
 		SDL_WM_SetIcon(icon, (unsigned char*) mask);
 		SDL_FreeSurface(icon);
 	}
diff -ru hex-a-hop-0.0.20070315.bak/hex_puzzzle.cpp hex-a-hop-0.0.20070315.new/hex_puzzzle.cpp
--- hex-a-hop-0.0.20070315.bak/hex_puzzzle.cpp	2009-10-11 18:01:54.000000000 +1100
+++ hex-a-hop-0.0.20070315.new/hex_puzzzle.cpp	2009-10-11 22:01:42.000000000 +1100
@@ -163,7 +163,7 @@
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 #define ABS(a) ((a)<0 ? -(a) : (a))
 
-#define WATER_COLOUR 31 | (IMAGE_DAT_OR_MASK>>16)&255, 37 | (IMAGE_DAT_OR_MASK>>8)&255, 135 | (IMAGE_DAT_OR_MASK>>0)&255
+#define WATER_COLOUR 31 | ((IMAGE_DAT_OR_MASK>>16)&255), 37 | ((IMAGE_DAT_OR_MASK>>8)&255), 135 | ((IMAGE_DAT_OR_MASK>>0)&255)
 
 #define ROTATION_TIME 0.25
 #define BUILD_TIME 1
@@ -243,7 +243,7 @@
 	#include "tiletypes.h"
 };
 
-void ChangeSuffix(char* filename, char* newsuffix)
+void ChangeSuffix(char* const filename, const char* const newsuffix)
 {
 	int len = strlen(filename);
 	int i = len-1;
@@ -748,7 +748,7 @@
 					}
 			}
 
-			if (playerDepth==j0 || j0==SIZE*3 && playerDepth>j0)
+			if (playerDepth==j0 || (j0==SIZE*3 && playerDepth>j0))
 				player.Render(t, reflect);
 		}
 
@@ -928,9 +928,13 @@
 	#endif
 
 	if (!reflect && adj)
+	{
 		for (int i=0; i<MAX_DIR; i++)
+		{
 			if (adj & (1 << i))
 				RenderTile( false, TILE_LINK_0+i, p.getScreenX(), p.getScreenY());
+		}
+	}
 
 	if (item < 0)
 		return;
@@ -1012,10 +1016,12 @@
 		else if (special && (t==EMPTY || t==TRAP) && !reflect && time < specialDuration)
 		{
 			if (t == TRAP)
+			{
 				if (time < specialDuration-LASER_FADE_TIME)
 					RenderTile(reflect, TILE_ICE_LASER_REFRACT, p.getScreenX(), p.getScreenY());
 				else
 					RenderTile(reflect, t, p.getScreenX(), p.getScreenY());
+			}
 			int base = ((t==EMPTY) ? TILE_LASER_0 : TILE_LASER_REFRACT);
 			if (t==EMPTY && time >= specialDuration-LASER_FADE_TIME)
 				base = TILE_LASER_FADE_0;
@@ -1284,6 +1290,7 @@
 			if (dist > 0 && !height)
 			{
 				if (!reflect)
+				{
 					for (int i=0; i<=int(dist*15); i++)
 					{
 						int x = p.getScreenX(), y = p.getScreenY();
@@ -1293,6 +1300,7 @@
 						RenderTile(reflect, TILE_GREEN_FRAGMENT, x+x1, y+y1+4);
 						RenderTile(reflect, TILE_GREEN_FRAGMENT, x-x1, y-y1+4);
 					}
+				}
 			}
 			if (dist > 0 && height)
 			{
@@ -1347,7 +1355,7 @@
 		if (f>1) f=1;
 		if (f==1) dead = this->dead;
 
-		if (f==1 || f>0.5 && p_h>target_h)
+		if (f==1 || (f>0.5 && p_h>target_h))
 			return target.x+target.y*2;
 		return MAX(target.x+target.y*2 , p.x+p.y*2);
 	}
@@ -1408,7 +1416,7 @@
 				//if (frame==2) frame=0; else if (frame==3) frame=2;
 				frame = 0;
 			}
-			else if (f==1 || x==x2 && y==y2)	// stationary
+			else if (f==1 || (x==x2 && y==y2))	// stationary
 				frame = 0;
 			else if (f > 0.7)
 				frame = 0;
@@ -2224,7 +2232,7 @@
 		{
 			int i = GetLevelState(p+d, 1);
 //			if (i>1 || i==1 && t>1)
-			if (i>=1 && t>2 || t>=1 && i>2)
+			if ((i>=1 && t>2) || (t>=1 && i>2))
 			{
 				adj |= 1<<d;
 				if (t==1)
@@ -2927,7 +2935,7 @@
 
 
 #ifndef EDIT
-		if (button_pressed==2 || button_pressed==4 && isMap)
+		if (button_pressed==2 || (button_pressed==4 && isMap))
 		{
 			KeyPressed(SDLK_ESCAPE, 0);
 			keyState[SDLK_ESCAPE] = 0;
@@ -2971,7 +2979,7 @@
 			}
 			if(!isMap)
 			{
-				if((button_pressed & 1) || (button_held & 1) && (numUndo==0 || time>=undo[numUndo-1].endTime))
+				if((button_pressed & 1) || ((button_held & 1) && (numUndo==0 || time>=undo[numUndo-1].endTime)))
 				{
 					if(s.x==player.x && s.y==player.y)
 					{
@@ -2992,7 +3000,7 @@
 					else if(s.y+s.x==player.y+player.x && s.x<player.x)
 						Input(4);
 				}
-				if ((button_pressed & 4) || (button_held & 4) && (undoTime < 0))
+				if ((button_pressed & 4) || ((button_held & 4) && (undoTime < 0)))
 					Undo();
 			}
 			return;
@@ -3213,7 +3221,7 @@
 						if (hits[i]==p)
 							break;
 					if (i==numHits || 
-						t==TRAP && (hitDir[i]&(1<<fd))==0
+						(t==TRAP && (hitDir[i]&(1<<fd))==0)
 					   )
 					{
 						if (i==numHits)
@@ -3770,10 +3778,10 @@
 
 		if (isMap && isRenderMap)
 		{
+#ifndef EDIT
 			double min = 50;
 			static double scrollHi = 0;
 			double x = 0;
-#ifndef EDIT
 //			if (!noMouse)
 			{
 				int xx = noMouse ? keyboardp.getScreenX()-scrollX : mousex;
@@ -3931,7 +3939,7 @@
 
 		if (0) {}
 		
-		else if ((key=='p' && !editMode || key==SDLK_PAUSE || key==SDLK_ESCAPE))
+		else if (((key=='p' && !editMode) || key==SDLK_PAUSE || key==SDLK_ESCAPE))
 		{
 			noMouse = 1;
 			new PauseMenu(isMap, progress.GetLevel(STARTING_LEVEL, true)->Completed(), progress.general.endSequence>=1, progress.general.endSequence>=2);
@@ -3941,8 +3949,8 @@
 		else if (key=='e' && (mod & KMOD_ALT)) 
 			editMode = !editMode;
 		
-		else if (key=='p' && (mod & KMOD_ALT) && numUndo>0
-		      || key>='0' && key<='9' && (mod & KMOD_SHIFT) && !isMap)
+		else if ((key=='p' && (mod & KMOD_ALT) && numUndo>0)
+		      || (key>='0' && key<='9' && (mod & KMOD_SHIFT) && !isMap))
 		{
 			if (key>='0' && key<='9')
 				levelDiff = (key=='0') ? 10 : key-'0';
diff -ru hex-a-hop-0.0.20070315.bak/Makefile hex-a-hop-0.0.20070315.new/Makefile
--- hex-a-hop-0.0.20070315.bak/Makefile	2009-10-11 18:01:54.000000000 +1100
+++ hex-a-hop-0.0.20070315.new/Makefile	2009-10-11 22:01:42.000000000 +1100
@@ -20,5 +20,13 @@
 		$(GCC) $(CXXFLAGS) $(OBJS)  `sdl-config --libs` -lSDL_Pango -lm  \
 		-o $(NAME)
 
+dep:
+	makedepend -Y *.cpp *.h
+
 clean :
 	rm -f *~ $(OBJS) $(NAME)
+# DO NOT DELETE
+
+gfx.o: i18n.h state.h
+hex_puzzzle.o: i18n.h state.h tiletypes.h packfile.h gfx_list.h savestate.h
+hex_puzzzle.o: menus.h level_list.h
diff -ru hex-a-hop-0.0.20070315.bak/menus.h hex-a-hop-0.0.20070315.new/menus.h
--- hex-a-hop-0.0.20070315.bak/menus.h	2009-10-11 18:01:54.000000000 +1100
+++ hex-a-hop-0.0.20070315.new/menus.h	2009-10-11 22:01:42.000000000 +1100
@@ -336,7 +336,7 @@
 		const double SPD = 10;
 
 #ifdef EDIT
-		sprintf (title, _("Help (Page --)"), page_display+1, page_count);
+		sprintf (title, _("Help (Page --)"));
 #else
 		sprintf (title, _("Help (Page %d/%d)"), page_display+1, page_count);
 #endif
@@ -418,7 +418,7 @@
 	 return t;
 }
 
-char * optionString[] = {
+const char * optionString[] = {
 	optionSlotName[0],
 	optionSlotName[1],
 	optionSlotName[2],
@@ -1246,8 +1246,8 @@
 			break;
 
 		default:
-			if (opt[select]>=OPT_GAMESLOT_0 && opt[select]<=OPT_GAMESLOT_LAST 
-				|| opt[select]==OPT_GAMESLOT_NEW && freeSlot>=0)
+			if ((opt[select]>=OPT_GAMESLOT_0 && opt[select]<=OPT_GAMESLOT_LAST) 
+				|| (opt[select]==OPT_GAMESLOT_NEW && freeSlot>=0))
 			{
 				if (opt[select]==OPT_GAMESLOT_NEW)
 					GetSlotName(freeSlot, currentSlot);

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages hex-a-hop depends on:
ii  libc6                         2.9-27     GNU C Library: Shared libraries
ii  libgcc1                       1:4.4.1-6  GCC support library
ii  libsdl-pango1                 0.1.2-4    text rendering with Pango in SDL a
ii  libsdl1.2debian               1.2.13-5   Simple DirectMedia Layer
ii  libstdc++6                    4.4.1-6    The GNU Standard C++ Library v3

hex-a-hop recommends no packages.

hex-a-hop suggests no packages.

-- no debconf information





More information about the Pkg-games-devel mailing list