summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorMichal Zima <xhire@mujmalysvet.cz>2009-12-06 22:58:26 +0100
committerMichal Zima <xhire@mujmalysvet.cz>2009-12-06 22:58:26 +0100
commit753131cf9b32315fdd11f2ce6e58b8f2d6ba3bc1 (patch)
treecfbded574ded7c3c666de6211877469ff6a95d75 /src/client
parenta0939379bb1185ee6d66739d9d021466d5d89624 (diff)
Revised methods how are translated strings handled
Few comments were made available to Doxygen
Diffstat (limited to 'src/client')
-rw-r--r--src/client/client.c15
-rw-r--r--src/client/config.c6
-rw-r--r--src/client/configFile.c2
-rw-r--r--src/client/font.c8
-rw-r--r--src/client/fontConfig.c2
-rw-r--r--src/client/game.c2
-rw-r--r--src/client/hotKey.c6
-rw-r--r--src/client/image.c10
-rw-r--r--src/client/interface.c32
-rw-r--r--src/client/keyboardBuffer.c6
-rw-r--r--src/client/saveLoad.c8
-rw-r--r--src/client/screen.c6
12 files changed, 51 insertions, 52 deletions
diff --git a/src/client/client.c b/src/client/client.c
index 13d9964..054b3ea 100644
--- a/src/client/client.c
+++ b/src/client/client.c
@@ -95,7 +95,7 @@ static int initUdpClient(char *ip, int port)
return -1;
}
- DEBUG_MSG(_("[Debug] Connected to game server [%s]:[%d]\n"), ip, port);
+ debug("Connected to game server [%s]:[%d]", ip, port);
return 0;
}
@@ -132,8 +132,8 @@ int client_init(char *ip, int port)
static void errorWithServer()
{
- fprintf(stderr, _("[Error] Game server is not responding\n"));
- analyze_set_msg(_("[Error] Unable to connect to the game server"));
+ error("Game server is not responding");
+ analyze_set_msg(_("Unable to connect to the game server"));
world_do_end();
}
@@ -146,7 +146,7 @@ void client_send(char *msg)
ret = -1;
if (isParamFlag("--send")) {
- printf(_("[Debug] Sending data: %s"), msg);
+ debug("Sending data: %s", msg);
}
#ifdef SUPPORT_TRAFFIC
@@ -204,7 +204,7 @@ static void client_eventWorkRecvList()
protoCmd = findCmdProto(line);
if (isParamFlag("--recv")) {
- printf(_("[Debug] Recieved data: %s"), line);
+ debug("Recieved data: %s", line);
}
if (protoCmd != NULL) {
@@ -295,7 +295,7 @@ static void eventTraffic()
if (currentTime - lastTraffic > 5000) {
lastTraffic = currentTime;
- DEBUG_MSG(_("[Debug] Traffic: down [%d]/up [%d]\n"), traffic_down, traffic_up);
+ debug("Traffic: down [%d]/up [%d]", traffic_down, traffic_up);
traffic_down = 0;
traffic_up = 0;
@@ -312,7 +312,6 @@ void client_event()
eventPingServer();
selectClientSocket();
client_eventWorkRecvList();
-
}
static void quitUdpClient()
@@ -320,7 +319,7 @@ static void quitUdpClient()
assert(sock_server_udp != NULL);
sock_udp_close(sock_server_udp);
- DEBUG_MSG(_("[Debug] Closing connection to game server\n"));
+ debug("Closing connection to game server");
}
void client_quit()
diff --git a/src/client/config.c b/src/client/config.c
index c9cb33d..48496df 100644
--- a/src/client/config.c
+++ b/src/client/config.c
@@ -108,14 +108,14 @@ void config_load()
config_file = text_file_load(path);
if (config_file == NULL) {
- fprintf(stderr, _("[Error] Unable to load config file [%s]\n"), path);
- fprintf(stderr, _("[Debug] Creating config file [%s]\n"), path);
+ error("Unable to load config file [%s]", path);
+ debug("Creating config file [%s]", path);
config_file = text_file_new(path);
}
if (config_file == NULL) {
- fprintf(stderr, _("[Error] Unable to create config file [%s]\n"), path);
+ error("Unable to create config file [%s]", path);
return;
}
diff --git a/src/client/configFile.c b/src/client/configFile.c
index 227f5d5..9d6d65b 100644
--- a/src/client/configFile.c
+++ b/src/client/configFile.c
@@ -147,6 +147,6 @@ void loadValueFromConfigFile(textFile_t * textFile, char *env, char *val, int le
sprintf(line, "%s=\"%s\"", env, butVal);
list_add(textFile->text, strdup(line));
- DEBUG_MSG(_("[Debug] Expanding config file [%s]\n"), line);
+ debug("Expanding config file [%s]", line);
}
}
diff --git a/src/client/font.c b/src/client/font.c
index a880dab..d052cbb 100644
--- a/src/client/font.c
+++ b/src/client/font.c
@@ -38,7 +38,7 @@ void font_init()
}
*/
if (font_list == NULL) {
- fprintf(stderr, _("[Error] Unable to locate a font\n"));
+ error("Unable to locate a font");
return;
}
@@ -50,7 +50,7 @@ void font_init()
if (TTF_Init() == -1) {
free(font_file);
- fprintf(stderr, "%s\n", SDL_GetError());
+ error("SDL: %s", SDL_GetError());
return;
}
@@ -59,7 +59,7 @@ void font_init()
g_font = TTF_OpenFont(font_file, fontSize);
TTF_SetFontStyle(g_font, TTF_STYLE_NORMAL);
- DEBUG_MSG(_("[Debug] Loading font [%s]\n"), font_file);
+ debug("Loading font [%s]", font_file);
free(font_file);
isFontInit = TRUE;
@@ -150,7 +150,7 @@ void font_quit()
TTF_CloseFont(g_font);
TTF_Quit();
- DEBUG_MSG(_("[Debug] Unloading font\n"));
+ debug("Unloading font");
isFontInit = FALSE;
}
diff --git a/src/client/fontConfig.c b/src/client/fontConfig.c
index 3b73df8..b0e0741 100644
--- a/src/client/fontConfig.c
+++ b/src/client/fontConfig.c
@@ -14,7 +14,7 @@ int fontconfig_init()
res = FcInit();
if (res == 0) {
- fprintf(stderr, _("[Error] Unable to init fontconfig library\n"));
+ error("Unable to init fontconfig library");
return 1;
}
diff --git a/src/client/game.c b/src/client/game.c
index 07079b6..2481cee 100644
--- a/src/client/game.c
+++ b/src/client/game.c
@@ -111,7 +111,7 @@ void game_quit()
audio_quit();
#endif /* NO_SOUND */
- DEBUG_MSG(_("[Debug] Shutting down the game\n"));
+ debug("Shutting down the game");
exit(0);
}
diff --git a/src/client/hotKey.c b/src/client/hotKey.c
index b09b344..5471101 100644
--- a/src/client/hotKey.c
+++ b/src/client/hotKey.c
@@ -78,7 +78,7 @@ void hot_key_unregister(SDLKey key)
hotkey = findHotkey(key);
if (hotkey == NULL) {
- assert(!_("[Error] Unregistering not registered hotkey"));
+ fatal("Unregistering not registered hotkey");
}
my_index = list_search(listHotKey, hotkey);
@@ -93,7 +93,7 @@ void hot_key_enable(SDLKey key)
hotkey = findHotkey(key);
if (hotkey == NULL) {
- assert(!_("[Error] Enabling not registered hotkey"));
+ fatal("Enabling not registered hotkey");
}
lastActive = timer_get_current_time();
@@ -107,7 +107,7 @@ void hot_key_disable(SDLKey key)
hotkey = findHotkey(key);
if (hotkey == NULL) {
- assert(!_("[Error] Disabling not registered hotkey"));
+ fatal("Disabling not registered hotkey");
}
lastActive = timer_get_current_time();
diff --git a/src/client/image.c b/src/client/image.c
index 4fb033a..cdd7c9b 100644
--- a/src/client/image.c
+++ b/src/client/image.c
@@ -25,7 +25,7 @@ void image_init()
{
assert(interface_is_inicialized() == TRUE);
- DEBUG_MSG(_("[Debug] Initializing image database\n"));
+ debug("Initializing image database");
listStorage = storage_new();
isImageDataInit = TRUE;
@@ -47,12 +47,12 @@ static SDL_Surface *loadImage(const char *filename, int alpha)
accessExistFile(str);
if ((tmp = IMG_Load(str)) == NULL) {
- fprintf(stderr, "%s\n", SDL_GetError());
+ error("SDL: %s", SDL_GetError());
return NULL;
}
if ((ret = (alpha) ? SDL_DisplayFormatAlpha(tmp) : SDL_DisplayFormat(tmp)) == NULL) {
- fprintf(stderr, "%s\n", SDL_GetError());
+ error("SDL: %s", SDL_GetError());
SDL_FreeSurface(tmp);
return NULL;
}
@@ -197,7 +197,7 @@ image_t *image_add(char *file, int alpha, char *name, char *group)
storage_add(listStorage, group, name, new);
- DEBUG_MSG(_("[Debug] Loading image [%s]\n"), file);
+ debug("Loading image [%s]", file);
return new;
}
@@ -316,7 +316,7 @@ void image_draw(image_t *image, int x,int y, int px, int py, int w, int h)
*/
void image_quit()
{
- DEBUG_MSG(_("[Debug] Shutting down image database\n"));
+ debug("Shutting down image database");
storage_destroy(listStorage, image_destroy);
isImageDataInit = FALSE;
diff --git a/src/client/interface.c b/src/client/interface.c
index 01fe241..59b39e0 100644
--- a/src/client/interface.c
+++ b/src/client/interface.c
@@ -63,21 +63,20 @@ void hotkey_screen()
}
if (SDL_WM_ToggleFullScreen(screen) == 0) {
- fprintf(stderr, _("[Error] Unable to switch to the fullscreen mode\n"));
+ error("Unable to switch to the fullscreen mode");
SDL_FreeSurface(screen);
screen = SDL_SetVideoMode(WINDOW_SIZE_X, WINDOW_SIZE_Y, WIN_BPP, g_win_flags);
if (screen == NULL) {
- fprintf(stderr, _("[Error] Unable to switch to the window mode: %s\n"),
- SDL_GetError());
+ error("Unable to switch to the window mode: %s", SDL_GetError());
return;
}
}
}
#ifdef SUPPORT_OPENGL
-/*
+/**
* Sets video mode and sets up OpenGL for this change
*/
SDL_Surface *SetVideoMode(int width, int height, int bpp, Uint32 flags)
@@ -116,11 +115,11 @@ SDL_Surface *SetVideoMode(int width, int height, int bpp, Uint32 flags)
int interface_init()
{
- DEBUG_MSG(_("[Debug] Initializing SDL\n"));
+ debug("Initializing SDL");
/* initialization of SDL */
if (SDL_Init(SDL_SUBSYSTEMS) == -1) {
- fprintf(stderr, _("[Error] Unable to initialize SDL: %s\n"), SDL_GetError());
+ error("Unable to initialize SDL: %s", SDL_GetError());
SDL_Quit();
return -1;
}
@@ -150,14 +149,14 @@ int interface_init()
#endif /* SUPPORT_OPENGL */
if (screen == NULL) {
- fprintf(stderr, _("[Error] Unable to create interface: %s\n"), SDL_GetError());
+ error("Unable to create interface: %s", SDL_GetError());
SDL_Quit();
return -1;
}
- /*
- * enable unicode by default for keyboard support - it is bit more
+ /**
+ * enable unicode by default for keyboard support - it is a bit more
* consuming than the nonsdl but can draw more characters
- */
+ */
SDL_EnableUNICODE(1);
SDL_WM_SetCaption(WINDOW_TITLE, NULL);
@@ -212,10 +211,11 @@ int interface_is_press_any_key()
mapa = SDL_GetKeyState(NULL);
- for (i = SDLK_BACKSPACE; i < SDLK_KP9; i++)
+ for (i = SDLK_BACKSPACE; i < SDLK_KP9; i++) {
if (mapa[i] == SDL_PRESSED) {
return 1;
}
+ }
return 0;
}
@@ -227,10 +227,11 @@ void printPressAnyKey()
mapa = SDL_GetKeyState(NULL);
- for (i = SDLK_BACKSPACE; i < SDLK_KP9; i++)
+ for (i = SDLK_BACKSPACE; i < SDLK_KP9; i++) {
if (mapa[i] == SDL_PRESSED) {
- printf(_("[Debug] Pressed key [SDL: %d]\n"), i);
+ debug("Pressed key [SDL: %d]", i);
}
+ }
}
@@ -318,8 +319,7 @@ int eventAction()
WIN_BPP, g_win_flags);
if (screen == NULL) {
- fprintf(stderr, _("[Error] Unable to change resolution of the window: %s\n"),
- SDL_GetError());
+ error("Unable to change resolution of the window: %s", SDL_GetError());
return 0;
}
break;
@@ -348,7 +348,7 @@ void interface_event()
void interface_quit()
{
- DEBUG_MSG(_("[Debug] Shutting down SDL\n"));
+ debug("Shutting down SDL");
hot_key_quit();
keyboard_buffer_quit();
diff --git a/src/client/keyboardBuffer.c b/src/client/keyboardBuffer.c
index 8849414..129389f 100644
--- a/src/client/keyboardBuffer.c
+++ b/src/client/keyboardBuffer.c
@@ -57,7 +57,7 @@ bool_t keyboard_buffer_push(SDL_keysym key)
assert(keyboardBuffer != NULL);
if (keyboardBuffer->count >= keyboardBuffer->size) {
- fprintf(stderr, _("[Error] Keyboard buffer overrun - dropping the key [%02x]\n"), key.sym);
+ error("Keyboard buffer overrun - dropping the key [%02x]", key.sym);
return FALSE;
}
@@ -82,7 +82,7 @@ SDL_keysym keyboard_buffer_pop()
assert(keyboardBuffer != NULL);
if (keyboardBuffer->count <= 0) {
- fprintf(stderr, _("[Error] Keyboard buffer underrun\n"));
+ error("Keyboard buffer underrun");
return emptyKey;
}
@@ -133,7 +133,7 @@ void keyboard_buffer_quit()
assert(keyboardBuffer != NULL);
if (keyboardBuffer->count > 0) {
- fprintf(stderr, _("[Warning] Shutting down non-empty keyboard buffer\n"));
+ warning("Shutting down non-empty keyboard buffer");
}
free(keyboardBuffer->buff);
diff --git a/src/client/saveLoad.c b/src/client/saveLoad.c
index f7970e5..5328401 100644
--- a/src/client/saveLoad.c
+++ b/src/client/saveLoad.c
@@ -85,7 +85,7 @@ void save_arena(char *filename, arena_t *arena)
sprintf(path, "%s/%s.sav", home_director_get(), filename);
- DEBUG_MSG(_("[Debug] Saving game [%s]\n"), path);
+ debug("Saving game [%s]", path);
textFile = text_file_new(path);
@@ -94,7 +94,7 @@ void save_arena(char *filename, arena_t *arena)
text_file_save(textFile);
text_file_destroy(textFile);
} else {
- fprintf(stderr, _("[Error] Unable to save game [%s]\n"), path);
+ error("Unable to save game [%s]", path);
}
}
@@ -251,7 +251,7 @@ void load_arena(char *filename)
sprintf(path, "%s/%s", home_director_get(), filename);
- DEBUG_MSG(_("[Debug] Loading arena [%s]\n"), path);
+ debug("Loading arena [%s]", path);
textFile = text_file_load(path);
@@ -259,6 +259,6 @@ void load_arena(char *filename)
loadContextArenaFromTextFile(textFile);
text_file_destroy(textFile);
} else {
- fprintf(stderr, _("[Error] Unable to load saved game [%s]\n"), path);
+ error("Unable to load saved game [%s]", path);
}
}
diff --git a/src/client/screen.c b/src/client/screen.c
index 2e8822d..476cf3e 100644
--- a/src/client/screen.c
+++ b/src/client/screen.c
@@ -56,7 +56,7 @@ void screen_register(screen_t *p)
{
assert(p != NULL);
- DEBUG_MSG(_("[Debug] Registering screen [%s]\n"), p->name);
+ debug("Registering screen [%s]", p->name);
list_add(listScreen, p);
}
@@ -103,14 +103,14 @@ void screen_switch()
layer_flush();
if (currentScreen != NULL) {
- DEBUG_MSG(_("[Debug] Stopping screen [%s]\n"), currentScreen->name);
+ debug("Stopping screen [%s]", currentScreen->name);
currentScreen->fce_stop();
}
currentScreen = futureScreen;
futureScreen = NULL;
- DEBUG_MSG(_("[Debug] Starting screen [%s]\n"), currentScreen->name);
+ debug("Starting screen [%s]", currentScreen->name);
currentScreen->fce_start();
}