summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/audio.c17
-rw-r--r--src/audio/music.c28
-rw-r--r--src/audio/sound.c29
-rw-r--r--src/base/arenaFile.c15
-rw-r--r--src/base/homeDirector.c6
-rw-r--r--src/base/idManager.c22
-rw-r--r--src/base/main.h9
-rw-r--r--src/base/modules.c13
-rw-r--r--src/base/proto.c4
-rw-r--r--src/base/shareFunction.c6
-rw-r--r--src/base/storage.c5
-rw-r--r--src/base/tcp_server.c36
-rw-r--r--src/base/udp_server.c29
-rw-r--r--src/client/client.c21
-rw-r--r--src/client/configFile.c5
-rw-r--r--src/client/font.c12
-rw-r--r--src/client/game.c6
-rw-r--r--src/client/image.c17
-rw-r--r--src/client/interface.c7
-rw-r--r--src/client/saveLoad.c12
-rw-r--r--src/client/screen.c16
-rw-r--r--src/screen/screen_gameType.c6
-rw-r--r--src/screen/screen_world.c4
-rw-r--r--src/server/highScore.c5
-rw-r--r--src/server/log.c6
-rw-r--r--src/server/publicServer.c10
-rw-r--r--src/widget/widget_button.c6
27 files changed, 160 insertions, 192 deletions
diff --git a/src/audio/audio.c b/src/audio/audio.c
index 0d9b0a2..9d629eb 100644
--- a/src/audio/audio.c
+++ b/src/audio/audio.c
@@ -29,17 +29,19 @@ void initAudio()
fprintf(stderr, _("Unable to initialize audio: %s\n"), SDL_GetError());
return;
}
- if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 1024) ==
- -1) {
+
+ if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 1024) == -1)
+ {
fprintf(stderr, _("Unable to create proper audio settings: %s\n"),
Mix_GetError());
return;
}
+
Mix_AllocateChannels(16);
Mix_Volume(-1, MIX_MAX_VOLUME);
-#ifdef DEBUG
- printf(_("Initializing audio system...\n"));
-#endif
+
+ DEBUG_MSG(_("Initializing audio system...\n"));
+
isAudioInit = TRUE;
}
@@ -50,7 +52,6 @@ void quitAudio()
{
Mix_CloseAudio();
isAudioInit = TRUE;
-#ifdef DEBUG
- printf(_("Quitting audio...\n"));
-#endif
+
+ DEBUG_MSG(_("Quitting audio...\n"));
}
diff --git a/src/audio/music.c b/src/audio/music.c
index 04de359..5af9dda 100644
--- a/src/audio/music.c
+++ b/src/audio/music.c
@@ -32,17 +32,19 @@ void initMusic()
isMusicInit = FALSE;
return;
}
+
listStorage = newStorage();
currentMusic = NULL;
isMusicInit = TRUE;
var_isMusicActive = TRUE;
+
if (isParamFlag("--nomusic"))
setMusicActive(FALSE);
+
if (isParamFlag("--music"))
setMusicActive(TRUE);
-#ifdef DEBUG
- printf(_("Initializing music...\n"));
-#endif
+
+ DEBUG_MSG(_("Initializing music...\n"));
}
/*
@@ -53,9 +55,7 @@ static Mix_Music *loadMixMusic(char *file)
Mix_Music *mixer;
char str[STR_PATH_SIZE];
-#ifdef DEBUG
- printf(_("Loading music file: %s\n"), file);
-#endif
+ DEBUG_MSG(_("Loading music file: %s\n"), file);
if (isFillPath(file)) {
strcpy(str, file);
@@ -98,6 +98,7 @@ static void destroyMusic(void *p)
void addMusic(char *file, char *name, char *group)
{
Mix_Music *new;
+
if (isMusicInit == FALSE)
return;
@@ -118,9 +119,8 @@ void stopMusic()
return;
if (currentMusic != NULL) {
-#ifdef DEBUG
- printf(_("Stopping music...\n"));
-#endif
+ DEBUG_MSG(_("Stopping music...\n"));
+
Mix_HaltMusic();
currentMusic = NULL;
}
@@ -158,9 +158,8 @@ void playMusic(char *name, char *group)
strcpy(currentMusic_name, name);
if (currentMusic != NULL) {
-#ifdef DEBUG
- printf(_("Playing music file %s\n"), name);
-#endif
+ DEBUG_MSG(_("Playing music file %s\n"), name);
+
playMixMusic();
}
}
@@ -221,7 +220,6 @@ void quitMusic()
stopMusic();
destroyStorage(listStorage, destroyMusic);
isMusicInit = FALSE;
-#ifdef DEBUG
- printf(_("Quitting music...\n"));
-#endif
+
+ DEBUG_MSG(_("Quitting music...\n"));
}
diff --git a/src/audio/sound.c b/src/audio/sound.c
index c96e3ac..63d4566 100644
--- a/src/audio/sound.c
+++ b/src/audio/sound.c
@@ -34,13 +34,15 @@ void initSound()
listStorage = newStorage();
isSoundInit = TRUE;
var_isSoundActive = TRUE;
+
if (isParamFlag("--nosound"))
setSoundActive(FALSE);
+
if (isParamFlag("--sound"))
setSoundActive(TRUE);
-#ifdef DEBUG
- printf(_("Initializing sound...\n"));
-#endif
+
+ DEBUG_MSG(_("Initializing sound...\n"));
+
}
/*
@@ -51,17 +53,17 @@ static Mix_Chunk *loadMixSound(char *file)
Mix_Chunk *new;
char str[STR_PATH_SIZE];
-#ifdef DEBUG
- printf(_("Loading sound file: %s\n"), file);
-#endif
+ DEBUG_MSG(_("Loading sound file: %s\n"), file);
+
sprintf(str, PATH_SOUND "%s", file);
accessExistFile(str);
new = Mix_LoadWAV(str);
+
if (new == NULL) {
- fprintf(stderr, _("Unable to load sound file: %s with error: %s\n"),
- str, Mix_GetError());
+ fprintf(stderr, _("Unable to load sound file: %s with error: %s\n"), str, Mix_GetError());
return NULL;
}
+
return new;
}
@@ -71,8 +73,7 @@ static Mix_Chunk *loadMixSound(char *file)
static void playMixSound(Mix_Chunk * p)
{
if (Mix_PlayChannel(-1, p, 0) == -1) {
- fprintf(stderr, _("Unable to playback sound with error: %s\n"),
- Mix_GetError());
+ fprintf(stderr, _("Unable to playback sound with error: %s\n"), Mix_GetError());
return;
}
}
@@ -94,9 +95,11 @@ void addSound(char *file, char *name, char *group)
if (isSoundInit == FALSE)
return;
+
assert(file != NULL);
assert(name != NULL);
assert(group != NULL);
+
new = loadMixSound(file);
addItemToStorage(listStorage, group, name, new);
}
@@ -108,6 +111,7 @@ void playSound(char *name, char *group)
{
if (isSoundInit == FALSE || var_isSoundActive == FALSE)
return;
+
playMixSound(getItemFromStorage(listStorage, group, name));
}
@@ -136,7 +140,6 @@ void quitSound()
return;
destroyStorage(listStorage, destroySound);
isSoundInit = FALSE;
-#ifdef DEBUG
- printf(_("Quitting sound...\n"));
-#endif
+
+ DEBUG_MSG(_("Quitting sound...\n"));
}
diff --git a/src/base/arenaFile.c b/src/base/arenaFile.c
index cd76561..cb3ceb2 100644
--- a/src/base/arenaFile.c
+++ b/src/base/arenaFile.c
@@ -119,9 +119,8 @@ static void cmd_arena(arena_t ** arena, char *line)
//(*arena)->w = atoi(str_w);
//(*arena)->h = atoi(str_h);
setCurrentArena(*arena);
-#ifdef DEBUG
- printf(_("Loaded new arena...\n"));
-#endif
+
+ DEBUG_MSG(_("Loaded new arena...\n"));
}
static void cmd_loadModule(char *line)
@@ -168,10 +167,10 @@ static void cmd_loadMusic(arenaFile_t * arenaFile, char *line)
if (getArenaValue(line, "name", str_name, STR_SIZE) != 0)
return;
-# ifndef NO_SOUND
+#ifndef NO_SOUND
//addMusic(str_file, str_name, MUSIC_GROUP_USER);
loadMusicFromArena(arenaFile, str_file, MUSIC_GROUP_USER, str_name);
-# endif
+#endif
}
static void cmd_playMusic(arena_t * arena, char *line)
@@ -357,9 +356,9 @@ static void loadArenaFromDirector(char *director)
else {
sprintf(path, "%s/%s", director, line);
}
-#ifdef DEBUG
- printf(_("Loading arena: %s\n"), line);
-#endif
+
+ DEBUG_MSG(_("Loading arena: %s\n"), line);
+
accessExistFile(path);
loadArenaFile(path);
}
diff --git a/src/base/homeDirector.c b/src/base/homeDirector.c
index 1f10920..e62b7ee 100644
--- a/src/base/homeDirector.c
+++ b/src/base/homeDirector.c
@@ -26,9 +26,9 @@ void createHomeDirector()
sprintf(homeDirector, "%s/%s", envHome, HOMEDIRECTOR_NAME);
if (access(homeDirector, F_OK) != 0) {
-#ifdef DEBUG
- printf(_("Creating home directory %s.\n"), homeDirector);
-#endif
+
+ DEBUG_MSG(_("Creating home directory %s.\n"), homeDirector);
+
#ifndef __WIN32__
if (mkdir(homeDirector, 0755) != 0) {
#else
diff --git a/src/base/idManager.c b/src/base/idManager.c
index 7f82282..09d3fc9 100644
--- a/src/base/idManager.c
+++ b/src/base/idManager.c
@@ -37,9 +37,9 @@ void initListID()
{
listID = newList();
lastID = 0;
-#ifdef DEBUG
- printf(_("Starting ID manger\n"));
-#endif
+
+ DEBUG_MSG(_("Starting ID manger\n"));
+
}
int isRegisterID(int id)
@@ -176,24 +176,22 @@ void infoID(int id)
index = isRegisterID(id);
if (index == -1) {
-#ifdef DEBUG
- printf(_("ID %d does not exist\n"), id);
-#endif
+ DEBUG_MSG(_("ID %d does not exist\n"), id);
+
return;
}
this = listID->list[index];
-#ifdef DEBUG
- printf(_("ID %d (count %d)\n"), this->id, this->count);
-#endif
+
+ DEBUG_MSG(_("ID %d (count %d)\n"), this->id, this->count);
+
return;
}
void quitListID()
{
-#ifdef DEBUG
- printf(_("Quitting ID manger\n"));
-#endif
+ DEBUG_MSG(_("Quitting ID manger\n"));
+
assert(listID != NULL);
destroyListItem(listID, destroyIdItem);
}
diff --git a/src/base/main.h b/src/base/main.h
index 7ea7111..c938eb5 100644
--- a/src/base/main.h
+++ b/src/base/main.h
@@ -20,6 +20,15 @@
//#define SUPPORT_OPENGL
+#ifdef DEBUG
+#define DEBUG_MSG(msg,arg...) printf(msg, ##arg)
+#endif
+
+#ifndef DEBUG
+#define DEBUG_MSG(msg,arg...)
+#endif
+
+
extern char *getParam(char *s);
extern char *getParamElse(char *s1, char *s2);
extern bool_t isParamFlag(char *s);
diff --git a/src/base/modules.c b/src/base/modules.c
index 82b5d56..75f581e 100644
--- a/src/base/modules.c
+++ b/src/base/modules.c
@@ -16,6 +16,7 @@
#include "arenaFile.h"
#include "proto.h"
#include "shareFunction.h"
+
#ifndef PUBLIC_SERVER
# include "interface.h"
# include "image.h"
@@ -158,9 +159,9 @@ static module_t *newModule(char *name)
ret->fce_isConflict = getFce(ret, "isConflict");
ret->fce_cmd = getFce(ret, "cmdArena");
ret->fce_recvMsg = getFce(ret, "recvMsg");
-#ifdef DEBUG
- printf(_("Loading module: \"%s\"\n"), name);
-#endif
+
+ DEBUG_MSG(_("Loading module: \"%s\"\n"), name);
+
if (ret->fce_init(&export_fce) != 0) {
fprintf(stderr, _("Failed initialization of module \"%s\""), name);
unmapImage(image);
@@ -179,9 +180,9 @@ static int destroyModule(module_t * p)
unmapImage(p->image);
free(p->name);
free(p);
-#ifdef DEBUG
- printf(_("Destroing module...\n"));
-#endif
+
+ DEBUG_MSG(_("Destroing module...\n"));
+
return 0;
}
diff --git a/src/base/proto.c b/src/base/proto.c
index de098ab..606dd33 100644
--- a/src/base/proto.c
+++ b/src/base/proto.c
@@ -63,9 +63,7 @@ void proto_recv_error_client(char *msg)
return;
}
-#ifdef DEBUG
- printf(_("Proto error code: \"%d\"\n"), errorcode);
-#endif
+ DEBUG_MSG(_("Proto error code: \"%d\"\n"), errorcode);
switch (errorcode) {
case PROTO_ERROR_CODE_BAD_VERSION:
diff --git a/src/base/shareFunction.c b/src/base/shareFunction.c
index f3a83d5..84250a4 100644
--- a/src/base/shareFunction.c
+++ b/src/base/shareFunction.c
@@ -38,9 +38,8 @@ void initShareFunction()
void addToShareFce(char *name, void *function)
{
-#ifdef DEBUG
- printf(_("Adding \"%s\" to share function.\n"), name);
-#endif
+ DEBUG_MSG(_("Adding \"%s\" to share function.\n"), name);
+
addList(listShareFce, newShareFceItem(name, function));
}
@@ -56,6 +55,7 @@ void *getShareFce(char *name)
if (strcmp(this->name, name) == 0)
return this->function;
}
+
return NULL;
}
diff --git a/src/base/storage.c b/src/base/storage.c
index 8307cdf..1562fd2 100644
--- a/src/base/storage.c
+++ b/src/base/storage.c
@@ -72,9 +72,8 @@ void *getItemFromStorage(list_t * list, char *group, char *name)
return this->data;
}
-#ifdef DEBUG
- printf(_("%s %s was not found in storage!\n"), group, name);
-#endif
+ DEBUG_MSG(_("%s %s was not found in storage!\n"), group, name);
+
return NULL;
}
diff --git a/src/base/tcp_server.c b/src/base/tcp_server.c
index aeb3b8c..b781fb5 100644
--- a/src/base/tcp_server.c
+++ b/src/base/tcp_server.c
@@ -130,14 +130,11 @@ int initTcpServer(char *ip4, int port4, char *ip6, int port6)
if (sock_server_tcp != NULL) {
ret++;
disableNagle(sock_server_tcp);
-#ifdef DEBUG
- printf(_("Starting server: \"%s\" on port: \"%d\"\n"), ip4, port4);
-#endif
+
+ DEBUG_MSG(_("Starting server: \"%s\" on port: \"%d\"\n"), ip4, port4);
} else {
-#ifdef DEBUG
- printf(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"),
- ip4, port4);
-#endif
+ DEBUG_MSG(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip4, port4);
+
}
}
@@ -147,14 +144,11 @@ int initTcpServer(char *ip4, int port4, char *ip6, int port6)
if (sock_server_tcp_second != NULL) {
ret++;
disableNagle(sock_server_tcp_second);
-#ifdef DEBUG
- printf(_("Starting server: \"%s\" on port: \"%d\"\n"), ip6, port6);
-#endif
+
+ DEBUG_MSG(_("Starting server: \"%s\" on port: \"%d\"\n"), ip6, port6);
} else {
-#ifdef DEBUG
- printf(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"),
- ip6, port6);
-#endif
+
+ DEBUG_MSG(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip6, port6);
}
}
@@ -284,20 +278,14 @@ int selectServerTcpSocket()
void quitTcpServer()
{
if (sock_server_tcp != NULL) {
-#ifdef DEBUG
- printf(_("Closing port: \"%d\"\n"), getSockTcpPort(sock_server_tcp));
-#endif
+ DEBUG_MSG(_("Closing port: \"%d\"\n"), getSockTcpPort(sock_server_tcp));
closeTcpSocket(sock_server_tcp);
}
if (sock_server_tcp_second != NULL) {
-#ifdef DEBUG
- printf(_("Closing port: \"%d\"\n"),
- getSockTcpPort(sock_server_tcp_second));
-#endif
+ DEBUG_MSG(_("Closing port: \"%d\"\n"), getSockTcpPort(sock_server_tcp_second));
closeTcpSocket(sock_server_tcp_second);
}
-#ifdef DEBUG
- printf("Quitting TCP\n");
-#endif
+
+ DEBUG_MSG("Quitting TCP\n");
}
diff --git a/src/base/udp_server.c b/src/base/udp_server.c
index c2d6486..a469a3a 100644
--- a/src/base/udp_server.c
+++ b/src/base/udp_server.c
@@ -97,13 +97,9 @@ int initUdpServer(char *ip4, int port4, char *ip6, int port6)
if (sock_server_udp != NULL) {
ret++;
-#ifdef DEBUG
- printf(_("Starting server: \"%s\" on port: \"%d\"\n"), ip4, port4);
-#endif
+ DEBUG_MSG(_("Starting server: \"%s\" on port: \"%d\"\n"), ip4, port4);
} else {
-#ifdef DEBUG
- printf(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip4, port4);
-#endif
+ DEBUG_MSG(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip4, port4);
}
}
@@ -112,13 +108,9 @@ int initUdpServer(char *ip4, int port4, char *ip6, int port6)
if (sock_server_udp_second != NULL) {
ret++;
-#ifdef DEBUG
- printf(_("Starting server: \"%s\" on port: \"%d\"\n"), ip6, port6);
-#endif
+ DEBUG_MSG(_("Starting server: \"%s\" on port: \"%d\"\n"), ip6, port6);
} else {
-#ifdef DEBUG
- printf(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip6, port6);
-#endif
+ DEBUG_MSG(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip6, port6);
}
}
@@ -241,19 +233,14 @@ int selectServerUdpSocket()
void quitUdpServer()
{
if (sock_server_udp != NULL) {
-#ifdef DEBUG
- printf(_("Closing port: \"%d\"\n"), getSockUdpPort(sock_server_udp));
-#endif
+ DEBUG_MSG(_("Closing port: \"%d\"\n"), getSockUdpPort(sock_server_udp));
closeUdpSocket(sock_server_udp);
}
if (sock_server_udp_second != NULL) {
-#ifdef DEBUG
- printf(_("Closing port: \"%d\"\n"), getSockUdpPort(sock_server_udp_second));
-#endif
+ DEBUG_MSG(_("Closing port: \"%d\"\n"), getSockUdpPort(sock_server_udp_second));
closeUdpSocket(sock_server_udp_second);
}
-#ifdef DEBUG
- printf(_("Quitting UDP\n"));
-#endif
+
+ DEBUG_MSG(_("Quitting UDP\n"));
}
diff --git a/src/client/client.c b/src/client/client.c
index 1f309fa..11d8018 100644
--- a/src/client/client.c
+++ b/src/client/client.c
@@ -95,9 +95,9 @@ static int initUdpClient(char *ip, int port, int proto)
if (sock_server_udp == NULL) {
return -1;
}
-#ifdef DEBUG
- printf(_("Connected to: %s on port: %d via UDP\n"), ip, port);
-#endif
+
+ DEBUG_MSG(_("Connected to: %s on port: %d via UDP\n"), ip, port);
+
return 0;
}
@@ -134,8 +134,7 @@ int initClient(char *ip, int port, int proto)
static void errorWithServer()
{
fprintf(stderr, _("Server did not respond!\n"));
- setMsgToAnalyze(_
- ("Server is not running or being blocked. I was unable to connect."));
+ setMsgToAnalyze(_("Server is not running or being blocked. I was unable to connect."));
setWorldEnd();
}
@@ -315,10 +314,9 @@ static void eventTraffic()
if (currentTime - lastTraffic > 5000) {
lastTraffic = currentTime;
-# ifdef DEBUG
- printf(_("down: %d\n")
- _("up : %d\n"), traffic_down, traffic_up);
-# endif
+
+ DEBUG_MSG(_("down: %d\n") _("up : %d\n"), traffic_down, traffic_up);
+
traffic_down = 0;
traffic_up = 0;
}
@@ -342,9 +340,8 @@ static void quitUdpClient()
{
assert(sock_server_udp != NULL);
closeUdpSocket(sock_server_udp);
-#ifdef DEBUG
- printf(_("Closing UDP connection.\n"));
-#endif
+
+ DEBUG_MSG(_("Closing UDP connection.\n"));
}
void quitClient()
diff --git a/src/client/configFile.c b/src/client/configFile.c
index 71f4237..afdbf9f 100644
--- a/src/client/configFile.c
+++ b/src/client/configFile.c
@@ -135,8 +135,7 @@ loadValueFromConfigFile(textFile_t * textFile, char *env, char *val, int len,
sprintf(line, "%s=\"%s\"", env, butVal);
addList(textFile->text, strdup(line));
-#ifdef DEBUG
- printf(_("ADDING: \"%s\" into config file.\n"), line);
-#endif
+
+ DEBUG_MSG(_("ADDING: \"%s\" into config file.\n"), line);
}
}
diff --git a/src/client/font.c b/src/client/font.c
index 8d522b2..3473a1d 100644
--- a/src/client/font.c
+++ b/src/client/font.c
@@ -35,9 +35,9 @@ void initFont(char *file, int size)
TTF_SetFontStyle(g_font, TTF_STYLE_NORMAL);
fontSize = size;
-#ifdef DEBUG
- printf(_("Loading font: \"%s\"\n"), file);
-#endif
+
+ DEBUG_MSG(_("Loading font: \"%s\"\n"), file);
+
isFontInit = TRUE;
}
@@ -129,8 +129,8 @@ void quitFont()
{
TTF_CloseFont(g_font);
TTF_Quit();
-#ifdef DEBUG
- printf(_("Unloading font\n"));
-#endif
+
+ DEBUG_MSG(_("Unloading font\n"));
+
isFontInit = FALSE;
}
diff --git a/src/client/game.c b/src/client/game.c
index d0773a4..e96805b 100644
--- a/src/client/game.c
+++ b/src/client/game.c
@@ -105,9 +105,9 @@ void quitGame()
quitMusic();
quitAudio();
#endif
-#ifdef DEBUG
- printf(_("Quitting TUXANCI...\n"));
-#endif
+
+ DEBUG_MSG(_("Quitting TUXANCI...\n"));
+
exit(0);
}
diff --git a/src/client/image.c b/src/client/image.c
index 38296e7..e5b0c3e 100644
--- a/src/client/image.c
+++ b/src/client/image.c
@@ -25,9 +25,9 @@ bool_t isImageInicialized()
void initImageData()
{
assert(isInterfaceInicialized() == TRUE);
-#ifdef DEBUG
- printf(_("Initializing image database\n"));
-#endif
+
+ DEBUG_MSG(_("Initializing image database\n"));
+
listStorage = newStorage();
isImageDataInit = TRUE;
}
@@ -187,9 +187,9 @@ image_t *addImageData(char *file, int alpha, char *name, char *group)
new = newImage(surface);
addItemToStorage(listStorage, group, name, new);
-#ifdef DEBUG
- printf(_("Loading image %s\n"), file);
-#endif
+
+ DEBUG_MSG(_("Loading image %s\n"), file);
+
return new;
}
@@ -295,9 +295,8 @@ void drawImage(image_t *image, int x,int y, int px, int py, int w, int h)
*/
void quitImageData()
{
-#ifdef DEBUG
- printf(_("Quitting image database\n"));
-#endif
+ DEBUG_MSG(_("Quitting image database\n"));
+
destroyStorage(listStorage, destroyImage);
isImageDataInit = FALSE;
}
diff --git a/src/client/interface.c b/src/client/interface.c
index 4f7b9dc..d64ba36 100644
--- a/src/client/interface.c
+++ b/src/client/interface.c
@@ -121,7 +121,7 @@ SDL_Surface * SetVideoMode(int width, int height, int bpp, Uint32 flags)
int initSDL()
{
#ifdef DEBUG
- printf(_("Initializing SDL system\n"));
+ DEBUG_MSG(_("Initializing SDL system\n"));
#endif
// initialization of SDL
if (SDL_Init(SDL_SUBSYSTEMS) == -1) {
@@ -332,9 +332,8 @@ void eventSDL()
void quitSDL()
{
-#ifdef DEBUG
- printf(_("Quitting SDL\n"));
-#endif
+ DEBUG_MSG(_("Quitting SDL\n"));
+
quitHotKey();
quitKeyboardBuffer();
diff --git a/src/client/saveLoad.c b/src/client/saveLoad.c
index 01f6ea1..b5dbdf2 100644
--- a/src/client/saveLoad.c
+++ b/src/client/saveLoad.c
@@ -81,9 +81,9 @@ void saveArena(char *filename, arena_t * arena)
char path[STR_PATH_SIZE];
sprintf(path, "%s/%s.sav", getHomeDirector(), filename);
-#ifdef DEBUG
- printf(_("Saving game to: \"%s\"\n"), path);
-#endif
+
+ DEBUG_MSG(_("Saving game to: \"%s\"\n"), path);
+
textFile = newTextFile(path);
if (textFile != NULL) {
@@ -247,9 +247,9 @@ void loadArena(char *filename)
char path[STR_PATH_SIZE];
sprintf(path, "%s/%s", getHomeDirector(), filename);
-#ifdef DEBUG
- printf(_("Loadig game from file: \"%s\"\n"), path);
-#endif
+
+ DEBUG_MSG(_("Loadig game from file: \"%s\"\n"), path);
+
textFile = loadTextFile(path);
if (textFile != NULL) {
diff --git a/src/client/screen.c b/src/client/screen.c
index 9f21f6d..52e8e3f 100644
--- a/src/client/screen.c
+++ b/src/client/screen.c
@@ -57,9 +57,9 @@ void destroyScreen(screen_t * p)
void registerScreen(screen_t * p)
{
assert(p != NULL);
-#ifdef DEBUG
- printf(_("Registering screen: \"%s\"\n"), p->name);
-#endif
+
+ DEBUG_MSG(_("Registering screen: \"%s\"\n"), p->name);
+
addList(listScreen, p);
}
@@ -105,9 +105,7 @@ void switchScreen()
flushLayer();
if (currentScreen != NULL) {
-#ifdef DEBUG
- printf(_("Stopping screen: \"%s\"\n"), currentScreen->name);
-#endif
+ DEBUG_MSG(_("Stopping screen: \"%s\"\n"), currentScreen->name);
currentScreen->fce_stop();
}
@@ -115,9 +113,9 @@ void switchScreen()
futureScreen = NULL;
//printf("switch screen %s..\n", currentScreen->name);
-#ifdef DEBUG
- printf(_("Starting screen: \"%s\"\n"), currentScreen->name);
-#endif
+
+ DEBUG_MSG(_("Starting screen: \"%s\"\n"), currentScreen->name);
+
currentScreen->fce_start();
}
diff --git a/src/screen/screen_gameType.c b/src/screen/screen_gameType.c
index 0cf8be0..ccfbe15 100644
--- a/src/screen/screen_gameType.c
+++ b/src/screen/screen_gameType.c
@@ -353,9 +353,9 @@ int getSettingProto()
if (strstr(getTextFromWidgetTextfield(textfield_ip), ":") != NULL) {
return PROTO_UDPv6;
}
-#ifdef DEBUG
- printf(_("Unknown IP protocol!\n"));
-#endif
+
+ DEBUG_MSG(_("Unknown IP protocol!\n"));
+
return -1;
}
diff --git a/src/screen/screen_world.c b/src/screen/screen_world.c
index a2d0baf..08cfa82 100644
--- a/src/screen/screen_world.c
+++ b/src/screen/screen_world.c
@@ -600,8 +600,6 @@ void initWorld()
void quitWorld()
{
-#ifdef DEBUG
- printf(_("Quitting screen world\n"));
-#endif
+ DEBUG_MSG(_("Quitting screen world\n"));
isScreenWorldInit = FALSE;
}
diff --git a/src/server/highScore.c b/src/server/highScore.c
index 37c87b4..89476ff 100644
--- a/src/server/highScore.c
+++ b/src/server/highScore.c
@@ -22,9 +22,8 @@ void initHighScore(char *file)
fprintf(stderr, _("Creating: \"%s\"\n"), file);
textFile = newTextFile(file);
} else {
-#ifdef DEBUG
- printf(_("Scorefile: \"%s\"\n"), file);
-#endif
+
+ DEBUG_MSG(_("Scorefile: \"%s\"\n"), file);
return;
}
diff --git a/src/server/log.c b/src/server/log.c
index 207da2a..67a25f8 100644
--- a/src/server/log.c
+++ b/src/server/log.c
@@ -19,9 +19,9 @@ int initLog(char *name)
fprintf(stderr, _("Opening logfile \"%s\" failed!\n"), name);
return -1;
}
-#ifdef DEBUG
- printf(_("I use logfile: \"%s\")\n"), name);
-#endif
+
+ DEBUG_MSG(_("I use logfile: \"%s\")\n"), name);
+
addToLog(LOG_INF, "open log file");
return 0;
diff --git a/src/server/publicServer.c b/src/server/publicServer.c
index 25751e9..21f2891 100644
--- a/src/server/publicServer.c
+++ b/src/server/publicServer.c
@@ -312,17 +312,15 @@ void eventPublicServer()
void my_handler_quit(int n)
{
-#ifdef DEBUG
- printf("my_handler_quit\n");
-#endif
+ DEBUG_MSG("my_handler_quit\n");
+
isSignalEnd = TRUE;
}
void quitPublicServer()
{
-#ifdef DEBUG
- printf(_("Quitting public server\n"));
-#endif
+ DEBUG_MSG(_("Quitting public server\n"));
+
quitNetMultiplayer();
destroyArena(arena);
diff --git a/src/widget/widget_button.c b/src/widget/widget_button.c
index d02a568..dbd7aa5 100644
--- a/src/widget/widget_button.c
+++ b/src/widget/widget_button.c
@@ -86,9 +86,9 @@ void eventWidgetButton(widget_t * widget)
y >= widget->y && y <= widget->y + WIDGET_BUTTON_HEIGHT &&
isMouseClicked()) {
time = WIDGET_BUTTON_TIME;
-#ifdef DEBUG
- printf(_("Event caught\n"));
-#endif
+
+ DEBUG_MSG(_("Event caught\n"));
+
p->fce_event(widget);
}
}