diff options
Diffstat (limited to 'src')
43 files changed, 261 insertions, 199 deletions
diff --git a/src/audio/sound.c b/src/audio/sound.c index 72d1584..0c6b342 100644 --- a/src/audio/sound.c +++ b/src/audio/sound.c @@ -50,7 +50,7 @@ static Mix_Chunk* loadMixSound(char *file) char str[STR_PATH_SIZE]; #ifdef DEBUG - printf("Loading sound file: %s\n", file); + printf(_("Loading sound file: %s\n"), file); #endif sprintf(str, PATH_SOUND "%s", file); accessExistFile(str); 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 } diff --git a/src/client/client.c b/src/client/client.c index 08fe9e6..edffc54 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -102,9 +102,9 @@ static int initUdpClient(char *ip, int port, int proto) { return -1; } - - printf("connect UDP %s %d\n", ip, port); - +#ifdef DEBUG + printf(_("Connected to: %s on port: %d via UDP\n"), ip, port); +#endif return 0; } @@ -120,8 +120,9 @@ static int initTcpClient(char *ip, int port, int proto) disableNagle(sock_server_tcp); setTcpSockNonBlock(sock_server_tcp); - printf("connect TCP %s %d\n", ip, port); - +#ifdef DEBUG + printf(_("Connected to: %s on port: %d via TCP\n"), ip, port); +#endif return 0; } @@ -181,8 +182,8 @@ int initClient(char *ip, int port, int proto) static void errorWithServer() { - fprintf(stderr, "Server does not respond!\n"); - setMsgToAnalyze(getMyText("ERROR_SERVER_DONT_ALIVE")); + fprintf(stderr, _("Server did not respond!\n")); + setMsgToAnalyze(_("Server is not running or being blocked. I was unable to connect.")); setWorldEnd(); } @@ -221,7 +222,7 @@ void sendServer(char *msg) #ifndef PUBLIC_SERVER if( isParamFlag("--send") ) { - printf("send -> %s", msg); + printf(_("Sending: \"%s\""), msg); } #endif @@ -310,7 +311,7 @@ static void eventClientWorkRecvList() #ifndef PUBLIC_SERVER if( isParamFlag("--recv") ) { - printf("recv -> %s", line); + printf(_("Recieved: \"%s\""), line); } #endif if( protoCmd != NULL ) @@ -412,11 +413,11 @@ static void eventTraffic() if( currentTime - lastTraffic > 5000 ) { lastTraffic = currentTime; - - printf("down: %d\n" - "up : %d\n", +#ifdef DEBUG + printf(_("down: %d\n") + _("up : %d\n"), traffic_down, traffic_up); - +#endif traffic_down = 0; traffic_up = 0; } @@ -440,16 +441,18 @@ static void quitUdpClient() { assert( sock_server_udp != NULL ); closeUdpSocket(sock_server_udp); - - printf("quit UDP conenct\n"); +#ifdef DEBUG + printf(_("Closing UDP connection.\n")); +#endif } static void quitTcpClient() { assert( sock_server_tcp != NULL ); closeTcpSocket(sock_server_tcp); - - printf("quit TCP conenct\n"); +#ifdef DEBUG + printf(_("Closing TCP connection.\n")); +#endif } void quitClient() diff --git a/src/client/configFile.c b/src/client/configFile.c index f900910..dc5d0fd 100644 --- a/src/client/configFile.c +++ b/src/client/configFile.c @@ -131,7 +131,8 @@ void loadValueFromConfigFile(textFile_t *textFile, char *env, char *val, int len sprintf(line, "%s=\"%s\"", env, butVal); addList(textFile->text, strdup(line) ); - - printf("Add line \"%s\" in config file.\n", line); +#ifdef DEBUG + printf(_("ADDING: \"%s\" into config file.\n"), line); +#endif } } diff --git a/src/client/font.c b/src/client/font.c index b81c398..7e95286 100755 --- a/src/client/font.c +++ b/src/client/font.c @@ -40,8 +40,9 @@ void initFont(char *file,int size) TTF_SetFontStyle(g_font, TTF_STYLE_NORMAL); fontSize = size; - - printf("init font.. (%s)\n", file); +#ifdef DEBUG + printf("Loading font: \"%s\"\n", file); +#endif isFontInit = TRUE; } @@ -133,7 +134,8 @@ void quitFont() { TTF_CloseFont(g_font); TTF_Quit(); - - printf("quit font\n"); +#ifdef DEBUG + printf(_("Unloading font\n")); +#endif isFontInit = FALSE; } diff --git a/src/client/game.c b/src/client/game.c index 1525035..1c2688f 100644 --- a/src/client/game.c +++ b/src/client/game.c @@ -48,7 +48,9 @@ static void initGame() if( initLanguage() == -1 ) { - printf("fatal error !\n"); +#ifdef DEBUG + printf(_("I was unable to initialize old nls system (if you see this something wierd is happening)!\n")); +#endif exit(-1); } @@ -111,9 +113,9 @@ void quitGame() quitMusic(); quitAudio(); #endif - - printf("quit..\n"); - +#ifdef DEBUG + printf(_("Quitting TUXANCI...\n")); +#endif exit(0); } diff --git a/src/client/image.c b/src/client/image.c index e76e1cf..bcac02c 100755 --- a/src/client/image.c +++ b/src/client/image.c @@ -25,8 +25,9 @@ bool_t isImageInicialized() void initImageData() { assert( isInterfaceInicialized() == TRUE ); - - printf("init image database..\n"); +#ifdef DEBUG + printf(_("Initializing image database\n")); +#endif listStorage = newStorage(); isImageDataInit = TRUE; } @@ -100,9 +101,9 @@ image_t* addImageData(char *file, int alpha, char *name, char *group) new = newImage(surface); addItemToStorage(listStorage, group, name, new ); - - printf("load image %s\n", file); - +#ifdef DEBUG + printf(_("Loading image %s\n"), file); +#endif return new; } @@ -159,7 +160,9 @@ void drawImage(image_t *p, int x,int y, int px, int py, int w, int h) */ void quitImageData() { - printf("quit image database..\n"); +#ifdef DEBUG + printf(_("Quitting image database\n")); +#endif destroyStorage(listStorage, destroyImage); isImageDataInit = FALSE; } diff --git a/src/client/interface.c b/src/client/interface.c index b697524..eb8168f 100755 --- a/src/client/interface.c +++ b/src/client/interface.c @@ -51,8 +51,9 @@ void disableKeyboardBuffer(){ int initSDL() { - printf("init SDL..\n"); - +#ifdef DEBUG + printf(_("Initializing SDL system\n")); +#endif // initialization of SDL if( SDL_Init(SDL_SUBSYSTEMS) == -1 ) { @@ -118,14 +119,14 @@ int toggleFullscreen() if( SDL_WM_ToggleFullScreen(screen) == 0 ) { - fprintf(stderr, "Nemozem prepnut do fullscreenu!\n"); + fprintf(stderr, _("Unable to switch to FULLSCREEN mode!\n")); SDL_FreeSurface(screen); screen = SDL_SetVideoMode(WINDOW_SIZE_X, WINDOW_SIZE_Y, WIN_BPP, g_win_flags); if(screen == NULL) { - fprintf(stderr, "Nemozem premnut do okna:%s\n", SDL_GetError()); + fprintf(stderr, _("Unable to switch to WINDOW mode! Error: %s\n"), SDL_GetError()); return 0; } } @@ -143,7 +144,7 @@ int isMouseClicked() return SDL_GetMouseState(NULL,NULL) & SDL_BUTTON(SDL_BUTTON_LEFT); } -int isPessAnyKey() +int isPressAnyKey() { Uint8 *mapa; int i; @@ -159,7 +160,7 @@ int isPessAnyKey() return 0; } -void printPessAnyKey() +void printPressAnyKey() { Uint8 *mapa; int i; @@ -169,7 +170,7 @@ void printPessAnyKey() for( i = SDLK_BACKSPACE ; i < SDLK_KP9 ; i++ ) if( mapa[i] == SDL_PRESSED ) { - printf("press key with code : %d\n", i); + printf(_("Pressed key with SDL value: %d\n"), i); } } @@ -241,7 +242,7 @@ int eventAction() if(screen == NULL) { - fprintf(stderr, "Nemozem zmenit rozlisene okna: %s\n",SDL_GetError()); + fprintf(stderr, _("Unable to change WINDOW resolution! Error: %s\n"),SDL_GetError()); return 0; } break; @@ -269,7 +270,9 @@ void eventSDL() void quitSDL() { - printf("quit SDL..\n"); +#ifdef DEBUG + printf(_("Quitting SDL\n")); +#endif quitKeyboardBuffer(); SDL_Quit(); diff --git a/src/client/interface.h b/src/client/interface.h index 29d51af..44ea2c8 100755 --- a/src/client/interface.h +++ b/src/client/interface.h @@ -36,7 +36,7 @@ extern int initSDL(); extern SDL_Surface* getSDL_Screen(); extern void getMousePosition(int *x, int *y); extern int isMouseClicked(); -extern int isPessAnyKey(); +extern int isPressAnyKey(); extern void interfaceRefresh(); extern void eventSDL(); extern void quitSDL(); diff --git a/src/client/keyboardBuffer.c b/src/client/keyboardBuffer.c index 1eb1ff2..7dee362 100644 --- a/src/client/keyboardBuffer.c +++ b/src/client/keyboardBuffer.c @@ -61,7 +61,7 @@ bool_t pushKeyToKeyboardBuffer(SDL_keysym key){ assert(keyboardBuffer!=NULL); if (keyboardBuffer->count >= keyboardBuffer->size){ - fprintf(stderr, "Preteceni klavesoveho bufferu! Zahazuji klavesu: %02x\n", key.sym); + fprintf(stderr, _("Keyboard Buffer overrun! Dropping key: %02x\n"), key.sym); return FALSE; } @@ -84,7 +84,7 @@ SDL_keysym popKeyFromKeyboardBuffer(){ assert(keyboardBuffer!=NULL); if (keyboardBuffer->count <= 0){ - fprintf(stderr, "Podteceni klavesoveho bufferu!\n"); + fprintf(stderr, _("Keyboard Buffer underrun!\n")); return emptyKey; } @@ -129,7 +129,7 @@ void quitKeyboardBuffer(){ assert(keyboardBuffer!=NULL); if (keyboardBuffer->count>0){ - fprintf(stderr, "Klavesovy buffer neni prazdny!\n"); + fprintf(stderr, _("Keyboard buffer is not empty!\n")); } free(keyboardBuffer->buff); diff --git a/src/client/saveLoad.c b/src/client/saveLoad.c index 475613d..05452a9 100644 --- a/src/client/saveLoad.c +++ b/src/client/saveLoad.c @@ -78,8 +78,9 @@ void saveArena(char *filename, arena_t *arena) char path[STR_PATH_SIZE]; sprintf(path, "%s/%s.sav", getHomeDirector(), filename); - printf("path = %s\n", path); - +#ifdef DEBUG + printf(_("Saving game to: \"%s\"\n"), path); +#endif textFile = newTextFile(path); if( textFile != NULL ) @@ -90,7 +91,7 @@ void saveArena(char *filename, arena_t *arena) } else { - fprintf(stderr, "Do not save %s\n", path); + fprintf(stderr, _("I was unable to save: \"%s\"\n"), path); } } @@ -250,8 +251,9 @@ void loadArena(char *filename) char path[STR_PATH_SIZE]; sprintf(path, "%s/%s", getHomeDirector(), filename); - printf("path = %s\n", path); - +#ifdef DEBUG + printf(_("Loadig game from file: \"%s\"\n"), path); +#endif textFile = loadTextFile(path); if( textFile != NULL ) @@ -261,6 +263,6 @@ void loadArena(char *filename) } else { - fprintf(stderr, "Do not load %s\n", path); + fprintf(stderr, _("Unable to load save: \"%s\"\n"), path); } } diff --git a/src/client/screen.c b/src/client/screen.c index 1a4e862..7f89faa 100644 --- a/src/client/screen.c +++ b/src/client/screen.c @@ -57,8 +57,9 @@ void destroyScreen(screen_t *p) void registerScreen(screen_t *p) { assert( p != NULL ); - - printf("register screen %s..\n", p->name); +#ifdef DEBUG + printf(_("Registering screen: \"%s\"\n"), p->name); +#endif addList(listScreen, p); } @@ -108,7 +109,9 @@ void switchScreen() if( currentScreen != NULL ) { - printf("stop screen %s..\n", currentScreen->name); +#ifdef DEBUG + printf(_("Stopping screen:\" %s\"\n"), currentScreen->name); +#endif currentScreen->fce_stop(); } @@ -116,8 +119,9 @@ void switchScreen() futureScreen = NULL; //printf("switch screen %s..\n", currentScreen->name); - - printf("start screen %s..\n", currentScreen->name); +#ifdef DEBUG + printf(_("Starting screen: \"%s\"\n"), currentScreen->name); +#endif currentScreen->fce_start(); } diff --git a/src/modules/modMove.c b/src/modules/modMove.c index ed42886..d1c626c 100755 --- a/src/modules/modMove.c +++ b/src/modules/modMove.c @@ -59,7 +59,7 @@ static void move_tux(tux_t *tux, int x, int y, int w, int h) break; default : - assert( ! "premenna p->control ma zlu hodnotu !" ); + assert( ! _("Variable p->control has a really wierd value!") ); break; } diff --git a/src/modules/modPipe.c b/src/modules/modPipe.c index fb7eaf2..df26b80 100755 --- a/src/modules/modPipe.c +++ b/src/modules/modPipe.c @@ -176,7 +176,7 @@ static void moveShotFromPipe(shot_t *shot, pipe_t *pipe) if( distPipe == NULL ) { - fprintf(stderr, "Pipe %d ID not found\n", pipe->id); + fprintf(stderr, _("Pipe ID for pipe \"%d\" was not found\n"), pipe->id); return; } @@ -241,7 +241,7 @@ static int negPosition(int n) return TUX_UP; default : - assert( ! "premenna n ma zlu hodnotu !" ); + assert( ! _("Tux is moving in another dimension maybe!") ); break; } diff --git a/src/modules/modTeleport.c b/src/modules/modTeleport.c index 0ce27bf..61af102 100755 --- a/src/modules/modTeleport.c +++ b/src/modules/modTeleport.c @@ -187,7 +187,7 @@ static int getRandomPosition() return TUX_DOWN; } - assert( ! "Stupid error ! " ); + assert( ! _("When generating random value in range 0 to 3 i got some other value?!") ); return -1; // no warnning } diff --git a/src/net/tcp.c b/src/net/tcp.c index f6c3dad..d623d86 100755 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -14,12 +14,12 @@ #include <unistd.h> #include <assert.h> #include <netdb.h> - #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <fcntl.h> +#include "main.h" #include "tcp.h" sock_tcp_t* newSockTcp(int proto) @@ -66,7 +66,7 @@ sock_tcp_t* bindTcpSocket(char *address, int port, int proto) if( new->sock < 0 ) { - fprintf(stderr, "Nemozem vytvorit sietovy socket\n"); + fprintf(stderr, _("Unable to create socket when connecting!\n")); destroySockTcp(new); return NULL; } @@ -96,7 +96,7 @@ sock_tcp_t* bindTcpSocket(char *address, int port, int proto) if( ret < 0 ) { - fprintf(stderr, "Nemozem obsadit sietovy port %d\n", port); + fprintf(stderr, _("Unable to bint to port: %d\n"), port); destroySockTcp(new); return NULL; } @@ -181,7 +181,7 @@ int getSockTcpPort(sock_tcp_t *p) } #endif - assert( ! "bad proto !" ); + assert( ! _("Bad IP proto!") ); return -1; } @@ -211,7 +211,7 @@ sock_tcp_t* connectTcpSocket(char *ip, int port, int proto) if( new->sock < 0 ) { - fprintf(stderr, "Nemozem vytvorit sietovy socket\n"); + fprintf(stderr, _("Unable to create TCP socket!\n")); destroySockTcp(new); return NULL; } @@ -240,7 +240,7 @@ sock_tcp_t* connectTcpSocket(char *ip, int port, int proto) if( ret < 0 ) { - fprintf(stderr, "Nemozem sa pripojit na %s %d\n", ip, port); + fprintf(stderr, "Unable to connect on: \"%s\" port: \"%d\"\n", ip, port); destroySockTcp(new); return NULL; } diff --git a/src/net/tcp.h b/src/net/tcp.h index ae870b3..8d5b1cc 100644 --- a/src/net/tcp.h +++ b/src/net/tcp.h @@ -2,7 +2,7 @@ #ifndef MY_TCP_H #define MY_TCP_H - +#include "main.h" #include <netinet/in.h> #define SUPPORT_IPv6 diff --git a/src/net/udp.c b/src/net/udp.c index 7b8afba..f654a75 100644 --- a/src/net/udp.c +++ b/src/net/udp.c @@ -68,7 +68,7 @@ sock_udp_t* bindUdpSocket(char *address, int port, int proto) if( new->sock < 0 ) { - fprintf(stderr, "Unable to create socket when binding!\n"); + fprintf(stderr, _("Unable to create socket when binding!\n")); destroySockUdp(new); #ifdef __WIN32__ WSACleanup(); @@ -100,7 +100,7 @@ sock_udp_t* bindUdpSocket(char *address, int port, int proto) if( res < 0 ) { - fprintf(stderr, "Unable to set socket %s %d!\n", address, port); + fprintf(stderr, _("Unable to set socket %s %d!\n"), address, port); destroySockUdp(new); #ifdef __WIN32__ WSACleanup(); @@ -136,7 +136,7 @@ sock_udp_t* connectUdpSocket(char *address, int port, int proto) if( new->sock < 0 ) { - fprintf(stderr, "Unable to create socket when connecting!\n"); + fprintf(stderr, _("Unable to create socket when connecting!\n")); destroySockUdp(new); #ifdef __WIN32__ WSACleanup(); @@ -226,7 +226,7 @@ int readUdpSocket(sock_udp_t *src, sock_udp_t *dst, void *address, int len) getSockUdpIp(dst, str_ip, STR_IP_SIZE); - fprintf(stderr, "Unable to read form socket %d %s %d!\n", size, str_ip, getSockUdpPort(dst)); + fprintf(stderr, _("Unable to read form socket %d %s %d!\n"), size, str_ip, getSockUdpPort(dst)); #ifdef __WIN32__ WSACleanup(); #endif @@ -267,7 +267,7 @@ int writeUdpSocket(sock_udp_t *src, sock_udp_t *dst, void *address, int len) getSockUdpIp(dst, str_ip, STR_IP_SIZE); - fprintf(stderr, "Unable to write on socket %d %s %d!\n", size, str_ip, getSockUdpPort(dst)); + fprintf(stderr, _("Unable to write on socket %d %s %d!\n"), size, str_ip, getSockUdpPort(dst)); #ifdef __WIN32__ WSACleanup(); #endif @@ -317,7 +317,7 @@ int getSockUdpPort(sock_udp_t *p) } #endif - assert( ! "bad proto !" ); + assert( ! _("Bad IP proto!") ); return -1; } diff --git a/src/screen/screen_browser.c b/src/screen/screen_browser.c index ae4a7d5..fe23d09 100644 --- a/src/screen/screen_browser.c +++ b/src/screen/screen_browser.c @@ -678,16 +678,16 @@ void initScreenBrowser() image = getImage(IMAGE_GROUP_BASE, "screen_main"); image_backgorund = newWidgetImage(0, 0, image); - button_back = newWidgetButton(getMyText("BACK"), 100, WINDOW_SIZE_Y-100, eventWidget); - button_play = newWidgetButton(getMyText("PLAY"), WINDOW_SIZE_X-200, WINDOW_SIZE_Y-100, eventWidget); - button_refresh = newWidgetButton(getMyText("REFRESH"), WINDOW_SIZE_X/2-50, WINDOW_SIZE_Y-100, eventWidget); - - label_server = newWidgetLabel(getMyText("SERVER"), 120, 145, WIDGET_LABEL_LEFT); - label_version = newWidgetLabel(getMyText("VERSION"), 290, 145, WIDGET_LABEL_LEFT); - label_address = newWidgetLabel(getMyText("ADDRESS"), 400, 145, WIDGET_LABEL_LEFT); - label_arena = newWidgetLabel(getMyText("ARENA"), 550, 145, WIDGET_LABEL_LEFT); - label_players = newWidgetLabel(getMyText("CLIENTS"), 645, 145, WIDGET_LABEL_LEFT); - label_ping = newWidgetLabel(getMyText("PING"), 720, 145, WIDGET_LABEL_LEFT); + button_back = newWidgetButton(_("back"), 100, WINDOW_SIZE_Y-100, eventWidget); + button_play = newWidgetButton(_("Play"), WINDOW_SIZE_X-200, WINDOW_SIZE_Y-100, eventWidget); + button_refresh = newWidgetButton(_("Refresh"), WINDOW_SIZE_X/2-50, WINDOW_SIZE_Y-100, eventWidget); + + label_server = newWidgetLabel(_("server"), 120, 145, WIDGET_LABEL_LEFT); + label_version = newWidgetLabel(_("version"), 290, 145, WIDGET_LABEL_LEFT); + label_address = newWidgetLabel(_("IP"), 400, 145, WIDGET_LABEL_LEFT); + label_arena = newWidgetLabel(_("arena"), 550, 145, WIDGET_LABEL_LEFT); + label_players = newWidgetLabel(_("clients"), 645, 145, WIDGET_LABEL_LEFT); + label_ping = newWidgetLabel(_("ping"), 720, 145, WIDGET_LABEL_LEFT); select_server = newWidgetSelect(50, label_server->y+40, eventWidget); diff --git a/src/screen/screen_choiceArena.c b/src/screen/screen_choiceArena.c index 336a9aa..1adb04d 100644 --- a/src/screen/screen_choiceArena.c +++ b/src/screen/screen_choiceArena.c @@ -140,8 +140,8 @@ void initScreenChoiceArena() image = getImage(IMAGE_GROUP_BASE, "screen_main"); image_backgorund = newWidgetImage(0, 0, image); - button_back = newWidgetButton(getMyText("BACK"), 100, WINDOW_SIZE_Y-100, eventWidget); - button_play = newWidgetButton(getMyText("PLAY"), WINDOW_SIZE_X-200, WINDOW_SIZE_Y-100, eventWidget); + button_back = newWidgetButton(_("back"), 100, WINDOW_SIZE_Y-100, eventWidget); + button_play = newWidgetButton(_("play"), WINDOW_SIZE_X-200, WINDOW_SIZE_Y-100, eventWidget); listWidgetButtonimage = newList(); choiceArenaId = 0; diff --git a/src/screen/screen_credits.c b/src/screen/screen_credits.c index 37f16ea..27ba838 100644 --- a/src/screen/screen_credits.c +++ b/src/screen/screen_credits.c @@ -103,7 +103,7 @@ void initScreenCredits() image = getImage(IMAGE_GROUP_BASE, "screen_main"); image_backgorund = newWidgetImage(0, 0, image); - button_back = newWidgetButton(getMyText("BACK"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, WINDOW_SIZE_Y-80, eventWidget); + button_back = newWidgetButton(_("back"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, WINDOW_SIZE_Y-80, eventWidget); listWidgetLabel = newList(); @@ -129,7 +129,7 @@ void initScreenCredits() creditExists = 0; widget_t *label; char *line; - line = "Credit file not found... %s/%s",PATH_DOC,SCREEN_CREDITS_FILE; + line = _("Credit file not found... %s/%s"),PATH_DOC,SCREEN_CREDITS_FILE; label = newWidgetLabel(line, WINDOW_SIZE_X/2, (WINDOW_SIZE_Y-100)+i*20, WIDGET_LABEL_CENTER); diff --git a/src/screen/screen_gameType.c b/src/screen/screen_gameType.c index 7dab4e4..71420d8 100644 --- a/src/screen/screen_gameType.c +++ b/src/screen/screen_gameType.c @@ -229,9 +229,9 @@ void initScreenGameType() image = getImage(IMAGE_GROUP_BASE, "screen_main"); image_backgorund = newWidgetImage(0, 0, image); - button_back = newWidgetButton(getMyText("BACK"), 100, WINDOW_SIZE_Y-100, eventWidget); - button_play = newWidgetButton(getMyText("PLAY"), WINDOW_SIZE_X-200, WINDOW_SIZE_Y-100, eventWidget); - button_browser = newWidgetButton(getMyText("BROWSER"), 300, 345, eventWidget); + button_back = newWidgetButton(_("back"), 100, WINDOW_SIZE_Y-100, eventWidget); + button_play = newWidgetButton(_("play"), WINDOW_SIZE_X-200, WINDOW_SIZE_Y-100, eventWidget); + button_browser = newWidgetButton(_("browser"), 300, 345, eventWidget); listChoiceGroup = newList(); check_none = newWidgetChoicegroup(100, 150, FALSE, listChoiceGroup, eventWidget); @@ -252,13 +252,13 @@ void initScreenGameType() setWidgetChoiceStatus(check_none, TRUE); } - label_none = newWidgetLabel(getMyText("NONE"), 130, 145, WIDGET_LABEL_LEFT); - label_server = newWidgetLabel(getMyText("SERVER"), 130, 195, WIDGET_LABEL_LEFT); - label_client = newWidgetLabel(getMyText("CLIENT"), 130, 245, WIDGET_LABEL_LEFT); + label_none = newWidgetLabel(_("Local game"), 130, 145, WIDGET_LABEL_LEFT); + label_server = newWidgetLabel(_("Set up a server"), 130, 195, WIDGET_LABEL_LEFT); + label_client = newWidgetLabel(_("Network game"), 130, 245, WIDGET_LABEL_LEFT); label_load_session = newWidgetLabel("load session", 130, 295, WIDGET_LABEL_LEFT); - label_ip = newWidgetLabel(getMyText("IP_ADDR"), 300, 145, WIDGET_LABEL_LEFT); - label_port = newWidgetLabel(getMyText("NET_PORT"), 300, 245, WIDGET_LABEL_LEFT); + label_ip = newWidgetLabel(_("IP"), 300, 145, WIDGET_LABEL_LEFT); + label_port = newWidgetLabel(_("port"), 300, 245, WIDGET_LABEL_LEFT); label_session = newWidgetLabel("load session :", 300, 145, WIDGET_LABEL_LEFT); textfield_ip = newWidgetTextfield( @@ -318,7 +318,7 @@ int getSettingGameType() return NET_GAME_TYPE_CLIENT; } - assert( ! "Chyba pri zistvani type hry !" ); + assert( ! _("Unknown game type!") ); return -1; } @@ -374,8 +374,9 @@ int getSettingProto() { return PROTO_UDPv6; } - - printf("IP protokol unknown !\n"); +#ifdef DEBUG + printf(_("Unknown IP protocol!\n")); +#endif return -1; } diff --git a/src/screen/screen_mainMenu.c b/src/screen/screen_mainMenu.c index 8c6e656..e5cae8f 100644 --- a/src/screen/screen_mainMenu.c +++ b/src/screen/screen_mainMenu.c @@ -102,11 +102,11 @@ void initScreenMainMenu() image = addImageData("screen_main.png", IMAGE_NO_ALPHA, "screen_main", IMAGE_GROUP_BASE); image_backgorund = newWidgetImage(0, 0, image); - button_play = newWidgetButton(getMyText("PLAY"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 200, eventWidget); - button_setting = newWidgetButton(getMyText("SETTING"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 250, eventWidget); - button_table = newWidgetButton(getMyText("TABLE"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 300, eventWidget); - button_credits = newWidgetButton(getMyText("CREDITS"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 350, eventWidget); - button_end = newWidgetButton(getMyText("END"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 400, eventWidget); + button_play = newWidgetButton(_("Start game"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 200, eventWidget); + button_setting = newWidgetButton(_("Settings"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 250, eventWidget); + button_table = newWidgetButton(_("Highscore"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 300, eventWidget); + button_credits = newWidgetButton(_("Credits"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 350, eventWidget); + button_end = newWidgetButton(_("Quit game"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, 400, eventWidget); #ifndef NO_SOUND addMusic("menu.ogg", "menu", MUSIC_GROUP_BASE); diff --git a/src/screen/screen_setting.c b/src/screen/screen_setting.c index 1f77d2a..46ea84a 100644 --- a/src/screen/screen_setting.c +++ b/src/screen/screen_setting.c @@ -223,15 +223,15 @@ static void initSettingFile() if( configFile == NULL ) { - fprintf(stderr, "Don't load %s\n", path); - fprintf(stderr, "I create %s\n", path); + fprintf(stderr, _("I am unable to load: \"%s\" !\n"), path); + fprintf(stderr, _("Creating: \"%s\"\n"), path); configFile = newTextFile(path); } if( configFile == NULL ) { - fprintf(stderr, "Don't create %s\n", path); + fprintf(stderr, _("I was unable to create: \"%s\" !\n"), path); return; } @@ -291,8 +291,7 @@ static void saveAndDestroyConfigFile() { if( configFile == NULL ) { - fprintf(stderr, "i can't save configure, " - "because config file not created !\n"); + fprintf(stderr, _("I am unable to save configure file, because config file was not initialised!\n")); return; } @@ -336,14 +335,14 @@ void initScreenSetting() image = getImage(IMAGE_GROUP_BASE, "screen_main"); image_backgorund = newWidgetImage(0, 0, image); - button_back = newWidgetButton(getMyText("BACK"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, eventWidget); - button_keys = newWidgetButton(getMyText("CONTROLS"), WINDOW_SIZE_X - 200, button_back->y - WIDGET_BUTTON_HEIGHT - 10, eventWidget); + button_back = newWidgetButton(_("back"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, eventWidget); + button_keys = newWidgetButton(_("controls"), WINDOW_SIZE_X - 200, button_back->y - WIDGET_BUTTON_HEIGHT - 10, eventWidget); #ifndef NO_SOUND - label_music = newWidgetLabel(getMyText("MUSIC"), 100, WINDOW_SIZE_Y-85, WIDGET_LABEL_LEFT); + label_music = newWidgetLabel(_("Music:"), 100, WINDOW_SIZE_Y-85, WIDGET_LABEL_LEFT); check_music = newWidgetCheck(label_music->x + label_music->w + 10, WINDOW_SIZE_Y-80, isMusicActive() , eventWidget); - label_sound = newWidgetLabel(getMyText("SOUND"), check_music->x + WIDGET_CHECK_WIDTH + 10, + label_sound = newWidgetLabel(_("Sound:"), check_music->x + WIDGET_CHECK_WIDTH + 10, WINDOW_SIZE_Y-85, WIDGET_LABEL_LEFT); check_sound = newWidgetCheck(label_sound->x + label_sound->w + 10, WINDOW_SIZE_Y-80, isSoundActive() , eventWidget); @@ -354,9 +353,9 @@ void initScreenSetting() check_ai = newWidgetCheck(label_ai->x + label_ai->w + 10, WINDOW_SIZE_Y-80, FALSE, eventWidget); - label_count_round = newWidgetLabel(getMyText("COUNT_ROUND"), 100, WINDOW_SIZE_Y-200, WIDGET_LABEL_LEFT); - label_name_player1 = newWidgetLabel(getMyText("NAME_PLAYER1"), 100, WINDOW_SIZE_Y-160, WIDGET_LABEL_LEFT); - label_name_player2 = newWidgetLabel(getMyText("NAME_PLAYER2"), 100, WINDOW_SIZE_Y-120, WIDGET_LABEL_LEFT); + label_count_round = newWidgetLabel(_("No. of rounds:"), 100, WINDOW_SIZE_Y-200, WIDGET_LABEL_LEFT); + label_name_player1 = newWidgetLabel(_("Player 1:"), 100, WINDOW_SIZE_Y-160, WIDGET_LABEL_LEFT); + label_name_player2 = newWidgetLabel(_("Player 2:"), 100, WINDOW_SIZE_Y-120, WIDGET_LABEL_LEFT); textfield_count_cound = newWidgetTextfield( getParamElse("--count", "15"), diff --git a/src/screen/screen_table.c b/src/screen/screen_table.c index 3c26c0a..fa8e738 100644 --- a/src/screen/screen_table.c +++ b/src/screen/screen_table.c @@ -96,7 +96,7 @@ static void setWidgetLabel() if( textFile == NULL ) { - fprintf(stderr, "File %s not loaded !", + fprintf(stderr, _("Highscore file: \"%s\" was not loaded!"), SCREEN_TABLE_FILE_HIGHSCORE_NAME); return; @@ -149,8 +149,8 @@ static void loadHighscoreFile() if( textFile == NULL ) { - fprintf(stderr, "I can't load %s !\n", path); - fprintf(stderr, "I create %s\n", path); + fprintf(stderr, _("I am unable to load: \"%s\" !\n"), path); + fprintf(stderr, _("Creating: \"%s\"\n"), path); textFile = newTextFile(path); } else @@ -160,7 +160,7 @@ static void loadHighscoreFile() if( textFile == NULL ) { - fprintf(stderr, "I can't create %s !\n", path); + fprintf(stderr, _("I was unable to create: \"%s\" !\n"), path); return; } @@ -208,7 +208,7 @@ void initScreenTable() image = addImageData("screen_table.png", IMAGE_NO_ALPHA, "screen_table", IMAGE_GROUP_BASE); image_backgorund = newWidgetImage(0, 0, image); - button_back = newWidgetButton(getMyText("BACK"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, + button_back = newWidgetButton(_("back"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, WINDOW_SIZE_Y-100, eventWidget); loadHighscoreFile(); diff --git a/src/screen/screen_world.c b/src/screen/screen_world.c index 4229556..cbfca38 100644 --- a/src/screen/screen_world.c +++ b/src/screen/screen_world.c @@ -64,7 +64,7 @@ void setGameType() if( ret != 0 ) { - fprintf(stderr, "Chyba inicalizacie sieti !\n"); + fprintf(stderr, _("Network initialization error!\n")); setWorldEnd(); } } @@ -432,7 +432,7 @@ void tuxControl(tux_t *p) switch( p->control ) { case TUX_CONTROL_NONE : - assert( ! "Tux nema definovane ovladanie !" ); + assert( ! _("Tux has not defined controls!") ); break; case TUX_CONTROL_KEYBOARD_LEFT : @@ -616,6 +616,8 @@ void initWorld() void quitWorld() { - printf("quit world\n"); +#ifdef DEBUG + printf(_("Quitting screen world\n")); +#endif isScreenWorldInit = FALSE; } diff --git a/src/server/heightScore.c b/src/server/heightScore.c index e29fad7..5c42ad6 100644 --- a/src/server/heightScore.c +++ b/src/server/heightScore.c @@ -19,19 +19,21 @@ void initHeightScore(char *file) if( textFile == NULL ) { - fprintf(stderr, "I can't load %s !\n", file); - fprintf(stderr, "I create %s\n", file); + fprintf(stderr, _("I am unable to load: \"%s\" !\n"), file); + fprintf(stderr, _("Creating: \"%s\"\n"), file); textFile = newTextFile(file); } else { - printf("I use %s as scorefile\n", file); +#ifdef DEBUG + printf(_("Scorefile: \"%s\"\n"), file); +#endif return; } if( textFile == NULL ) { - fprintf(stderr, "I can't create %s!\n", file); + fprintf(stderr, _("I was unable to create: \"%s\" !\n"), file); return; } diff --git a/src/server/log.c b/src/server/log.c index cf58e0f..b861b8b 100644 --- a/src/server/log.c +++ b/src/server/log.c @@ -17,12 +17,12 @@ int initLog(char *name) if( logFile == NULL ) { - printf("open file %s as log file failed !!!\n", name); + fprintf(stderr, _("Opening logfile \"%s\" failed!\n"), name); return -1; } - - printf("I use %s as log file\n", name); - +#ifdef DEBUG + printf(_("I use logfile: \"%s\")\n", name); +#endif addToLog(LOG_INF, "open log file"); return 0; @@ -45,7 +45,7 @@ void addToLog(int type, char *msg) case LOG_WRN : str_type = "WRN"; break; case LOG_ERR : str_type = "ERR"; break; default : - assert( ! "Bad log type !" ); + assert( ! _("Really bad log value!") ); break; } diff --git a/src/server/publicServer.c b/src/server/publicServer.c index e3df462..f26b25b 100644 --- a/src/server/publicServer.c +++ b/src/server/publicServer.c @@ -244,7 +244,7 @@ int initPublicServer() if( ret < 0 ) { - fprintf(stderr, "I down open log file !\n"); + fprintf(stderr, _("I was unable to open config file!\n")); return -1; } @@ -265,7 +265,7 @@ int initPublicServer() if( ret < 0 ) { - printf("Unable to initialize network socket!\n"); + printf(_("Unable to initialize network socket!\n")); return -1; } @@ -273,7 +273,7 @@ int initPublicServer() if (registerPublicServer() < 0) { - printf("Unable to contact MasterServer!\n"); + printf(_("Unable to contact MasterServer!)\n"); } return 0; @@ -317,14 +317,17 @@ void eventPublicServer() void my_handler_quit(int n) { +#ifdef DEBUG printf("my_handler_quit\n"); +#endif isSignalEnd = TRUE; } void quitPublicServer() { - printf("quit public server\n"); - +#ifdef DEBUG + printf(_("Quitting public server\n")); +#endif quitNetMultiplayer(); destroyArena(arena); diff --git a/src/server/serverConfigFile.c b/src/server/serverConfigFile.c index 31d3db3..487ec13 100644 --- a/src/server/serverConfigFile.c +++ b/src/server/serverConfigFile.c @@ -39,13 +39,13 @@ void initServerConfigFile() char *configFile; configFile = getParamElse("--config-file", SERVER_CONFIG); - printf("load configuration from %s\n", getParamElse("--config-file", SERVER_CONFIG) ); + printf(_("Loading configuration from: \"%s\"\n"), getParamElse("--config-file", SERVER_CONFIG) ); serverTextFile = loadTextFile(configFile); if( serverTextFile == NULL ) { - fprintf(stderr, "I dont load config file, I used default values\n"); + fprintf(stderr, _("I was unable to load config file. Falling back to defaults!\n")); return; } diff --git a/src/widget/widget_button.c b/src/widget/widget_button.c index add6adf..d52be75 100644 --- a/src/widget/widget_button.c +++ b/src/widget/widget_button.c @@ -86,7 +86,9 @@ void eventWidgetButton(widget_t *widget) isMouseClicked() ) { time = WIDGET_BUTTON_TIME; - printf("event\n"); +#ifdef DEBUG + printf(_("Event caught\n")); +#endif p->fce_event(widget); } } diff --git a/src/widget/widget_textfield.c b/src/widget/widget_textfield.c index 0e5576b..e44bcd6 100644 --- a/src/widget/widget_textfield.c +++ b/src/widget/widget_textfield.c @@ -179,7 +179,7 @@ static void checkText(widget_textfield_t *p) break; default : - assert( ! "bad filter" ); + assert( ! _("Bad filter!") ); break; } |