diff options
| -rwxr-xr-x | build.sh | 4 | ||||
| -rw-r--r-- | config.h | 2 | ||||
| -rw-r--r-- | control | 2 | ||||
| -rwxr-xr-x | deb-build.sh | 29 | ||||
| -rw-r--r-- | include/main.h | 7 | ||||
| -rw-r--r-- | r | 1 | ||||
| -rw-r--r-- | src/publicServer.c | 1 | ||||
| -rw-r--r-- | src/server.c | 96 | ||||
| -rw-r--r-- | src/tux.c | 5 | ||||
| -rwxr-xr-x | tarball-build.sh | 51 | ||||
| -rwxr-xr-x | tarballbin-build.sh | 44 |
11 files changed, 138 insertions, 104 deletions
@@ -1,5 +1,7 @@ #!/bin/bash +mv config.h zal_config.h + rm -rf deb myusr tuxanci-ng_svn*_i386.deb rm -rf tuxanci_ng-i386-bin tuxanci_ng-i386-bin tuxanci_ng-i386-bin.tar.bz2 rm -rf tuxanci_ng tuxanci_ng.tar tuxanci_ng.tar.bz2 @@ -25,3 +27,5 @@ mkdir myusr/share make install DISTDIR=./myusr/ mv config.h path_config.h ./deb-build.sh + +mv zal_config.h config.h
\ No newline at end of file diff --git a/config.h b/config.h new file mode 100644 index 0000000..d4a9c3d --- /dev/null +++ b/config.h @@ -0,0 +1,2 @@ +#define DISTDIR "/usr/" +#define SUPPORT_NET_SDL_UDP @@ -1,5 +1,5 @@ Package: tuxanci-ng -Version: svn23 +Version: svn25 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-net1.2 (>= 1.2), libsdl-ttf2.0-0 (>= 2.0) diff --git a/deb-build.sh b/deb-build.sh index f87c7ed..83730e7 100755 --- a/deb-build.sh +++ b/deb-build.sh @@ -1,26 +1,33 @@ #!/bin/sh -rm -rf deb +PROJECT="tuxanci-ng" +DEB_DIR="deb" +DEB_ARCH="i386" +DEB_NAME="tuxanci-ng_svn" -mkdir deb -mkdir deb/DEBIAN -mkdir deb/usr -mkdir deb/usr/bin -mkdir deb/usr/share -mkdir deb/usr/share/applications +SRC_DIR="../myusr" + +rm -rf $DEB_DIR + +mkdir $DEB_DIR +mkdir $DEB_DIR/DEBIAN +mkdir $DEB_DIR/usr +mkdir $DEB_DIR/usr/bin +mkdir $DEB_DIR/usr/share +mkdir $DEB_DIR/usr/share/applications cp control deb/DEBIAN/ -cp tuxanci-ng.desktop deb/usr/share/applications +cp $PROJECT.desktop deb/usr/share/applications cd deb echo -e "2.0\n" > DEBIAN/debian-binary -cp ../myusr/bin/tuxanci-ng usr/bin/ -cp -rf ../myusr/share/tuxanci-ng usr/share/ +cp $SRC_DIR/bin/$PROJECT usr/bin/ +cp -rf $SRC_DIR/share/$PROJECT usr/share/ md5sum `find ./ -type f | awk '/.\// { print substr($0, 3) }'` > DEBIAN/md5sums cd .. rm -rf *.deb -dpkg -b ./deb tuxanci-ng_svn`cat deb-ver`_i386.deb +dpkg -b ./deb $DEB_NAME`cat r`_$DEB_ARCH.deb diff --git a/include/main.h b/include/main.h index da5b7ca..f0b15c1 100644 --- a/include/main.h +++ b/include/main.h @@ -4,6 +4,13 @@ #define MAIN_H #include "../config.h" + +#if defined SUPPORT_NET_UNIX_UDP && defined SUPPORT_NET_SDL_UDP + +#undef SUPPORT_NET_SDL_UDP + +#endif + #include "bool.h" #include "string_length.h" #include "path.h" @@ -0,0 +1 @@ +26 diff --git a/src/publicServer.c b/src/publicServer.c index 7e1d56e..0ba1fc6 100644 --- a/src/publicServer.c +++ b/src/publicServer.c @@ -116,7 +116,6 @@ void eventPublicServer() { return; } - /* printf("interval = %d\n", interval); */ diff --git a/src/server.c b/src/server.c index d55a6c0..f824c33 100644 --- a/src/server.c +++ b/src/server.c @@ -618,23 +618,20 @@ void selectServerUdpSocket() tv.tv_sec = 0; tv.tv_usec = 5000; #endif - + FD_ZERO(&readfds); FD_SET(sock_server_udp->sock, &readfds); max_fd = sock_server_udp->sock; - + delZombieCLient(); - + ret = select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); - + if( ret < 0 ) { return; } - -/* - printf("%d\n", tv.tv_usec); -*/ + if( FD_ISSET(sock_server_udp->sock, &readfds) ) { eventClientUdpSelect(sock_server_udp); @@ -675,48 +672,53 @@ void selectServerSdlUdpSocket() delZombieCLient(); - sock_client = newSdlSockUdp(); - isCreateNewClient = FALSE; - - memset(buffer, 0, STR_SIZE); - ret = readSdlUdpSocket(sock_server_sdl_udp, sock_client, buffer, STR_SIZE-1); - - if( ret < 0 ) - { - return; - } - - client = findSdlUdpClient(sock_client); - - if( client == NULL ) - { - eventCreateNewSdlUdpClient(sock_client); + do{ + sock_client = newSdlSockUdp(); + isCreateNewClient = FALSE; + + memset(buffer, 0, STR_SIZE); + + ret = readSdlUdpSocket(sock_server_sdl_udp, sock_client, buffer, STR_SIZE-1); + + if( ret < 0 ) + { + destroySockSdlUdp(sock_client); + break; + } + client = findSdlUdpClient(sock_client); - isCreateNewClient = TRUE; - } - - if( client == NULL ) - { - fprintf(stderr, "Client total not found !\n"); - return; - } - if( isCreateNewClient == FALSE ) - { - destroySockSdlUdp(sock_client); - } - - if( ret <= 0 ) - { - client->status = NET_STATUS_ZOMBIE; - return; - } + if( client == NULL ) + { + eventCreateNewSdlUdpClient(sock_client); + client = findSdlUdpClient(sock_client); + isCreateNewClient = TRUE; + } + + if( client == NULL ) + { + fprintf(stderr, "Client total not found !\n"); + return; + } + + if( isCreateNewClient == FALSE ) + { + destroySockSdlUdp(sock_client); + } + + if( ret <= 0 ) + { + client->status = NET_STATUS_ZOMBIE; + return; + } + + if( addBuffer(client->buffer, buffer, ret) != 0 ) + { + client->status = NET_STATUS_ZOMBIE; + return; + } - if( addBuffer(client->buffer, buffer, ret) != 0 ) - { - client->status = NET_STATUS_ZOMBIE; - return; - } + }while( ret > 0 ); } #endif @@ -395,7 +395,10 @@ void eventTuxIsDead(tux_t *tux) static void eventTuxIsDeadWIthShot(tux_t *tux, shot_t *shot) { - shot->author->score++; + if( shot->author != NULL && shot->author != tux ) + { + shot->author->score++; + } if( getNetTypeGame() == NET_GAME_TYPE_SERVER ) { diff --git a/tarball-build.sh b/tarball-build.sh index fcfb5c0..102b439 100755 --- a/tarball-build.sh +++ b/tarball-build.sh @@ -1,30 +1,33 @@ #!/bin/sh -rm -rf tuxanci_ng tuxanci_ng.tar tuxanci_ng.tar.bz2 +PROJECT="tuxanci-ng" +DIST_DIR="$PROJECT-svn`cat r`" -mkdir tuxanci_ng -mkdir tuxanci_ng/image -mkdir tuxanci_ng/font -mkdir tuxanci_ng/arena -mkdir tuxanci_ng/data -mkdir tuxanci_ng/lang -mkdir tuxanci_ng/sound -mkdir tuxanci_ng/music -mkdir tuxanci_ng/include -mkdir tuxanci_ng/src +rm -rf $DIST_DIR $DIST_DIR.tar $DIST_DIR.tar.bz2 +mkdir $DIST_DIR +mkdir $DIST_DIR/image +mkdir $DIST_DIR/font +mkdir $DIST_DIR/arena +mkdir $DIST_DIR/data +mkdir $DIST_DIR/lang +mkdir $DIST_DIR/sound +mkdir $DIST_DIR/music +mkdir $DIST_DIR/include +mkdir $DIST_DIR/src -cp image/*.* tuxanci_ng/image -cp font/*.* tuxanci_ng/font -cp arena/*.* tuxanci_ng/arena -cp data/*.* tuxanci_ng/data -cp lang/*.* tuxanci_ng/lang -cp sound/*.* tuxanci_ng/sound -cp music/*.* tuxanci_ng/music -cp include/*.* tuxanci_ng/include -cp src/* tuxanci_ng/src -cp Makefile control deb-ver tuxanci_ng -cp *.sh tuxanci_ng -tar -cvf tuxanci_ng.tar tuxanci_ng -bzip2 tuxanci_ng.tar +cp image/*.* $DIST_DIR/image +cp font/*.* $DIST_DIR/font +cp arena/*.* $DIST_DIR/arena +cp data/*.* $DIST_DIR/data +cp lang/*.* $DIST_DIR/lang +cp sound/*.* $DIST_DIR/sound +cp music/*.* $DIST_DIR/music +cp include/*.* $DIST_DIR/include +cp src/* $DIST_DIR/src +cp Makefile $DIST_DIR +cp $PROJECT.desktop $DIST_DIR + +tar -cvf $DIST_DIR.tar $DIST_DIR +bzip2 $DIST_DIR.tar diff --git a/tarballbin-build.sh b/tarballbin-build.sh index ecc053f..c00247f 100755 --- a/tarballbin-build.sh +++ b/tarballbin-build.sh @@ -1,25 +1,31 @@ #!/bin/sh -rm -rf tuxanci_ng-i386-bin tuxanci_ng-i386-bin.tar tuxanci_ng-i386-bin.tar.bz2 +PROJECT="tuxanci-ng" +DIR="deb" +ARCH="i386" +DIST_DIR="$PROJECT-svn`cat r`-$ARCH-bin" -mkdir tuxanci_ng-i386-bin -mkdir tuxanci_ng-i386-bin/image -mkdir tuxanci_ng-i386-bin/font -mkdir tuxanci_ng-i386-bin/arena -mkdir tuxanci_ng-i386-bin/data -mkdir tuxanci_ng-i386-bin/lang -mkdir tuxanci_ng-i386-bin/sound -mkdir tuxanci_ng-i386-bin/music +rm -rf $DIST_DIR $DIST_DIR.tar $DIST_DIR.tar.bz2 +mkdir $DIST_DIR -cp image/*.* tuxanci_ng-i386-bin/image -cp font/*.* tuxanci_ng-i386-bin/font -cp arena/*.* tuxanci_ng-i386-bin/arena -cp data/*.* tuxanci_ng-i386-bin/data -cp lang/*.* tuxanci_ng-i386-bin/lang -cp sound/*.* tuxanci_ng-i386-bin/sound -cp music/*.* tuxanci_ng-i386-bin/music -cp src/tuxanci-ng tuxanci_ng-i386-bin +mkdir $DIST_DIR/image +mkdir $DIST_DIR/font +mkdir $DIST_DIR/arena +mkdir $DIST_DIR/data +mkdir $DIST_DIR/lang +mkdir $DIST_DIR/sound +mkdir $DIST_DIR/music -tar -cvf tuxanci_ng-i386-bin.tar tuxanci_ng-i386-bin -bzip2 tuxanci_ng-i386-bin.tar + +cp image/*.* $DIST_DIR/image +cp font/*.* $DIST_DIR/font +cp arena/*.* $DIST_DIR/arena +cp data/*.* $DIST_DIR/data +cp lang/*.* $DIST_DIR/lang +cp sound/*.* $DIST_DIR/sound +cp music/*.* $DIST_DIR/music +cp src/$PROJECT $DIST_DIR + +tar -cvf $DIST_DIR.tar $DIST_DIR +bzip2 $DIST_DIR.tar |