summaryrefslogtreecommitdiff
path: root/src/base
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/base
parenta0939379bb1185ee6d66739d9d021466d5d89624 (diff)
Revised methods how are translated strings handled
Few comments were made available to Doxygen
Diffstat (limited to 'src/base')
-rw-r--r--src/base/archive.c6
-rw-r--r--src/base/arena.c8
-rw-r--r--src/base/arenaFile.c8
-rw-r--r--src/base/checkFront.c2
-rw-r--r--src/base/downServer.c2
-rw-r--r--src/base/gun.c2
-rw-r--r--src/base/homeDirector.c6
-rw-r--r--src/base/idManager.c14
-rw-r--r--src/base/index.c10
-rw-r--r--src/base/main.c8
-rw-r--r--src/base/modules.c16
-rw-r--r--src/base/msg.h6
-rw-r--r--src/base/myTimer.c4
-rw-r--r--src/base/net_multiplayer.c12
-rw-r--r--src/base/proto.c4
-rw-r--r--src/base/server.c4
-rw-r--r--src/base/serverSendMsg.c2
-rw-r--r--src/base/shareFunction.c2
-rw-r--r--src/base/shot.c2
-rw-r--r--src/base/space.c2
-rw-r--r--src/base/storage.c2
-rw-r--r--src/base/textFile.c16
-rw-r--r--src/base/tux.c4
-rw-r--r--src/base/udp_server.c16
24 files changed, 76 insertions, 82 deletions
diff --git a/src/base/archive.c b/src/base/archive.c
index 30956a0..5e2c25a 100644
--- a/src/base/archive.c
+++ b/src/base/archive.c
@@ -29,20 +29,20 @@ char *archive_extract_file(char *archive, char *filename)
zipArchive = zip_open(archive, 0, &err);
if (zipArchive == NULL) {
- fprintf(stderr, _("[Error] Unable to open archive [%s]\n"), archive);
+ error("Unable to open archive [%s]", archive);
return NULL;
}
zipFile = zip_fopen(zipArchive, filename, ZIP_FL_UNCHANGED);
if (zipFile == NULL) {
- fprintf(stderr, _("[Error] Unable to extract the file [%s] from archive [%s]\n"), filename, archive);
+ error("Unable to extract the file [%s] from archive [%s]", filename, archive);
zip_close(zipArchive);
return NULL;
}
if ((file = fopen(name, "wb")) == NULL) {
- fprintf(stderr, _("[Error] Unable to create temporary file [%s]\n"), name);
+ error("Unable to create temporary file [%s]", name);
zip_fclose(zipFile);
zip_close(zipArchive);
return NULL;
diff --git a/src/base/arena.c b/src/base/arena.c
index e26eb6c..89b8e05 100644
--- a/src/base/arena.c
+++ b/src/base/arena.c
@@ -68,12 +68,12 @@ void arena_init()
if (getParam("--split-vertical")) {
splitType = SCREEN_SPLIT_VERTICAL;
- printf(_("[Debug] Set vertical screen splitting\n"));
+ debug("Set vertical screen splitting");
}
if (getParam("--split-horizontal")) {
splitType = SCREEN_SPLIT_HORIZONTAL;
- printf(_("[Debug] Set horizontal screen splitting\n"));
+ debug("Set horizontal screen splitting");
}
hot_key_register(SDLK_F3, hotkey_splitArena);
@@ -268,7 +268,7 @@ static void drawSplitArenaForTux(arena_t *arena, tux_t *tux, int location_x, int
default:
screen_x = -1;
screen_y = -1;
- assert(!_("[Error] Unknown method of splitting the screen"));
+ fatal("Unknown method of splitting the screen");
break;
}
@@ -285,7 +285,7 @@ static void drawSplitArenaForTux(arena_t *arena, tux_t *tux, int location_x, int
default:
screen_x = -1;
screen_y = -1;
- assert(!_("[Error] Unknown method of splitting the screen"));
+ fatal("Unknown method of splitting the screen");
break;
}
}
diff --git a/src/base/arenaFile.c b/src/base/arenaFile.c
index da2d09f..e5a17ae 100644
--- a/src/base/arenaFile.c
+++ b/src/base/arenaFile.c
@@ -128,7 +128,7 @@ static void cmd_arena(arena_t **arena, char *line)
*/
arena_set_current(*arena);
- DEBUG_MSG(_("[Debug] Arena loaded\n"));
+ debug("Arena loaded");
}
static void cmd_module_load(char *line)
@@ -354,11 +354,11 @@ static void load_arenaFromDirector(char *director)
director_t *p;
int i;
- DEBUG_MSG(_("[Debug] Loading arena files [%s]\n"), director);
+ debug("Loading arena files [%s]", director);
p = director_load(director);
if (p == NULL) {
- fprintf(stderr, _("[Error] Directory not found [%s]\n"), director);
+ error("Directory not found [%s]", director);
exit(-1);
}
@@ -376,7 +376,7 @@ static void load_arenaFromDirector(char *director)
sprintf(path, "%s/%s", director, line);
}
- DEBUG_MSG(_("[Debug] Loading arena [%s]\n"), line);
+ debug("Loading arena [%s]", line);
accessExistFile(path);
arena_file_load(path);
diff --git a/src/base/checkFront.c b/src/base/checkFront.c
index a8218de..999eb58 100644
--- a/src/base/checkFront.c
+++ b/src/base/checkFront.c
@@ -87,7 +87,7 @@ void check_front_event(client_t *client)
}
break;
default:
- assert(!_("[Error] Wrong type of the event front"));
+ fatal("Wrong type of the event front");
break;
}
}
diff --git a/src/base/downServer.c b/src/base/downServer.c
index 3015214..5556fc6 100644
--- a/src/base/downServer.c
+++ b/src/base/downServer.c
@@ -123,7 +123,7 @@ int down_server_init(char *ip4, int port4)
sock_server_tcp = sock_tcp_bind(ip4, port4);
if (sock_server_tcp == NULL) {
- fprintf(stderr, _("[Error] Unable to initialize download server\n"));
+ error("Unable to initialize download server");
return -1;
}
diff --git a/src/base/gun.c b/src/base/gun.c
index d0bfe86..9c59662 100644
--- a/src/base/gun.c
+++ b/src/base/gun.c
@@ -47,7 +47,7 @@ static void modificiationCopuse(int courser, int right_x, int right_y, int *dest
*dest_y = right_x;
break;
default:
- assert(!_("[Debug] Wrong Tux course change"));
+ fatal("Wrong Tux course change");
break;
}
}
diff --git a/src/base/homeDirector.c b/src/base/homeDirector.c
index f0083ba..c9daf3d 100644
--- a/src/base/homeDirector.c
+++ b/src/base/homeDirector.c
@@ -18,21 +18,21 @@ void home_director_create()
envHome = getenv("USERPROFILE");
#endif /* __WIN32__ */
if (envHome == NULL) {
- fprintf(stderr, _("[Error] Environment variable HOME not found\n"));
+ error("Environment variable HOME not found");
exit(0);
}
sprintf(homeDirector, "%s/%s", envHome, HOMEDIRECTOR_NAME);
if (access(homeDirector, F_OK) != 0) {
- DEBUG_MSG(_("[Debug] Creating home directory [%s]\n"), homeDirector);
+ debug("Creating home directory [%s]", homeDirector);
#ifndef __WIN32__
if (mkdir(homeDirector, 0755) != 0) {
#else /* __WIN32__ */
if (mkdir(homeDirector) != 0) {
#endif /* __WIN32__ */
- fprintf(stderr, _("[Error] Unable to create home directory [%s]\n"), homeDirector);
+ error("Unable to create home directory [%s]", homeDirector);
exit(0);
}
}
diff --git a/src/base/idManager.c b/src/base/idManager.c
index dea2e95..87042bb 100644
--- a/src/base/idManager.c
+++ b/src/base/idManager.c
@@ -34,7 +34,7 @@ static void destroyIdItem(id_item_t *p)
void id_init_list()
{
- DEBUG_MSG(_("[Debug] Initializing ID manager\n"));
+ debug("Initializing ID manager");
listID = list_new();
lastID = 0;
@@ -67,7 +67,7 @@ static int findNewID()
assert(listID != NULL);
if (listID->count >= MAX_ID - 1) {
- assert(!_("[Error] There is no free ID left"));
+ fatal("There is no free ID left");
}
do {
@@ -106,7 +106,7 @@ void id_inc(int id)
index = id_is_register(id);
if (index == -1) {
- fprintf(stderr, _("[Error] Trying to increment counter of never registered ID [%d]"), id);
+ error("Trying to increment counter of never registered ID [%d]", id);
assert(0);
return; /* ha ha ha */
}
@@ -129,7 +129,7 @@ void id_del(int id)
index = id_is_register(id);
if (index == -1) {
- fprintf(stderr, _("[Error] Trying to delete never registered ID [%d]"), id);
+ error("Trying to delete never registered ID [%d]", id);
assert(0);
return; /* ha ha ha */
}
@@ -177,21 +177,21 @@ void infoID(int id)
index = id_is_register(id);
if (index == -1) {
- DEBUG_MSG(_("[Debug] Getting information of nonexistent ID [%d]\n"), id);
+ debug("Getting information of nonexistent ID [%d]", id);
return;
}
this = listID->list[index];
- DEBUG_MSG(_("[Debug] ID information [%d]: used %d times\n"), this->id, this->count);
+ debug("ID information [%d]: used %d times", this->id, this->count);
return;
}
void id_quit_list()
{
- DEBUG_MSG(_("[Debug] Shutting down ID manager\n"));
+ debug("Shutting down ID manager");
assert(listID != NULL);
list_destroy_item(listID, destroyIdItem);
diff --git a/src/base/index.c b/src/base/index.c
index 6683ec8..1620591 100644
--- a/src/base/index.c
+++ b/src/base/index.c
@@ -23,14 +23,14 @@ static index_item_t *index_item_new(int key, void *data)
#ifdef DEBUG_INDEX
static void printIndexItem(index_item_t *p)
{
- printf(_("[Debug] Index [%d] contains: %p\n"), p->key, p->data);
+ debug("Index [%d] contains: %p", p->key, p->data);
}
static void printListIndexItem(list_t *list)
{
int i;
- printf(_("List:\n"));
+ debug("List:");
for (i = 0; i < list->count; i++) {
index_item_t *this;
@@ -60,7 +60,7 @@ static void checkList(list_t *list)
if (prev >= this) {
printListIndexItem(list);
- assert(!_("Error"));
+ fatal("Error in list");
}
prev = this;
@@ -100,10 +100,10 @@ void index_add(list_t *list, int key, void *data)
#ifdef DEBUG_INDEX
if (++count == len * 5) {
- printf(_("[Error] Cyclic error\n"));
+ error("Cyclic error");
printIndexItem(item);
printListIndexItem(list);
- assert(0);
+ abort(0);
}
#endif /* DEBUG_INDEX */
diff --git a/src/base/main.c b/src/base/main.c
index d854a33..cfd13af 100644
--- a/src/base/main.c
+++ b/src/base/main.c
@@ -99,8 +99,8 @@ int *newInt(int x)
void accessExistFile(const char *s)
{
if (access(s, F_OK) != 0) {
- fprintf(stderr, _("[Error] File not found [%s]\n"), s);
- fprintf(stderr, _("[Error] Shutting down the game\n"));
+ error("File not found [%s]", s);
+ error("Shutting down the game");
exit(-1);
}
}
@@ -165,8 +165,8 @@ int main(int argc, char *argv[])
/* let's initialize WinSock */
if (WSAStartup(wVersionRequested, &data) != 0) {
- fprintf(stderr, _("[Error] Initialization of WinSock failed\n"));
- fprintf(stderr, _("[Error] Shutting down the game\n"));
+ error("Initialization of WinSock failed");
+ error("Shutting down the game");
exit(-1);
}
#endif /* __WIN32__ */
diff --git a/src/base/modules.c b/src/base/modules.c
index aace319..349ca8a 100644
--- a/src/base/modules.c
+++ b/src/base/modules.c
@@ -67,13 +67,13 @@ static void *getFce(module_t *p, char *s)
ret = dlsym(p->image, s);
if ((error = dlerror()) != NULL) {
- fprintf(stderr, _("[Error] Use of getFce function failed: %s\n"), error);
+ error("Use of getFce function failed: %s", error);
return NULL;
}
#else /* __WIN32__ */
FARPROC ret = GetProcAddress((HMODULE) p->image, (LPCSTR) s);
if (!ret) {
- fprintf(stderr, _("[Error] Use of getFce function failed: %s\n"), s);
+ error("Use of getFce function failed: %s", s);
}
#endif /* __WIN32__ */
@@ -144,7 +144,7 @@ static module_t *newModule(char *name)
image = mapImage(path);
if (image == NULL) {
- fprintf(stderr, _("[Error] Unable to map image of new module [%s]\n"), name);
+ error("Unable to map image of new module [%s]", name);
return NULL;
}
@@ -161,10 +161,10 @@ static module_t *newModule(char *name)
ret->fce_cmd = getFce(ret, "cmdArena");
ret->fce_recvMsg = getFce(ret, "recvMsg");
- DEBUG_MSG(_("[Debug] Loading module [%s]\n"), name);
+ debug("Loading module [%s]", name);
if (ret->fce_init(&export_fce) != 0) {
- fprintf(stderr, _("[Error] Unable to load module [%s]\n"), name);
+ error("Unable to load module [%s]", name);
unmapImage(image);
free(ret->name);
free(ret);
@@ -178,7 +178,7 @@ static int destroyModule(module_t *p)
{
assert(p != NULL);
- DEBUG_MSG(_("[Debug] Unloading module [%s]\n"), p->name);
+ debug("Unloading module [%s]", p->name);
p->fce_destroy();
unmapImage(p->image);
@@ -216,14 +216,14 @@ int module_load(char *name)
module_t *module;
if (isModuleLoaded(name)) {
- fprintf(stderr, ("[Error] Unable to load already loaded module [%s]\n"), name);
+ error("Unable to load already loaded module [%s]", name);
return -1;
}
module = newModule(name);
if (module == NULL) {
- fprintf(stderr, _("[Error] Unable to load module [%s]\n"), name);
+ error("Unable to load module [%s]", name);
return -1;
}
diff --git a/src/base/msg.h b/src/base/msg.h
index a2f77e9..e9bdb3b 100644
--- a/src/base/msg.h
+++ b/src/base/msg.h
@@ -2,12 +2,6 @@
#define MSG_H
#ifdef DEBUG
-#define DEBUG_MSG(msg,arg...) printf(msg, ##arg)
-#else /* DEBUG */
-#define DEBUG_MSG(msg,arg...)
-#endif /* DEBUG * */
-
-#ifdef DEBUG
#define debug(msg,arg...) fprintf(stdout, "%s ", _("[Debug]")); fprintf(stdout, _(msg), ##arg); fprintf(stdout, "\n")
#else /* DEBUG */
#define debug(msg,arg...)
diff --git a/src/base/myTimer.c b/src/base/myTimer.c
index e2b7fbd..5015cc6 100644
--- a/src/base/myTimer.c
+++ b/src/base/myTimer.c
@@ -124,7 +124,7 @@ void timer_event(list_t *listTimer)
}
break;
default:
- assert(!_("[Error] Bad setting of the timer"));
+ fatal("Bad setting of the timer");
break;
}
}
@@ -146,7 +146,7 @@ void timer_del(list_t *listTimer, int id)
}
}
- fprintf(stderr, _("[Error] Unable to delete event from the timer as it is not present in it [%d]\n"), id);
+ error("Unable to delete event from the timer as it is not present in it [%d]", id);
assert(0);
}
diff --git a/src/base/net_multiplayer.c b/src/base/net_multiplayer.c
index 43abf7c..fc142da 100644
--- a/src/base/net_multiplayer.c
+++ b/src/base/net_multiplayer.c
@@ -54,7 +54,7 @@ int net_multiplayer_init(int type, char *ip, int port, int proto)
switch (proto) {
case PROTO_UDPv4:
if (server_init(ip, port, NULL, 0) != 1) {
- fprintf(stderr, _("[Error] Unable to initialize multiplayer game\n"));
+ error("Unable to initialize multiplayer game");
netGameType = NET_GAME_TYPE_NONE;
return -1;
}
@@ -62,7 +62,7 @@ int net_multiplayer_init(int type, char *ip, int port, int proto)
case PROTO_UDPv6:
if (server_init(NULL, 0, ip, port) != 1) {
- fprintf(stderr, _("[Error] Unable to initialize multiplayer game\n"));
+ error("Unable to initialize multiplayer game");
netGameType = NET_GAME_TYPE_NONE;
return -1;
}
@@ -73,7 +73,7 @@ int net_multiplayer_init(int type, char *ip, int port, int proto)
#ifndef PUBLIC_SERVER
case NET_GAME_TYPE_CLIENT:
if (client_init(ip, port) != 0) {
- fprintf(stderr, _("[Error] Unable to join multiplayer game\n"));
+ error("Unable to join multiplayer game");
netGameType = NET_GAME_TYPE_NONE;
return -1;
}
@@ -81,7 +81,7 @@ int net_multiplayer_init(int type, char *ip, int port, int proto)
#endif /* PUBLIC_SERVER */
default:
- fprintf(stderr, _("[Error] Unknown type of the network game [%d]\n"), netGameType);
+ error("Unknown type of the network game [%d]", netGameType);
assert(0);
break;
}
@@ -106,7 +106,7 @@ void net_multiplayer_event()
#endif /* PUBLIC_SERVER */
default:
- fprintf(stderr, _("[Error] Unknown type of the network game [%d]\n"), netGameType);
+ error("Unknown type of the network game [%d]", netGameType);
assert(0);
break;
}
@@ -129,7 +129,7 @@ void net_multiplayer_quit()
#endif /* PUBLIC_SERVER */
default:
- fprintf(stderr, _("[Error] Unknown type of the network game [%d]\n"), netGameType);
+ error("Unknown type of the network game [%d]", netGameType);
assert(0);
break;
}
diff --git a/src/base/proto.c b/src/base/proto.c
index 1c56653..f3f66ff 100644
--- a/src/base/proto.c
+++ b/src/base/proto.c
@@ -59,7 +59,7 @@ void proto_recv_error_client(char *msg)
return;
}
- DEBUG_MSG(_("[Debug] Communication error [%d]\n"), errorcode);
+ debug("Communication error [%d]", errorcode);
switch (errorcode) {
case PROTO_ERROR_CODE_BAD_VERSION:
@@ -84,7 +84,7 @@ void proto_send_hello_client(char *name)
snprintf(msg, STR_PROTO_SIZE, "hello %s %s\n",
getParamElse("--version", TUXANCI_VERSION), name);
- printf(_("[Debug] Sending: %s\n"), msg);
+ debug("Sending: %s", msg);
client_send(msg);
}
#endif /* PUBLIC_SERVER */
diff --git a/src/base/server.c b/src/base/server.c
index 2b968d1..17d8abe 100644
--- a/src/base/server.c
+++ b/src/base/server.c
@@ -281,7 +281,7 @@ void server_send_client(client_t *p, char *msg)
#ifndef PUBLIC_SERVER
if (isParamFlag("--send")) {
- printf(_("[Debug] Sending: %s"), msg);
+ debug("Sending: %s", msg);
}
#endif /* PUBLIC_SERVER */
@@ -308,7 +308,7 @@ static void client_eventWorkRecvList(client_t *client)
#ifndef PUBLIC_SERVER
if (isParamFlag("--recv")) {
- printf(_("[Debug] Received: %s"), line);
+ debug("Received: %s", line);
}
#endif /* PUBLIC_SERVER */
diff --git a/src/base/serverSendMsg.c b/src/base/serverSendMsg.c
index ed30020..d74103e 100644
--- a/src/base/serverSendMsg.c
+++ b/src/base/serverSendMsg.c
@@ -138,7 +138,7 @@ void send_msg_to_client(int type, client_t *client, char *msg, int type2, int id
#endif /* PUBLIC_SERVER */
break;
default:
- fprintf(stderr, _("[Error] Unknown type of target group of players [%d]\n"), type);
+ error("Unknown type of target group of players [%d]", type);
assert(0);
break;
}
diff --git a/src/base/shareFunction.c b/src/base/shareFunction.c
index 7121cfd..a9cd69d 100644
--- a/src/base/shareFunction.c
+++ b/src/base/shareFunction.c
@@ -37,7 +37,7 @@ void share_function_init()
void share_function_add(char *name, void *function)
{
- DEBUG_MSG(_("[Debug] Adding new shared function [%s]\n"), name);
+ debug("Adding new shared function [%s]", name);
list_add(listShareFce, newShareFceItem(name, function));
}
diff --git a/src/base/shot.c b/src/base/shot.c
index f11760a..168e889 100644
--- a/src/base/shot.c
+++ b/src/base/shot.c
@@ -113,7 +113,7 @@ shot_t *shot_new(int x, int y, int px, int py, int gun, int author_id)
break;
default:
- fprintf(stderr, _("[Error] Unknown type of gun [%d]\n"), gun);
+ error("Unknown type of gun [%d]", gun);
assert(0);
break;
}
diff --git a/src/base/space.c b/src/base/space.c
index 4f3adbe..0189186 100644
--- a/src/base/space.c
+++ b/src/base/space.c
@@ -273,7 +273,7 @@ void space_print(space_t *p)
{
int i, j;
- printf(_("[Debug] Debugging space:\n"));
+ debug("Debugging space:");
for (i = 0; i < p->h; i++) {
for (j = 0; j < p->w; j++) {
diff --git a/src/base/storage.c b/src/base/storage.c
index 971e576..842c560 100644
--- a/src/base/storage.c
+++ b/src/base/storage.c
@@ -72,7 +72,7 @@ void *storage_get(list_t *list, char *group, char *name)
}
}
- DEBUG_MSG(_("[Error] Storage item not found [%s %s]\n"), group, name);
+ debug("Storage item not found [%s %s]", group, name);
return NULL;
}
diff --git a/src/base/textFile.c b/src/base/textFile.c
index 8db6713..d04d8e6 100644
--- a/src/base/textFile.c
+++ b/src/base/textFile.c
@@ -50,7 +50,7 @@ static void createLine(list_t *list, char *p, int len)
break;
}
- length_line = (int) (end_line - (begin_line));
+ length_line = (int) (end_line - begin_line);
line = malloc((length_line + 1) * sizeof(char));
memset(line, 0, (length_line + 1) * sizeof(char));
@@ -64,7 +64,7 @@ static void createLine(list_t *list, char *p, int len)
} while (begin_line != NULL);
}
-/*
+/**
* Loads file *s and returns him formatted to textFile_t*
*/
textFile_t *text_file_load(char *s)
@@ -78,20 +78,20 @@ textFile_t *text_file_load(char *s)
assert(s != NULL);
if (lstat(s, &buf) < 0) {
- fprintf(stderr, _("[Error] Unable to get file status [%s]\n"), s);
+ error("Unable to get file status [%s]", s);
return NULL;
}
file_length = buf.st_size;
if ((file = fopen(s, "rb")) == NULL) {
- fprintf(stderr, _("[Error] Unable to open file for reading [%s]\n"), s);
+ error("Unable to open file for reading [%s]", s);
return NULL;
}
p = malloc(file_length * sizeof(char));
if (fread(p, file_length * sizeof(char), 1, file) != 1) {
- fprintf(stderr, _("[Error] Unable to read data from file [%s]\n"), s);
+ error("Unable to read data from file [%s]", s);
fclose(file);
return NULL;
}
@@ -106,7 +106,7 @@ textFile_t *text_file_load(char *s)
return ret;
}
-/*
+/**
* Prints the text saved in *p into stdout
*/
void text_file_print(textFile_t *p)
@@ -115,7 +115,7 @@ void text_file_print(textFile_t *p)
assert(p != NULL);
- printf(_("[Debug] Printing file [%s]\n\n"), p->file);
+ debug("Printing file [%s]", p->file);
for (i = 0; i < p->text->count; i++) {
printf("%3d >> %s\n", i, (char *) p->text->list[i]);
@@ -138,7 +138,7 @@ void text_file_save(textFile_t *p)
fclose(file);
}
-/*
+/**
* Removes text saved in *p from the memory
*/
void text_file_destroy(textFile_t *p)
diff --git a/src/base/tux.c b/src/base/tux.c
index bed47fc..33984f7 100644
--- a/src/base/tux.c
+++ b/src/base/tux.c
@@ -148,7 +148,7 @@ void tux_get_course(int n, int *x, int *y)
break;
default:
- fprintf(stderr, _("[Error] Unknown direction of the tux [%d]\n"), n);
+ error("Unknown direction of the tux [%d]", n);
assert(0);
break;
}
@@ -185,7 +185,7 @@ void tux_draw(tux_t *tux)
break;
default:
- fprintf(stderr, _("[Error] Unknown direction of the tux [%d]\n"), tux->position);
+ error("Unknown direction of the tux [%d]", tux->position);
assert(0);
break;
}
diff --git a/src/base/udp_server.c b/src/base/udp_server.c
index 471c580..0e2b521 100644
--- a/src/base/udp_server.c
+++ b/src/base/udp_server.c
@@ -95,9 +95,9 @@ int server_udp_init(char *ip4, int port4, char *ip6, int port6)
if (sock_server_udp != NULL) {
ret++;
- DEBUG_MSG(_("[Debug] Starting server on [%s]:%d\n"), ip4, port4);
+ debug("Starting server on [%s]:%d", ip4, port4);
} else {
- DEBUG_MSG(_("[Error] Unable to start server on [%s]:%d\n"), ip4, port4);
+ debug("Unable to start server on [%s]:%d", ip4, port4);
}
}
@@ -106,9 +106,9 @@ int server_udp_init(char *ip4, int port4, char *ip6, int port6)
if (sock_server_udp_second != NULL) {
ret++;
- DEBUG_MSG(_("[Debug] Starting server on [%s]:%d\n"), ip6, port6);
+ debug("Starting server on [%s]:%d", ip6, port6);
} else {
- DEBUG_MSG(_("[Error] Unable to start server on [%s]:%d\n"), ip6, port6);
+ debug("Unable to start server on [%s]:%d", ip6, port6);
}
}
@@ -177,7 +177,7 @@ static void client_eventUdpSelect(sock_udp_t *sock_server)
}
if (client == NULL) {
- fprintf(stderr, _("[Error] UDP client not found\n"));
+ error("UDP client not found");
return;
}
@@ -230,15 +230,15 @@ int server_udp_select_sock()
void server_udp_quit()
{
- DEBUG_MSG(_("[Debug] Shutting down UDP\n"));
+ debug("Shutting down UDP");
if (sock_server_udp != NULL) {
- DEBUG_MSG(_("[Debug] Closing IPv4 [port %d]\n"), sock_udp_get_port(sock_server_udp));
+ debug("Closing IPv4 [port %d]", sock_udp_get_port(sock_server_udp));
sock_udp_close(sock_server_udp);
}
if (sock_server_udp_second != NULL) {
- DEBUG_MSG(_("[Debug] Closing IPv6 [port %d]\n"), sock_udp_get_port(sock_server_udp_second));
+ debug("Closing IPv6 [port %d]", sock_udp_get_port(sock_server_udp_second));
sock_udp_close(sock_server_udp_second);
}
}