diff options
| author | Dusan Durech <dusan.d@centrum.sk> | 2008-11-14 16:38:41 +0100 |
|---|---|---|
| committer | Dusan Durech <dusan.d@centrum.sk> | 2008-11-14 16:38:41 +0100 |
| commit | 98875c5a636f50fe89b9394b8193e86094ae14e0 (patch) | |
| tree | 305f1a3c884763aff65f8bcd12ff9d2f648a04cd /src/client | |
| parent | 957f3411170ca1d5f30ee2e2c4e25393195cce75 (diff) | |
uses new macro DEBUG_MSG
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/client.c | 21 | ||||
| -rw-r--r-- | src/client/configFile.c | 5 | ||||
| -rw-r--r-- | src/client/font.c | 12 | ||||
| -rw-r--r-- | src/client/game.c | 6 | ||||
| -rw-r--r-- | src/client/image.c | 17 | ||||
| -rw-r--r-- | src/client/interface.c | 7 | ||||
| -rw-r--r-- | src/client/saveLoad.c | 12 | ||||
| -rw-r--r-- | src/client/screen.c | 16 |
8 files changed, 44 insertions, 52 deletions
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(); } |