From 437da38a26548714e6e1640722148f0f9f601ccb Mon Sep 17 00:00:00 2001 From: oroborus Date: Mon, 17 Mar 2008 20:29:34 +0000 Subject: - opravena chyba, clent nacital iba _jeden_ sietovy packet za 50 ms ( ano aj ked ich prislo viacej) - server pinguje clientov a na zaklade toho client vie, ci server nespadol - publicserver sa da korektne vypnut signalom SIGQUIT - publicserver bol pretiahnuty cez valgrind, teraz za pocet volani funkcie malloc rovna poctu volani funkcie free - v sietovom multiplayeri sa da chodit cez teleporty a strielat do teleportov - do rur sa da siez strielat git-svn-id: http://opensvn.csie.org/tuxanci_ng@24 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- Makefile | 2 +- control | 4 +- deb-build.sh | 2 +- include/client.h | 6 +- include/interface.h | 2 +- include/proto.h | 5 ++ include/publicServer.h | 3 +- include/server.h | 4 +- include/shot.h | 4 ++ src/client.c | 156 +++++++++++++++++++++++++++++++++---------------- src/main.c | 12 +++- src/proto.c | 70 +++++++++++++++++++++- src/publicServer.c | 27 ++++++++- src/screen_world.c | 21 +++++-- src/server.c | 19 +++++- src/shot.c | 12 +++- src/teleport.c | 19 +++++- src/tux.c | 5 +- 18 files changed, 298 insertions(+), 75 deletions(-) diff --git a/Makefile b/Makefile index 64123f9..d65b6ba 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ tuxstat: cat /proc/`pidof tuxanci-ng`/status line: - cat src/*.c include*.h | wc -l + cat src/*.c include/*.h | wc -l core: gcore `pidof publicserver` diff --git a/control b/control index 0d006a7..fa42fb9 100644 --- a/control +++ b/control @@ -1,8 +1,8 @@ Package: tuxanci-ng -Version: svn13 +Version: svn23 Section: Game Priority: optional -Depends: libc6 (>= 2.2.4-4), libsdl1.2debian (>= 1.2), libsdl-image1.2 (>= 1.2), libsdl-mixer1.2 (>= 1.2), libsdl-ttf2.0-0 (>= 2.0) +Depends: libc6 (>= 2.2.4-4), libsdl1.2debian (>= 1.2), libsdl-image1.2 (>= 1.2), libsdl-mixer1.2 (>= 1.2), libsdl-net1.2 (>= 1.2), libsdl-ttf2.0-0 (>= 2.0) Architecture: i386 Installed-Size: 4510 Maintainer: Dušan Ďurech diff --git a/deb-build.sh b/deb-build.sh index 5e8f0d3..e81dca3 100755 --- a/deb-build.sh +++ b/deb-build.sh @@ -23,4 +23,4 @@ md5sum `find ./ -type f | awk '/.\// { print substr($0, 3) }'` > DEBIAN/md5sums cd .. rm -rf *.deb -dpkg -b ./deb tuxanci-ng_svn13-1_i386.deb +dpkg -b ./deb tuxanci-ng_svn`cat deb-ver`_i386.deb diff --git a/include/client.h b/include/client.h index 6aa4d58..6c827f7 100644 --- a/include/client.h +++ b/include/client.h @@ -5,7 +5,8 @@ #if defined SUPPORT_NET_UNIX_UDP || defined SUPPORT_NET_SDL_UDP -#define CLIENT_TIMEOUT 2500 +#define CLIENT_TIMEOUT 2500 +#define SERVER_TIMEOUT_ALIVE 5000 #endif @@ -19,6 +20,7 @@ extern void quitTcpClient(); extern int initUdpClient(char *ip, int port); extern void eventPingServer(); extern void selectClientUdpSocket(); +extern void refreshPingServerAlive(); extern void quitUdpClient(); #endif @@ -26,6 +28,8 @@ extern void quitUdpClient(); extern int initSdlUdpClient(char *ip, int port); extern void eventPingServer(); extern void selectClientSdlUdpSocket(); +extern void refreshPingServerAlive(); +extern bool_t isServerAlive(); extern void quitSdlUdpClient(); #endif diff --git a/include/interface.h b/include/interface.h index 720676e..a65ffa4 100755 --- a/include/interface.h +++ b/include/interface.h @@ -19,7 +19,7 @@ #define SDL_SUBSYSTEMS SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_DOUBLEBUF //napis na okne -#define WINDOW_TITLE "Tuxanci next generation SVN revision 13" +#define WINDOW_TITLE "Tuxanci next generation SVN revision 23" #define WIN_BPP 0 #define USR_EVT_TIMER 0 diff --git a/include/proto.h b/include/proto.h index cc17f79..5e50965 100644 --- a/include/proto.h +++ b/include/proto.h @@ -6,6 +6,7 @@ #include "tux.h" #include "server.h" #include "item.h" +#include "shot.h" extern void proto_send_hello_client(); extern void proto_recv_hello_server(client_t *client, char *msg); @@ -25,10 +26,14 @@ extern void proto_send_deltux_server(client_t *client); extern void proto_recv_deltux_client(char *msg); extern void proto_send_additem_server(item_t *p); extern void proto_recv_additem_client(char *msg); +extern void proto_send_shot_server(shot_t *p); +extern void proto_recv_shot_client(char *msg); extern void proto_send_context_client(tux_t *tux); extern void proto_recv_context_server(client_t *client, char *msg); extern void proto_send_ping_client(); extern void proto_recv_ping_server(client_t *client, char *msg); +extern void proto_send_ping_server(); +extern void proto_recv_ping_client(char *msg); extern void proto_send_end_client(); extern void proto_recv_end_server(client_t *client, char *msg); extern void proto_send_end_server(); diff --git a/include/publicServer.h b/include/publicServer.h index 9c3a367..9b453d7 100644 --- a/include/publicServer.h +++ b/include/publicServer.h @@ -7,12 +7,13 @@ extern arena_t* getWorldArena(); extern void countRoundInc(); -extern void initPublicServer(); +extern int initPublicServer(); extern int getChoiceArenaId(); extern int conflictSpace(int x1,int y1,int w1,int h1,int x2,int y2,int w2,int h2); extern int isFreeSpace(int x, int y, int w, int h); extern void findFreeSpace(int *x, int *y, int w, int h); extern void eventPublicServer(); +extern void my_handler_quit(int n); extern void quitPublicServer(); #endif diff --git a/include/server.h b/include/server.h index f35f155..623a12e 100644 --- a/include/server.h +++ b/include/server.h @@ -21,7 +21,7 @@ #include "udp.h" #define SERVER_TIMEOUT 5000 -#define SERVER_TIME_SYNC 5000 +#define SERVER_TIME_SYNC 1000 #endif @@ -30,7 +30,7 @@ #include "sdl_udp.h" #define SERVER_TIMEOUT 5000 -#define SERVER_TIME_SYNC 5000 +#define SERVER_TIME_SYNC 1000 #endif diff --git a/include/shot.h b/include/shot.h index 22fb2f5..d0460e2 100644 --- a/include/shot.h +++ b/include/shot.h @@ -1,6 +1,8 @@ #ifndef SHOT_H +#define SHOT_H + #include "main.h" #ifndef BUBLIC_SERVER #include "interface.h" @@ -42,6 +44,8 @@ extern void drawListShot(list_t *listShot); extern int isConflictWithListShot(list_t *listShot, int x, int y, int w, int h); extern void eventMoveListShot(list_t *listShot); +extern void transformOnlyLasser(shot_t *shot); + extern void moveShot(shot_t *shot, int position, int src_x, int src_y, int dist_x, int dist_y, int dist_w, int dist_h); diff --git a/src/client.c b/src/client.c index a238373..9dfeda5 100644 --- a/src/client.c +++ b/src/client.c @@ -31,11 +31,13 @@ static sock_sdl_udp_t *sock_server_sdl_udp; static buffer_t *clientBuffer; static my_time_t lastPing; +static my_time_t lastPingServerAlive; static void initClient() { clientBuffer = newBuffer( LIMIT_BUFFER ); lastPing = getMyTime(); + lastPingServerAlive = getMyTime(); proto_send_hello_client(); } @@ -110,15 +112,6 @@ void sendServer(char *msg) #ifdef SUPPORT_NET_UNIX_TCP ret = writeTcpSocket(sock_server_tcp, msg, strlen(msg)); -#endif - -#ifdef SUPPORT_NET_UNIX_UDP - ret = writeUdpSocket(sock_server_udp, sock_server_udp, msg, strlen(msg)); -#endif - -#ifdef SUPPORT_NET_SDL_UDP - ret = writeSdlUdpSocket(sock_server_sdl_udp, sock_server_sdl_udp, msg, strlen(msg)); -#endif if ( ret == 0 ) { @@ -131,9 +124,18 @@ void sendServer(char *msg) fprintf(stderr, "nastala chyba pri poslani spravy serveru\n"); setWorldEnd(); } +#endif + +#ifdef SUPPORT_NET_UNIX_UDP + ret = writeUdpSocket(sock_server_udp, sock_server_udp, msg, strlen(msg)); +#endif + +#ifdef SUPPORT_NET_SDL_UDP + ret = writeSdlUdpSocket(sock_server_sdl_udp, sock_server_sdl_udp, msg, strlen(msg)); +#endif } -static void eventServerSelect() +static int eventServerSelect() { char buffer[STR_SIZE]; int ret; @@ -142,6 +144,20 @@ static void eventServerSelect() #ifdef SUPPORT_NET_UNIX_TCP ret = readTcpSocket(sock_server_tcp, buffer, STR_SIZE-1); + + if( ret == 0 ) + { + fprintf(stderr, "server uzatovril sietovy socket\n"); + setWorldEnd(); + return ret; + } + + if( ret < 0 ) + { + fprintf(stderr, "chyba, spojenie prerusene \n"); + setWorldEnd(); + return ret; + } #endif #ifdef SUPPORT_NET_UNIX_UDP @@ -153,30 +169,18 @@ static void eventServerSelect() if( ret < 0 ) { - return; + return ret; } #endif - if( ret == 0 ) - { - fprintf(stderr, "server uzatovril sietovy socket\n"); - setWorldEnd(); - return; - } - - if( ret < 0 ) - { - fprintf(stderr, "chyba, spojenie prerusene \n"); - setWorldEnd(); - return; - } - if( addBuffer(clientBuffer, buffer, ret) != 0 ) { fprintf(stderr, "chyba, nemozem zapisovat do mojho buffera !\n"); setWorldEnd(); - return; + return ret; } + + return ret; } void eventServerBuffer() @@ -189,15 +193,17 @@ void eventServerBuffer() while ( getBufferLine(clientBuffer, line, STR_SIZE) >= 0 ) { - printf("spracuvavam %s", line); + //printf("spracuvavam %s", line); if( strncmp(line, "init", 4) == 0 )proto_recv_init_client(line); if( strncmp(line, "event", 5) == 0 )proto_recv_event_client(line); if( strncmp(line, "newtux", 6) == 0 )proto_recv_newtux_client(line); if( strncmp(line, "deltux", 6) == 0 )proto_recv_deltux_client(line); if( strncmp(line, "additem", 7) == 0 )proto_recv_additem_client(line); + if( strncmp(line, "shot", 4) == 0 )proto_recv_shot_client(line); if( strncmp(line, "kill", 4) == 0 )proto_recv_kill_client(line); if( strncmp(line, "score", 5) == 0 )proto_recv_score_client(line); + if( strncmp(line, "ping", 4) == 0 )proto_recv_ping_client(line); if( strncmp(line, "end", 3) == 0 )proto_recv_end_client(line); } } @@ -209,20 +215,27 @@ void selectClientTcpSocket() fd_set readfds; struct timeval tv; int max_fd; + bool_t isNext; - tv.tv_sec = 0; - tv.tv_usec = 0; - - FD_ZERO(&readfds); - FD_SET(sock_server_tcp->sock, &readfds); - max_fd = sock_server_tcp->sock; + do{ + isNext = FALSE; - select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); + tv.tv_sec = 0; + tv.tv_usec = 0; + + FD_ZERO(&readfds); + FD_SET(sock_server_tcp->sock, &readfds); + max_fd = sock_server_tcp->sock; + + select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); + + if( FD_ISSET(sock_server_tcp->sock, &readfds) ) + { + eventServerSelect(); + isNext = TRUE; + } - if( FD_ISSET(sock_server_tcp->sock, &readfds) ) - { - eventServerSelect(); - } + }while( isNext == TRUE ); } #endif @@ -242,6 +255,25 @@ void eventPingServer() } } +void refreshPingServerAlive() +{ + lastPingServerAlive = getMyTime(); +} + +bool_t isServerAlive() +{ + my_time_t currentTime; + + currentTime = getMyTime(); + + if( currentTime - lastPingServerAlive > SERVER_TIMEOUT_ALIVE ) + { + return FALSE; + } + + return TRUE; +} + #endif #ifdef SUPPORT_NET_UNIX_UDP @@ -251,20 +283,35 @@ void selectClientUdpSocket() fd_set readfds; struct timeval tv; int max_fd; + bool_t isNext; + + if( isServerAlive() == FALSE ) + { + fprintf(stderr, "server neodpoveda !\n"); + setWorldEnd(); + return; + } + + do{ + isNext = FALSE; - tv.tv_sec = 0; - tv.tv_usec = 0; + tv.tv_sec = 0; + tv.tv_usec = 0; + + FD_ZERO(&readfds); + FD_SET(sock_server_udp->sock, &readfds); + max_fd = sock_server_udp->sock; - FD_ZERO(&readfds); - FD_SET(sock_server_udp->sock, &readfds); - max_fd = sock_server_udp->sock; + select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); + + if( FD_ISSET(sock_server_udp->sock, &readfds) ) + { + eventServerSelect(); + isNext = TRUE; + } - select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); + }while( isNext == TRUE ); - if( FD_ISSET(sock_server_udp->sock, &readfds) ) - { - eventServerSelect(); - } } #endif @@ -273,7 +320,18 @@ void selectClientUdpSocket() void selectClientSdlUdpSocket() { - eventServerSelect(); + int ret; + + if( isServerAlive() == FALSE ) + { + fprintf(stderr, "server neodpoveda !\n"); + setWorldEnd(); + return; + } + + do{ + ret = eventServerSelect(); + }while( ret > 0); } #endif diff --git a/src/main.c b/src/main.c index 384285f..41dc5f7 100644 --- a/src/main.c +++ b/src/main.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "main.h" #include "tux.h" @@ -169,7 +170,16 @@ int main(int argc, char *argv[]) #ifdef BUBLIC_SERVER - initPublicServer(); + signal(SIGPIPE, SIG_IGN); + signal(SIGINT, my_handler_quit); + signal(SIGTERM, my_handler_quit); + signal(SIGQUIT, my_handler_quit); + + if( initPublicServer() < 0 ) + { + quitPublicServer(); + return -1; + } while(1) { diff --git a/src/proto.c b/src/proto.c index 0af969f..0cda257 100644 --- a/src/proto.c +++ b/src/proto.c @@ -8,6 +8,7 @@ #include "list.h" #include "tux.h" #include "item.h" +#include "shot.h" #include "arenaFile.h" #include "myTimer.h" #include "server.h" @@ -42,7 +43,6 @@ void proto_recv_hello_server(client_t *client, char *msg) { } - void proto_send_init_server(client_t *client) { char msg[STR_SIZE]; @@ -54,7 +54,6 @@ void proto_send_init_server(client_t *client) getSettingCountRound(&n); #endif - sprintf(msg, "init %d %d %d %d %s\n", client->tux->id, client->tux->x, client->tux->y, n, getArenaNetName( getChoiceArenaId() )); @@ -377,6 +376,53 @@ void proto_recv_additem_client(char *msg) #endif +void proto_send_shot_server(shot_t *p) +{ + char msg[STR_SIZE]; + int id = -1; + + assert( p != NULL ); + + if( p->author != NULL ) + { + id = p->author->id; + } + + sprintf(msg, "shot %d %d %d %d %d %d %d %d\n", + p->x, p->y, p->px, p->py, p->position, p->gun, id, p->isCanKillAuthor); + + sendAllClient(msg); +} + +#ifndef BUBLIC_SERVER + +void proto_recv_shot_client(char *msg) +{ + char cmd[STR_SIZE]; + int x, y, px, py, position, gun, id, isCanKillAuthor; + shot_t *shot; + + assert( msg != NULL ); + + sscanf(msg, "%s %d %d %d %d %d %d %d %d\n", + cmd, &x, &y, &px, &py, &position, &gun, &id, &isCanKillAuthor); + + shot = newShot(x, y, px, py, gun, getTuxID(getWorldArena()->listTux, id)); + + shot->isCanKillAuthor = isCanKillAuthor; + shot->position = position; + + if( shot->gun == GUN_LASSER ) + { + printf("transform\n"); + transformOnlyLasser(shot); + } + + addList(getWorldArena()->listShot, shot); +} + +#endif + #ifndef BUBLIC_SERVER void proto_send_context_client(tux_t *tux) @@ -447,6 +493,26 @@ void proto_recv_end_server(client_t *client, char *msg) client->status = NET_STATUS_ZOMBIE; } +void proto_send_ping_server() +{ + char msg[STR_SIZE]; + strcpy(msg, "ping\n"); + sendAllClient(msg); +} + +#ifndef BUBLIC_SERVER + +void proto_recv_ping_client(char *msg) +{ + assert( msg != NULL ); + +#if defined SUPPORT_NET_UNIX_UDP || defined SUPPORT_NET_SDL_UDP + refreshPingServerAlive(); +#endif +} + +#endif + void proto_send_end_server() { char msg[STR_SIZE]; diff --git a/src/publicServer.c b/src/publicServer.c index 8206062..7e1d56e 100644 --- a/src/publicServer.c +++ b/src/publicServer.c @@ -21,6 +21,7 @@ static int arenaId; static arena_t *arena; +static bool_t isSignalEnd; arena_t* getWorldArena() { @@ -31,7 +32,7 @@ void countRoundInc() { } -void initPublicServer() +int initPublicServer() { initArenaFile(); initTux(); @@ -42,8 +43,15 @@ void initPublicServer() arenaId = getArenaIdFormNetName( getParamElse("--arena", "FAGN") ); arena = getArena(arenaId); addNewItem(arena->listItem, NULL); + isSignalEnd = FALSE; - initNetMuliplayer(NET_GAME_TYPE_SERVER, NULL, atoi( getParamElse("--port", "2200") ) ); + if( initNetMuliplayer(NET_GAME_TYPE_SERVER, NULL, atoi( getParamElse("--port", "2200") ) ) < 0 ) + { + printf("Nemozem inicalizovat sietovy socket !\n"); + return -1; + } + + return 0; } int getChoiceArenaId() @@ -92,6 +100,11 @@ void eventPublicServer() eventNetMultiplayer(); + if( isSignalEnd == TRUE ) + { + quitPublicServer(); + } + if( lastActive == 0 ) { lastActive = getMyTime(); @@ -103,6 +116,7 @@ void eventPublicServer() { return; } + /* printf("interval = %d\n", interval); */ @@ -123,10 +137,19 @@ void eventPublicServer() eventTimer(); } +void my_handler_quit(int n) +{ + printf("my_handler_quit\n"); + isSignalEnd = TRUE; +} + void quitPublicServer() { printf("quit public server\n"); quitNetMultiplayer(); destroyArena(arena); + quitArenaFile(); quitTimer(); + exit(0); } + diff --git a/src/screen_world.c b/src/screen_world.c index 7e63cd0..45daee5 100644 --- a/src/screen_world.c +++ b/src/screen_world.c @@ -363,6 +363,8 @@ void eventWorld() if( arena == NULL ) { eventNetMultiplayer(); + eventEnd(); + eventEsc(); return; } @@ -381,8 +383,8 @@ void eventWorld() eventTimer(); eventNetMultiplayer(); - eventEsc(); eventEnd(); + eventEsc(); } void startWorld() @@ -439,12 +441,21 @@ static void setTable() void stoptWorld() { - setTable(); - setAnalyze(); - delAllImageInGroup(IMAGE_GROUP_USER); + if( arena != NULL ) + { + setTable(); + setAnalyze(); + } + quitNetMultiplayer(); - destroyArena(arena); + + if( arena != NULL ) + { + destroyArena(arena); + } + stopMusic(); + delAllImageInGroup(IMAGE_GROUP_USER); delAllMusicInGroup(MUSIC_GROUP_USER); quitTimer(); } diff --git a/src/server.c b/src/server.c index 032a210..2a259c5 100644 --- a/src/server.c +++ b/src/server.c @@ -3,6 +3,12 @@ #include #include +#include +#include +#include +#include +#include + #include "list.h" #include "tux.h" #include "network.h" @@ -44,7 +50,7 @@ static my_time_t lastSyncClient; void static initServer() { listClient = newList(); - lastSyncClient = getMyTime(); + lastSyncClient = getMyTime(); } #ifdef SUPPORT_NET_UNIX_TCP @@ -495,6 +501,8 @@ void eventPeriodicSyncClient() client_t *thisClientSend; tux_t *thisTux; int i, j; + + proto_send_ping_server(); #ifndef BUBLIC_SERVER proto_send_newtux_server(NULL, @@ -557,6 +565,7 @@ static void eventClientUdpSelect(sock_udp_t *sock_server) isCreateNewClient = FALSE; memset(buffer, 0, STR_SIZE); + ret = readUdpSocket(sock_server, sock_client, buffer, STR_SIZE-1); client = findUdpClient(sock_client); @@ -597,6 +606,7 @@ void selectServerUdpSocket() struct timeval tv; fd_set readfds; int max_fd; + int ret; #ifndef BUBLIC_SERVER tv.tv_sec = 0; @@ -614,7 +624,12 @@ void selectServerUdpSocket() delZombieCLient(); - select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); + ret = select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); + + if( ret < 0 ) + { + return; + } /* printf("%d\n", tv.tv_usec); diff --git a/src/shot.c b/src/shot.c index b8bec35..d105a5c 100644 --- a/src/shot.c +++ b/src/shot.c @@ -6,6 +6,8 @@ #include "main.h" #include "shot.h" #include "gun.h" +#include "net_multiplayer.h" +#include "proto.h" #ifndef BUBLIC_SERVER #include "image.h" @@ -191,7 +193,7 @@ static int getSppedShot(shot_t *shot) return ( myAbs(shot->px) > myAbs(shot->py) ? myAbs(shot->px) : myAbs(shot->py) ); } -static void eventOnlyLasser(shot_t *shot) +void transformOnlyLasser(shot_t *shot) { switch( shot->position ) { @@ -248,7 +250,7 @@ static void transformShot(shot_t *shot, int position) if( shot->gun == GUN_LASSER ) { - eventOnlyLasser(shot); + transformOnlyLasser(shot); } } @@ -294,6 +296,12 @@ void moveShot(shot_t *shot, int position, int src_x, int src_y, shot->y = dist_y + dist_h; break; } + + if( getNetTypeGame() == NET_GAME_TYPE_SERVER ) + { + proto_send_shot_server(shot); + } + } void destroyShot(shot_t *p) diff --git a/src/teleport.c b/src/teleport.c index 05cacd9..b004589 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -6,6 +6,8 @@ #include "tux.h" #include "teleport.h" #include "shot.h" +#include "net_multiplayer.h" +#include "proto.h" #ifndef BUBLIC_SERVER #include "layer.h" @@ -156,7 +158,15 @@ void eventConflictShotWithTeleport(list_t *listTeleport, list_t *listShot) continue; } - moveShotFromTeleport(thisShot, thisTeleport, listTeleport); + if( getNetTypeGame() == NET_GAME_TYPE_CLIENT ) + { + delListItem(listShot, i, destroyShot); + i--; + } + else + { + moveShotFromTeleport(thisShot, thisTeleport, listTeleport); + } } } } @@ -167,7 +177,8 @@ void eventTeleportTux(list_t *listTeleport, teleport_t *teleport, tux_t *tux) int current_x, current_y; int dist_x, dist_y; - if( tux->bonus == BONUS_GHOST ) + if( tux->bonus == BONUS_GHOST || + getNetTypeGame() == NET_GAME_TYPE_CLIENT ) { return; } @@ -209,6 +220,10 @@ void eventTeleportTux(list_t *listTeleport, teleport_t *teleport, tux_t *tux) #ifndef BUBLIC_SERVER playSound("teleport", SOUND_GROUP_BASE); #endif + if( getNetTypeGame() == NET_GAME_TYPE_SERVER ) + { + proto_send_newtux_server(NULL, tux); + } } } diff --git a/src/tux.c b/src/tux.c index 68af525..0243ee3 100644 --- a/src/tux.c +++ b/src/tux.c @@ -491,7 +491,10 @@ void eventConflictTuxWithTeleport(list_t *listTux, list_t *listTeleport) if( ( thisTux = isConflictWithListTux(listTux, thisTeleport->x, thisTeleport->y, thisTeleport->w, thisTeleport->h) ) != NULL ) { - eventTeleportTux(listTeleport, thisTeleport, thisTux); + if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) + { + eventTeleportTux(listTeleport, thisTeleport, thisTux); + } } } } -- cgit v1.2.3