1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-11 23:24:35 +00:00
nixpkgs/pkgs/games/tennix/fix_FTBFS.patch
Pascal Wittmann 6d89fff92a tennix: fix build
in the first attempt git removed whitespaces
2015-10-09 10:08:38 +02:00

289 lines
8.5 KiB
Diff

From: Thomas Perl <m@thp.io>
Description: Fix FTBFS
Origin: upstream, http://repo.or.cz/w/tennix.git/commitdiff/6144cb7626dfdc0820a0036af83a531e8e68bae6
Bug-Debian: http://bugs.debian.org/664907
--- tennix-1.1.orig/archivetool.cc
+++ tennix-1.1/archivetool.cc
@@ -24,6 +24,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libgen.h>
#include <sys/stat.h>
#include "archive.hh"
--- tennix-1.1.orig/game.c
+++ tennix-1.1/game.c
@@ -388,6 +388,9 @@ void step(GameState* s) {
s->ball.move_x = 4.0 + 3.0*PLAYER(s, p).power/PLAYER_POWER_MAX;
s->ball.move_z = 1.1*PLAYER(s, p).power/PLAYER_POWER_MAX;
break;
+ default:
+ assert(false);
+ break;
}
s->ball.move_y = get_move_y( s, p);
s->sound_events ^= SOUND_EVENT_RACKET;
--- tennix-1.1.orig/network.h
+++ tennix-1.1/network.h
@@ -103,19 +103,19 @@ void
net_serialize_ball(const Ball* src, NetworkBall* dest);
void
-net_unserialize_ball(const NetworkBall* src, Ball* dest);
+net_unserialize_ball(NetworkBall* src, Ball* dest);
void
net_serialize_player(const Player* src, NetworkPlayer* dest);
void
-net_unserialize_player(const NetworkPlayer* src, Player* dest);
+net_unserialize_player(NetworkPlayer* src, Player* dest);
void
net_serialize_gamestate(const GameState* src, NetworkGameState* dest);
void
-net_unserialize_gamestate(const NetworkGameState* src, GameState* dest);
+net_unserialize_gamestate(NetworkGameState* src, GameState* dest);
#endif
--- tennix-1.1.orig/locations.h
+++ tennix-1.1/locations.h
@@ -155,7 +155,7 @@ static Location locations[] = {
#endif
/* End marker */
- { NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, false }
+ { NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, false, false, 0, 0 }
};
unsigned int location_count()
--- tennix-1.1.orig/tennix.cc
+++ tennix-1.1/tennix.cc
@@ -461,7 +461,7 @@ int main( int argc, char** argv) {
start_fade();
gameloop(current_game, connection);
SDL_Delay(150);
- while(SDL_PollEvent(&e));
+ while (SDL_PollEvent(&e)) {};
#ifdef ENABLE_FPS_LIMIT
frames = 0;
ft = SDL_GetTicks();
--- tennix-1.1.orig/SDL_rotozoom.c
+++ tennix-1.1/SDL_rotozoom.c
@@ -365,6 +365,9 @@ int zoomSurfaceRGBA(SDL_Surface * src, S
int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy)
{
+ (void)flipx;
+ (void)flipy;
+
Uint32 x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy;
Uint8 *sp, *dp, *csp;
int dgap;
@@ -393,7 +396,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
*/
csx = 0;
csax = sax;
- for (x = 0; x < dst->w; x++) {
+ for (x = 0; x < (Uint32)dst->w; x++) {
csx += sx;
*csax = (csx >> 16);
csx &= 0xffff;
@@ -401,7 +404,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
}
csy = 0;
csay = say;
- for (y = 0; y < dst->h; y++) {
+ for (y = 0; y < (Uint32)dst->h; y++) {
csy += sy;
*csay = (csy >> 16);
csy &= 0xffff;
@@ -410,13 +413,13 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
csx = 0;
csax = sax;
- for (x = 0; x < dst->w; x++) {
+ for (x = 0; x < (Uint32)dst->w; x++) {
csx += (*csax);
csax++;
}
csy = 0;
csay = say;
- for (y = 0; y < dst->h; y++) {
+ for (y = 0; y < (Uint32)dst->h; y++) {
csy += (*csay);
csay++;
}
@@ -432,10 +435,10 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
* Draw
*/
csay = say;
- for (y = 0; y < dst->h; y++) {
+ for (y = 0; y < (Uint32)dst->h; y++) {
csax = sax;
sp = csp;
- for (x = 0; x < dst->w; x++) {
+ for (x = 0; x < (Uint32)dst->w; x++) {
/*
* Draw
*/
@@ -801,6 +804,8 @@ SDL_Surface* rotateSurface90Degrees(SDL_
void rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight,
double *canglezoom, double *sanglezoom)
{
+ (void)zoomy;
+
double x, y, cx, cy, sx, sy;
double radangle;
int dstwidthhalf, dstheighthalf;
--- tennix-1.1.orig/network.c
+++ tennix-1.1/network.c
@@ -183,7 +183,7 @@ net_serialize_ball(const Ball* src, Netw
}
void
-net_unserialize_ball(const NetworkBall* src, Ball* dest)
+net_unserialize_ball(NetworkBall* src, Ball* dest)
{
assert(src != NULL && dest != NULL);
dest->x = unpack_float(SDLNet_Read32(&(src->x)), -WIDTH, WIDTH*2);
@@ -213,7 +213,7 @@ net_serialize_player(const Player* src,
}
void
-net_unserialize_player(const NetworkPlayer* src, Player* dest)
+net_unserialize_player(NetworkPlayer* src, Player* dest)
{
assert(src != NULL && dest != NULL);
dest->x = unpack_float(SDLNet_Read32(&(src->x)), 0, WIDTH*1.2);
@@ -221,7 +221,7 @@ net_unserialize_player(const NetworkPlay
dest->power = unpack_float(SDLNet_Read32(&(src->power)), 0, 110);
dest->use_power = src->use_power;
dest->score = src->score;
- dest->desire = src->desire;
+ dest->desire = (PlayerDesire)src->desire;
dest->game = src->game;
memcpy(dest->sets, src->sets, sizeof(unsigned char)*(SETS_TO_WIN*2));
dest->accelerate = unpack_float(SDLNet_Read32(&(src->accelerate)), 0, 200);
@@ -250,7 +250,7 @@ net_serialize_gamestate(const GameState*
}
void
-net_unserialize_gamestate(const NetworkGameState* src, GameState* dest)
+net_unserialize_gamestate(NetworkGameState* src, GameState* dest)
{
int p;
--- tennix-1.1.orig/makefile
+++ tennix-1.1/makefile
@@ -27,24 +27,23 @@ ifeq ($(MKCALLGRAPH),1)
LD = nccld
endif
-RELEASE = 1.1
-
-UNAME = $(shell uname)
+RELEASE = 1.1.1
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
DATAROOTDIR ?= $(PREFIX)/share
DATADIR ?= $(DATAROOTDIR)/games
-LIBS =
-CFLAGS += -W -Wall -ansi -pedantic -Wcast-qual -Wwrite-strings -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\" -g
+CFLAGS += -W -Wall -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\"
CXXFLAGS += $(CFLAGS)
USE_PYTHON ?= 1
ifeq ($(USE_PYTHON),1)
- CFLAGS += `python-config --includes` -DTENNIX_PYTHON
- LIBS += `python-config --libs`
+ PYTHON_INCLUDES := $(shell python-config --includes)
+ PYTHON_LIBS := $(shell python-config --libs)
+ CFLAGS += $(PYTHON_INCLUDES) -DTENNIX_PYTHON
+ LIBS += $(PYTHON_LIBS)
endif
ifeq ($(NONFREE_LOCATIONS),1)
@@ -67,17 +66,14 @@ ifeq ($(MAEMO),1)
CFLAGS += -DMAEMO
endif
-ifeq ($(UNAME),Darwin)
- SDLLIBS=$$(sdl-config --prefix)/lib
- LIBS += $$(sdl-config --static-libs) $(SDLLIBS)/libSDL_mixer.a $(SDLLIBS)/libSDL_image.a $(SDLLIBS)/libSDL_ttf.a $(SDLLIBS)/libSDL_net.a $$(freetype-config --prefix)/lib/libfreetype.a
- CFLAGS += $$(sdl-config --cflags) -lz
-else
- LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net
- CFLAGS += $$(sdl-config --cflags)
-endif
+SDL_LIBS := $(shell sdl-config --libs)
+SDL_CFLAGS := $(shell sdl-config --cflags)
+
+LIBS += $(SDL_LIBS) -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net
+CFLAGS += $(SDL_CFLAGS)
-SRC = tennix.cc game.c graphics.cc input.c util.c sound.cc animation.c network.c
OBJ = tennix.o game.o graphics.o input.o util.o sound.o animation.o archive.o SDL_rotozoom.o network.o
+
ifeq ($(MSYSTEM),MINGW32)
OBJ += tennixres.o
endif
--- tennix-1.1.orig/game.h
+++ tennix-1.1/game.h
@@ -98,6 +98,13 @@ typedef struct {
bool inhibit_gravity;
} Ball;
+enum PlayerDesire {
+ DESIRE_NORMAL,
+ DESIRE_TOPSPIN,
+ DESIRE_SMASH,
+ DESIRE_MAX
+};
+
typedef struct {
InputDevice* input;
char input_device_index;
@@ -106,9 +113,9 @@ typedef struct {
float power;
bool use_power;
unsigned char score;
- unsigned char desire;
+ PlayerDesire desire;
bool type; /* is this player ai-controlled or human? */
- char game; /* score for the current game */
+ int game; /* score for the current game */
unsigned char sets[SETS_TO_WIN*2]; /* score for each set */
float accelerate; /* a value [0..1] how fast the user accelerates */
} Player;
@@ -118,13 +125,6 @@ enum {
PLAYER_TYPE_AI
};
-enum {
- DESIRE_NORMAL,
- DESIRE_TOPSPIN,
- DESIRE_SMASH,
- DESIRE_MAX
-};
-
/* wait 2 seconds before we score the game */
#define SCORING_DELAY 1000
@@ -161,7 +161,7 @@ enum {
typedef struct {
const Location* location;
- char current_location; /* index of loc. in global location table */
+ int current_location; /* index of loc. in global location table */
Ball ball;
Player players[MAXPLAYERS];
unsigned char serving_player;