From d9e19a0d5ba8a797e12052e29f9c3a945d2331bc Mon Sep 17 00:00:00 2001 From: oroborus Date: Fri, 14 Mar 2008 22:11:31 +0000 Subject: - upravy v kode, lepsia synchronizacia - clienty posielaju serveru "pingy", ak server isty cas ping od client anedostane tak ho dpoji ( nespojive UDP ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@16 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/tux.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/tux.c') diff --git a/src/tux.c b/src/tux.c index a39c3d2..b007a93 100644 --- a/src/tux.c +++ b/src/tux.c @@ -346,7 +346,8 @@ void eventTuxIsDead(tux_t *tux) return; } - playSound("dead", SOUND_GROUP_BASE); + playSound("dead", SOUND_GROUP_BASE); + printf("tux id %d is dead\n", tux->id); tux->status = TUX_STATUS_DEAD; memset(tux->shot, 0, sizeof(int) * GUN_COUNT); @@ -364,11 +365,22 @@ void eventTuxIsDead(tux_t *tux) { addTimer(timer_spawnTux, newInt(tux->id), TUX_TIME_SPAWN ); } + + if( getNetTypeGame() == NET_GAME_TYPE_SERVER ) + { + proto_send_kill_server(tux); + } } static void eventTuxIsDeadWIthShot(tux_t *tux, shot_t *shot) { shot->author->score++; + + if( getNetTypeGame() == NET_GAME_TYPE_SERVER ) + { + proto_send_score_server(shot->author); + } + countRoundInc(); eventTuxIsDead(tux); } @@ -378,10 +390,14 @@ void tuxTeleport(tux_t *tux) int x, y; playSound("teleport", SOUND_GROUP_BASE); + printf("tux id %d teleporting\n", tux->id); + + if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) + { + findFreeSpace(&x, &y, TUX_WIDTH, TUX_HEIGHT); + setTuxProportion(tux, x, y); + } - findFreeSpace(&x, &y, TUX_WIDTH, TUX_HEIGHT); - setTuxProportion(tux, x, y); - if( getNetTypeGame() == NET_GAME_TYPE_SERVER ) { proto_send_newtux_server(NULL, tux); @@ -420,7 +436,10 @@ void eventConflictTuxWithShot(list_t *listTux, list_t *listShot) continue; } - eventTuxIsDeadWIthShot(thisTux, thisShot); + if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) + { + eventTuxIsDeadWIthShot(thisTux, thisShot); + } } delListItem(listShot, i, destroyShot); -- cgit v1.2.3