From 44404eb5063bd5f040c7a4d8605aa3d43e3a968a Mon Sep 17 00:00:00 2001 From: oroborus Date: Sun, 2 Mar 2008 19:41:48 +0000 Subject: - par uprav - dopisany credits git-svn-id: http://opensvn.csie.org/tuxanci_ng@8 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/screen_world.c | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'src/screen_world.c') diff --git a/src/screen_world.c b/src/screen_world.c index 1f91cc6..b7895e6 100644 --- a/src/screen_world.c +++ b/src/screen_world.c @@ -33,6 +33,7 @@ static int count; static int max_count; static bool_t isScreenWorldInit = FALSE; +static bool_t isEndWorld; bool_t isScreenWorldInicialized() { @@ -41,14 +42,22 @@ bool_t isScreenWorldInicialized() void setGameType() { + int ret = 0; + if( getSettingGameType() == NET_GAME_TYPE_SERVER ) { - initServer( getSettingPort() ); + ret = initServer( getSettingPort() ); } if( getSettingGameType() == NET_GAME_TYPE_CLIENT ) { - initClient( getSettingPort() , getSettingIP() ); + ret = initClient( getSettingPort() , getSettingIP() ); + } + + if( ret != 0 ) + { + fprintf(stderr, "Chyba inicalizacie sieti !\n"); + setWorldEnd(); } } @@ -68,11 +77,16 @@ void setMaxCountRound(int n) max_count = n; } +void setWorldEnd() +{ + isEndWorld = TRUE; +} + static void timer_endArena() { if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) { - setScreen("analyze"); + setWorldEnd(); return; } } @@ -287,23 +301,26 @@ static void control_keyboard_left(tux_t *tux) if( mapa[(SDLKey)SDLK_TAB] == SDL_PRESSED )actionTux(tux, TUX_SWITCH_GUN); } -static void eventEnd() +static void eventEsc() { Uint8 *mapa; mapa = SDL_GetKeyState(NULL); if( mapa[(SDLKey)SDLK_ESCAPE] == SDL_PRESSED ) { - setScreen("analyze"); + isEndWorld = TRUE; + setWorldEnd(); return; } -/* - if( count >= max_count && getNetTypeGame() != NET_GAME_TYPE_CLIENT ) +} + +static void eventEnd() +{ + if( isEndWorld == TRUE ) { setScreen("analyze"); return; } -*/ } void tuxControl(tux_t *p) @@ -339,23 +356,24 @@ void eventWorld() return; } - eventListTux(arena->listTux); - eventConflictShotWithTux(arena->listTux, arena->listShot); eventConflictShotWithWall(arena->listWall, arena->listShot); eventMoveListShot(arena->listShot); eventListItem(arena->listItem); eventConflictShotWithItem(arena->listItem, arena->listShot); - eventTimer(); + eventListTux(arena->listTux); + eventTimer(); eventNetMultiplayer(); + eventEsc(); eventEnd(); } void startWorld() { arena = NULL; + isEndWorld = FALSE; count = 0; -- cgit v1.2.3