summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorscarab <scarab@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-08-18 21:50:13 +0000
committerscarab <scarab@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-08-18 21:50:13 +0000
commit9c71274e5c4cde5dd99a0eb927243f6c481df1f2 (patch)
tree17d77f14943b7f463145a5550330b56f0ea9548b /src/base
parent9acea18a3a920b781414ba44e1e1651ea760867b (diff)
- hromada preklapeni na gettext
- zbyva odstranit language funkci - pak uz zbyva pouze rozchodit uplne gettext a vyrobit preklady git-svn-id: http://opensvn.csie.org/tuxanci_ng@222 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/base')
-rw-r--r--src/base/idManager.c25
-rw-r--r--src/base/main.c4
-rw-r--r--src/base/net_multiplayer.c12
-rw-r--r--src/base/proto.c8
-rw-r--r--src/base/server.c8
-rw-r--r--src/base/serverSendMsg.c2
-rw-r--r--src/base/shot.c4
-rw-r--r--src/base/storage.c2
-rw-r--r--src/base/tcp_server.c33
-rwxr-xr-xsrc/base/textFile.c8
-rw-r--r--src/base/tux.c4
-rw-r--r--src/base/udp_server.c35
12 files changed, 89 insertions, 56 deletions
diff --git a/src/base/idManager.c b/src/base/idManager.c
index ee6792c..fd4cac9 100644
--- a/src/base/idManager.c
+++ b/src/base/idManager.c
@@ -38,7 +38,9 @@ void initListID()
{
listID = newList();
lastID = 0;
- printf("init ID manger..\n");
+#ifdef DEBUG
+ printf(_("Starting ID manger\n"));
+#endif
}
int isRegisterID(int id)
@@ -70,7 +72,7 @@ static int findNewID()
if( listID->count >= MAX_ID-1 )
{
- assert( ! "ziaden ID uz nie je volny !" );
+ assert( ! _("No free ID left!") );
}
do{
@@ -110,7 +112,7 @@ void incID(int id)
if( index == -1 )
{
- assert( ! "takyto ID nebol nikdy registrovany !" );
+ assert( ! _("This kind of ID was never registered!") );
return; // ha ha ha
}
@@ -133,7 +135,7 @@ void delID(int id)
if( index == -1 )
{
- assert( ! "takyto ID nebol nikdy registrovany !" );
+ assert( ! _("This kind of ID was never registered!") );
return; // ha ha ha
}
@@ -183,21 +185,24 @@ void infoID(int id)
if( index == -1 )
{
- printf("ID %d not exists\n", id);
+#ifdef DEBUG
+ printf(_("ID %d does not exist\n"), id);
+#endif
return;
}
this = listID->list[index];
-
- printf("ID %d ( count %d )\n", this->id, this->count);
-
+#ifdef DEBUG
+ printf(_("ID %d (count %d)\n"), this->id, this->count);
+#endif
return;
}
void quitListID()
{
- printf("quit ID manger..\n");
-
+#ifdef DEBUG
+ printf(_("Quitting ID manger\n"));
+#endif
assert( listID != NULL );
destroyListItem(listID, destroyIdItem);
}
diff --git a/src/base/main.c b/src/base/main.c
index 4c40b97..4df8da1 100644
--- a/src/base/main.c
+++ b/src/base/main.c
@@ -99,7 +99,7 @@ void accessExistFile(const char *s)
{
if( access(s, F_OK) != 0 )
{
- fprintf(stderr, "File %s not found !\nProgram shutdown !\n", s);
+ fprintf(stderr, _("File %s not found !\nProgram shutdown !\n"), s);
exit(-1);
}
}
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
/* Let's initialize WinSock */
if( WSAStartup(wVersionRequested, &data) != 0 )
{
- fprintf(stderr, "WinSock initialization failed !\nProgram shutdown !\n");
+ fprintf(stderr, _("WinSock initialization failed !\nProgram shutdown !\n"));
exit(-1);
}
#endif
diff --git a/src/base/net_multiplayer.c b/src/base/net_multiplayer.c
index a2ec849..f7d54eb 100644
--- a/src/base/net_multiplayer.c
+++ b/src/base/net_multiplayer.c
@@ -58,7 +58,7 @@ int initNetMuliplayer(int type, char *ip, int port, int proto)
case PROTO_UDPv4 :
if( initServer(ip, port, NULL, 0) != 1 )
{
- fprintf(stderr, "Unable to inicialize network game as server!\n");
+ fprintf(stderr, _("Unable to inicialize network game as server!\n"));
netGameType = NET_GAME_TYPE_NONE;
return -1;
}
@@ -66,7 +66,7 @@ int initNetMuliplayer(int type, char *ip, int port, int proto)
case PROTO_UDPv6 :
if( initServer(NULL, 0, ip, port) != 1 )
{
- fprintf(stderr, "Unable to inicialize network game as server!\n");
+ fprintf(stderr, _("Unable to inicialize network game as server!\n"));
netGameType = NET_GAME_TYPE_NONE;
return -1;
}
@@ -78,14 +78,14 @@ int initNetMuliplayer(int type, char *ip, int port, int proto)
case NET_GAME_TYPE_CLIENT :
if( initClient(ip, port, proto) != 0 )
{
- fprintf(stderr, "Unable to inicialize network game as client!\n");
+ fprintf(stderr, _("Unable to inicialize network game as client!\n"));
netGameType = NET_GAME_TYPE_NONE;
return -1;
}
break;
#endif
default :
- assert( ! "Premenna netGameType ma zlu hodnotu !" );
+ assert( ! _("Variable netGameType has a really wierd value!") );
break;
}
@@ -109,7 +109,7 @@ void eventNetMultiplayer()
break;
#endif
default :
- assert( ! "Premenna netGameType ma zlu hodnotu !" );
+ assert( ! _("Variable netGameType has a really wierd value!") );
break;
}
}
@@ -131,7 +131,7 @@ void quitNetMultiplayer()
break;
#endif
default :
- assert( ! "Premenna netGameType ma zlu hodnotu !" );
+ assert( ! _("Variable netGameType has a really wierd value!") );
break;
}
diff --git a/src/base/proto.c b/src/base/proto.c
index 6c4113f..646b550 100644
--- a/src/base/proto.c
+++ b/src/base/proto.c
@@ -64,13 +64,13 @@ void proto_recv_error_client(char *msg)
{
return;
}
-
- printf("proto error code %d\n", errorcode);
-
+#ifdef DEBUG
+ printf(_("Proto error code: \"%d\"\n"), errorcode);
+#endif
switch(errorcode)
{
case PROTO_ERROR_CODE_BAD_VERSION :
- setMsgToAnalyze(getMyText("ERROR_BAD_VERSION"));
+ setMsgToAnalyze(_("Version of your client isn't supported by the server."));
setWorldEnd();
break;
}
diff --git a/src/base/server.c b/src/base/server.c
index a6fc052..818999c 100644
--- a/src/base/server.c
+++ b/src/base/server.c
@@ -159,7 +159,7 @@ static void destroyUdpOrTcpClient(client_t *client)
destroyTcpClient(client);
break;
default :
- assert( ! "zly typ !");
+ assert( ! _("Bad client type (TCP/UDP)!"));
break;
}
}
@@ -308,7 +308,7 @@ void sendClient(client_t *p, char *msg)
#ifndef PUBLIC_SERVER
if( isParamFlag("--send") )
{
- printf("send -> %s", msg);
+ printf(_("Sending: \"%s\""), msg);
}
#endif
@@ -321,7 +321,7 @@ void sendClient(client_t *p, char *msg)
ret = addBuffer(p->sendBuffer, msg, strlen(msg));
break;
default :
- assert( ! "zly typ !");
+ assert( ! _("Bad client type (TCP/UDP)!"));
break;
}
@@ -350,7 +350,7 @@ static void eventClientWorkRecvList(client_t *client)
#ifndef PUBLIC_SERVER
if( isParamFlag("--recv") )
{
- printf("recv -> %s", line);
+ printf(_("Recieved: \"%s\""), line);
}
#endif
diff --git a/src/base/serverSendMsg.c b/src/base/serverSendMsg.c
index 772469b..a347b37 100644
--- a/src/base/serverSendMsg.c
+++ b/src/base/serverSendMsg.c
@@ -139,7 +139,7 @@ void protoSendClient(int type, client_t *client, char *msg, int type2, int id)
#endif
break;
default :
- assert( ! "Premenna type ma zlu hodnotu !" );
+ assert( ! _("Type variable has a really wierd value!") );
break;
}
}
diff --git a/src/base/shot.c b/src/base/shot.c
index 244da70..955330e 100644
--- a/src/base/shot.c
+++ b/src/base/shot.c
@@ -125,7 +125,7 @@ shot_t* newShot(int x,int y, int px, int py, int gun, int author_id)
break;
default :
- assert( ! "Premenna weapon ma zlu hodnotu !" );
+ assert( ! _("Type variable has a really wierd value!") );
break;
}
@@ -313,7 +313,9 @@ static void action_check(space_t *space, shot_t *shot, client_t *client)
if( isValueInList(client->listSeesShot, shot->id) == 0 )
{
addList(client->listSeesShot, newInt(shot->id) );
+#ifdef DEBUG
printf("proto_send_shot_server(PROTO_SEND_ONE, client, shot);\n");
+#endif
proto_send_shot_server(PROTO_SEND_ONE, client, shot);
}
}
diff --git a/src/base/storage.c b/src/base/storage.c
index be27321..7a7ee91 100644
--- a/src/base/storage.c
+++ b/src/base/storage.c
@@ -68,7 +68,7 @@ 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);
+ printf(_("%s %s was not found in storage!\n"), group, name);
#endif
return NULL;
}
diff --git a/src/base/tcp_server.c b/src/base/tcp_server.c
index 74d6f85..6af956d 100644
--- a/src/base/tcp_server.c
+++ b/src/base/tcp_server.c
@@ -63,7 +63,7 @@ client_t* newTcpClient(sock_tcp_t *sock_tcp)
char str_ip[STR_IP_SIZE];
getSockTcpIp(sock_tcp, str_ip, STR_IP_SIZE);
- sprintf(str_log, "new client TCP from %s %d", str_ip, getSockTcpPort(sock_tcp));
+ sprintf(str_log, _("New client \"%s\" on port \"%d\" connected"), str_ip, getSockTCPPort(sock_tcp));
addToLog(LOG_INF, str_log);
#endif
@@ -107,7 +107,7 @@ void destroyTcpClient(client_t *client)
char str_ip[STR_IP_SIZE];
getSockTcpIp(client->socket_tcp, str_ip, STR_IP_SIZE);
- sprintf(str_log, "close TCP connect %s %d", str_ip, getSockTcpPort(client->socket_tcp));
+ sprintf(str_log, _("Client \"%s\" on port \"%d\" disconnected"), str_ip, getSockTcpPort(client->socket_tcp));
addToLog(LOG_INF, str_log);
#endif
@@ -132,11 +132,15 @@ int initTcpServer(char *ip4, int port4, char *ip6, int port6)
{
ret++;
disableNagle(sock_server_tcp);
- printf("server listen TCP port %s %d\n", ip4, port4);
+#ifdef DEBUG
+ printf(_("Starting server: \"%s\" on port: \"%d\"\n"), ip4, port4);
+#endif
}
else
{
- printf("server listen TCP port %s %d -- failed !!!\n", ip4, port4);
+#ifdef DEBUG
+ printf(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip4, port4);
+#endif
}
}
@@ -148,11 +152,15 @@ int initTcpServer(char *ip4, int port4, char *ip6, int port6)
{
ret++;
disableNagle(sock_server_tcp_second);
- printf("server listen TCP port %s %d\n", ip6, port6);
+#ifdef DEBUG
+ printf(_("Starting server: \"%s\" on port: \"%d\"\n"), ip6, port6);
+#endif
}
else
{
- printf("server listen TCP port %s %d -- failed !!!\n", ip6, port6);
+#ifdef DEBUG
+ printf(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip6, port6);
+#endif
}
}
@@ -297,15 +305,20 @@ void quitTcpServer()
{
if( sock_server_tcp != NULL )
{
- printf("close port %d\n", getSockTcpPort(sock_server_tcp));
+#ifdef DEBUG
+ printf(_("Closing port: \"%d\"\n"), getSockTcpPort(sock_server_tcp));
+#endif
closeTcpSocket(sock_server_tcp);
}
if( sock_server_tcp_second != NULL )
{
- printf("close port %d\n", getSockTcpPort(sock_server_tcp_second));
+#ifdef DEBUG
+ printf(_("Closing port: \"%d\"\n"), getSockTcpPort(sock_server_tcp_second));
+#endif
closeTcpSocket(sock_server_tcp_second);
}
-
- printf("quit TCP port\n");
+#ifdef DEBUG
+ printf("Quitting TCP\n");
+#endif
}
diff --git a/src/base/textFile.c b/src/base/textFile.c
index 00016df..b7668ef 100755
--- a/src/base/textFile.c
+++ b/src/base/textFile.c
@@ -82,14 +82,14 @@ textFile_t* loadTextFile(char *s)
if( lstat(s, &buf) < 0 )
{
- fprintf(stderr, "ERROR: unable to get file status for %s!\n", s);
+ fprintf(stderr, _("ERROR: unable to get file status for %s!\n"), s);
return NULL;
}
file_length = buf.st_size;
if( (file = fopen(s, "rb")) == NULL )
{
- fprintf(stderr, "ERROR: unable to open file %s for reading\n", s);
+ fprintf(stderr, _("ERROR: unable to open file %s for reading\n"), s);
return NULL;
}
@@ -97,7 +97,7 @@ textFile_t* loadTextFile(char *s)
if( fread(p, file_length * sizeof(char), 1, file) != 1 )
{
- fprintf(stderr, "ERROR: unable to read data from file %s\n",s);
+ fprintf(stderr, _("ERROR: unable to read data from file %s\n"),s);
fclose(file);
return NULL;
}
@@ -122,7 +122,7 @@ void printTextFile(textFile_t *p)
assert( p != NULL );
- printf("file : %s\n\n", p->file);
+ printf(_("Printing file: \"%s\"\n\n"), p->file);
for(i = 0; i < p->text->count; i++)
{
diff --git a/src/base/tux.c b/src/base/tux.c
index f35a530..79c7104 100644
--- a/src/base/tux.c
+++ b/src/base/tux.c
@@ -154,7 +154,7 @@ void getCourse(int n, int *x, int *y)
break;
default :
- assert( ! "premenna n ma zlu hodnotu !" );
+ assert( ! _("Type variable has a really wierd value!") );
break;
}
}
@@ -193,7 +193,7 @@ void drawTux(tux_t *tux)
break;
default :
- assert( ! "premenna p->control ma zlu hodnotu !" );
+ assert( ! _("p->control has a really wierd value!") );
break;
}
diff --git a/src/base/udp_server.c b/src/base/udp_server.c
index ce54802..1923e55 100644
--- a/src/base/udp_server.c
+++ b/src/base/udp_server.c
@@ -61,7 +61,7 @@ client_t* newUdpClient(sock_udp_t *sock_udp)
char str_ip[STR_IP_SIZE];
getSockUdpIp(sock_udp, str_ip, STR_IP_SIZE);
- sprintf(str_log, "new client UDP from %s %d", str_ip, getSockUdpPort(sock_udp));
+ sprintf(str_log, _("New client \"%s\" on port \"%d\" connected"), str_ip, getSockUdpPort(sock_udp));
addToLog(LOG_INF, str_log);
#endif
@@ -77,7 +77,7 @@ void destroyUdpClient(client_t *p)
char str_ip[STR_IP_SIZE];
getSockUdpIp(p->socket_udp, str_ip, STR_IP_SIZE);
- sprintf(str_log, "close UDP connect %s %d", str_ip, getSockUdpPort(p->socket_udp));
+ sprintf(str_log, _("Client \"%s\" on port \"%d\" disconnected"), str_ip, getSockUdpPort(p->socket_udp));
addToLog(LOG_INF, str_log);
#endif
@@ -99,11 +99,15 @@ int initUdpServer(char *ip4, int port4, char *ip6, int port6)
if( sock_server_udp != NULL )
{
ret++;
- printf("server listen UDP port %s %d\n", ip4, port4);
+#ifdef DEBUG
+ printf(_("Starting server: \"%s\" on port: \"%d\"\n"), ip4, port4);
+#endif
}
else
{
- printf("server listen UDP port %s %d -- failed !!!\n", ip4, port4);
+#ifdef DEBUG
+ printf(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip4, port4);
+#endif
}
}
@@ -114,11 +118,15 @@ int initUdpServer(char *ip4, int port4, char *ip6, int port6)
if( sock_server_udp_second != NULL )
{
ret++;
- printf("server listen UDP port %s %d\n", ip6, port6);
+#ifdef DEBUG
+ printf(_("Starting server: \"%s\" on port: \"%d\"\n"), ip6, port6);
+#endif
}
else
{
- printf("server listen UDP port %s %d -- failed !!!\n", ip6, port6);
+#ifdef DEBUG
+ printf(_("Starting server: \"%s\" on port: \"%d\" FAILED!\n"), ip6, port6);
+#endif
}
}
@@ -197,7 +205,7 @@ static void eventClientUdpSelect(sock_udp_t *sock_server)
if( client == NULL )
{
- fprintf(stderr, "Client total not found !\n");
+ fprintf(stderr, _("Client was not FOUND!\n"));
return;
}
@@ -260,15 +268,20 @@ void quitUdpServer()
{
if( sock_server_udp != NULL )
{
- printf("close port %d\n", getSockUdpPort(sock_server_udp));
+#ifdef DEBUG
+ printf(_("Closing port: \"%d\"\n"), getSockUdpPort(sock_server_udp));
+#endif
closeUdpSocket(sock_server_udp);
}
if( sock_server_udp_second != NULL )
{
- printf("close port %d\n", getSockUdpPort(sock_server_udp_second));
+#ifdef DEBUG
+ printf(_("Closing port: \"%d\"\n"), getSockUdpPort(sock_server_udp_second));
+#endif
closeUdpSocket(sock_server_udp_second);
}
-
- printf("quit UDP port\n");
+#ifdef DEBUG
+ printf(_("Quitting UDP\n"));
+#endif
}