summaryrefslogtreecommitdiff
path: root/src/server
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/server
parenta0939379bb1185ee6d66739d9d021466d5d89624 (diff)
Revised methods how are translated strings handled
Few comments were made available to Doxygen
Diffstat (limited to 'src/server')
-rw-r--r--src/server/highScore.c8
-rw-r--r--src/server/log.c6
-rw-r--r--src/server/publicServer.c14
-rw-r--r--src/server/serverConfigFile.c15
4 files changed, 20 insertions, 23 deletions
diff --git a/src/server/highScore.c b/src/server/highScore.c
index 4f54b1c..75323fa 100644
--- a/src/server/highScore.c
+++ b/src/server/highScore.c
@@ -17,16 +17,16 @@ void high_score_init(char *file)
textFile = text_file_load(file);
if (textFile == NULL) {
- fprintf(stderr, _("[Error] Unable to load high score [%s]\n"), file);
- fprintf(stderr, _("[Debug] Creating high score file [%s]\n"), file);
+ error("Unable to load high score [%s]", file);
+ debug("Creating high score file [%s]", file);
textFile = text_file_new(file);
} else {
- DEBUG_MSG(_("[Debug] Loading high score file [%s]\n"), file);
+ debug("Loading high score file [%s]", file);
return;
}
if (textFile == NULL) {
- fprintf(stderr, _("[Error] Unable to create high score file [%s]\n"), file);
+ error("Unable to create high score file [%s]", file);
return;
}
diff --git a/src/server/log.c b/src/server/log.c
index 0c6c319..788bbe6 100644
--- a/src/server/log.c
+++ b/src/server/log.c
@@ -15,11 +15,11 @@ int log_init(char *name)
logFile = fopen(name, "a");
if (logFile == NULL) {
- fprintf(stderr, _("[Error] Unable to open log file [%s]\n"), name);
+ error("Unable to open log file [%s]", name);
return -1;
}
- DEBUG_MSG(_("[Debug] Using log file [%s]\n"), name);
+ debug("Using log file [%s]", name);
log_add(LOG_INF, "Logging started");
@@ -54,7 +54,7 @@ void log_add(int type, char *msg)
str_type = "ERROR";
break;
default:
- assert(!_("[Error] Unknown type of the logging string"));
+ fatal("Unknown type of the logging string");
break;
}
diff --git a/src/server/publicServer.c b/src/server/publicServer.c
index cb52842..76c0443 100644
--- a/src/server/publicServer.c
+++ b/src/server/publicServer.c
@@ -125,7 +125,7 @@ void daemonize()
/* lock the file */
if (lockf(lockfd, F_TLOCK, 0) < 0) {
perror("[Error] Lock: lockf\n");
- printf("[Warning] The Tuxanci game server is already running\n");
+ warning("The Tuxanci game server is already running");
exit(0);
}
#else /* __CYGWIN__ */
@@ -138,7 +138,7 @@ void daemonize()
lock.l_len = 0;
if (fcntl(lockfd, F_SETLK, &lock) < 0) {
- printf("[Warning] The Tuxanci game server is already running\n");
+ warning("The Tuxanci game server is already running");
exit(0);
}
}
@@ -321,7 +321,7 @@ static void load_arena()
choice_arenaFile = arena_file_get_file_format_net_name(public_server_get_setting("ARENA", "--arena", "FAGN"));
if (choice_arenaFile == NULL) {
- fprintf(stderr, _("[Error] Unable to load arena [%s]\n"), public_server_get_setting("ARENA", "--arena", "FAGN"));
+ error("Unable to load arena [%s]", public_server_get_setting("ARENA", "--arena", "FAGN"));
/* TODO: Why not to log it? */
exit(-1);
}
@@ -364,7 +364,7 @@ int public_server_init()
ret = public_server_initNetwork();
if (ret < 0) {
- fprintf(stderr, _("[Error] Unable to initialize network socket\n"));
+ error("Unable to initialize network socket");
/* TODO: Why not to log it? */
return -1;
}
@@ -372,7 +372,7 @@ int public_server_init()
server_set_max_clients(atoi(public_server_get_setting("MAX_CLIENTS", "--max-clients", "32")));
if (public_server_register() < 0) {
- fprintf(stderr, _("[Error] Unable to contact MasterServer\n"));
+ error("Unable to contact MasterServer");
/* TODO: Why not to log it? */
}
@@ -412,7 +412,7 @@ void public_server_event()
void my_handler_quit(int n)
{
- DEBUG_MSG("[Debug] Received signal %d\n", n);
+ debug("Received signal %d", n);
/* TODO: Why not to log it? */
isSignalEnd = TRUE;
@@ -422,7 +422,7 @@ void my_handler_quit(int n)
void public_server_quit()
{
- DEBUG_MSG(_("[Debug] Shutting down the Tuxanci game server\n"));
+ debug("Shutting down the Tuxanci game server");
/* TODO: Why not to log it? */
net_multiplayer_quit();
diff --git a/src/server/serverConfigFile.c b/src/server/serverConfigFile.c
index dbf1c63..d872827 100644
--- a/src/server/serverConfigFile.c
+++ b/src/server/serverConfigFile.c
@@ -10,10 +10,9 @@
static textFile_t *serverTextFile;
-static void prepareConfigFile(textFile_t * ts)
+static void prepareConfigFile(textFile_t *ts)
{
- int i;
- int j;
+ int i, j;
for (i = 0; i < serverTextFile->text->count; i++) {
char *line;
@@ -23,8 +22,7 @@ static void prepareConfigFile(textFile_t * ts)
len = strlen(line);
for (j = 0; j < len; j++) {
- if (line[j] == ' ') /* [TAB] */
- {
+ if (line[j] == ' ') { /* [TAB] */
line[j] = ' ';
}
}
@@ -36,13 +34,12 @@ void server_configFile_init()
char *configFile;
configFile = getParamElse("--config-file", SERVER_CONFIG);
- printf(_("[Debug] Loading configuration file [%s]\n"),
- getParamElse("--config-file", SERVER_CONFIG));
+ debug("Loading configuration file [%s]", getParamElse("--config-file", SERVER_CONFIG));
serverTextFile = text_file_load(configFile);
if (serverTextFile == NULL) {
- fprintf(stderr, _("[Warning] Unable to load config file - using defaults\n"));
+ warning("Unable to load config file - using defaults");
return;
}
@@ -51,8 +48,8 @@ void server_configFile_init()
static char *findValue(char *s)
{
- int len;
int i;
+ int len;
len = strlen(s);