summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/client.c37
-rw-r--r--src/client/configFile.c5
-rwxr-xr-xsrc/client/font.c10
-rw-r--r--src/client/game.c10
-rwxr-xr-xsrc/client/image.c15
-rwxr-xr-xsrc/client/interface.c21
-rwxr-xr-xsrc/client/interface.h2
-rw-r--r--src/client/keyboardBuffer.c6
-rw-r--r--src/client/saveLoad.c14
-rw-r--r--src/client/screen.c14
10 files changed, 77 insertions, 57 deletions
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();
}