summaryrefslogtreecommitdiff
path: root/src/tux.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-14 22:11:31 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-14 22:11:31 +0000
commitd9e19a0d5ba8a797e12052e29f9c3a945d2331bc (patch)
tree95e18dfbf1879b5edd973d81003a43955adb141b /src/tux.c
parent593ac1e25c2053f06cb1b7e29785a695d3c57ad3 (diff)
- 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
Diffstat (limited to 'src/tux.c')
-rw-r--r--src/tux.c29
1 files changed, 24 insertions, 5 deletions
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);