From 51aae47ae08ad61507f219c24ed6d9321c866f45 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sun, 16 Mar 2008 19:22:06 +0000 Subject: - upravy, hlavne siete git-svn-id: http://opensvn.csie.org/tuxanci_ng@23 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- Makefile | 30 ++++++++++++++++++++++++++---- include/arenaFile.h | 2 ++ publicserver.sh | 5 +++++ src/Makefile | 4 ++-- src/Makefile-publicServer | 4 ++-- src/arenaFile.c | 13 ++++++++++++- src/director.c | 2 ++ src/main.c | 2 -- src/publicServer.c | 7 ++++--- src/server.c | 4 ++-- 10 files changed, 57 insertions(+), 16 deletions(-) create mode 100755 publicserver.sh diff --git a/Makefile b/Makefile index 029b7fc..64123f9 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,44 @@ DISTDIR:=/usr/ all: make -C ./src DISTDIR=$(DISTDIR) - + clean: make -C ./src DISTDIR=$(DISTDIR) clean + make -C ./src -f Makefile-publicServer clean run: ./tuxanci-ng.sh +srun: + ./publicserver.sh + +package: + ./deb-build.sh + +kill: + kill -9 `pidof publicserver` + +stat: + cat /proc/`pidof publicserver`/status + +tuxstat: + cat /proc/`pidof tuxanci-ng`/status + +line: + cat src/*.c include*.h | wc -l + +core: + gcore `pidof publicserver` + svn: svn ci svnr: svn co http://opensvn.csie.org/tuxanci_ng/ +server: + make -C ./src -f Makefile-publicServer + install: cp ./src/tuxanci-ng $(DISTDIR)bin/ mkdir $(DISTDIR)share/tuxanci-ng @@ -36,9 +61,6 @@ install: cp -rf ./sound/* $(DISTDIR)share/tuxanci-ng/sound cp -rf ./data/* $(DISTDIR)share/tuxanci-ng/data -deb: - ./deb-build.sh - uninstall: rm -rf $(DISTDIR)bin/tuxanci-ng rm -rf $(DISTDIR)share/tuxanci-ng diff --git a/include/arenaFile.h b/include/arenaFile.h index f838c6a..ae2b203 100644 --- a/include/arenaFile.h +++ b/include/arenaFile.h @@ -6,6 +6,8 @@ #include "main.h" #include "arena.h" +#define PUBLIC_SERVER_PATH_ARENA "./arena/" + extern bool_t isArenaFileInicialized(); extern void initArenaFile(); extern int getArenaCount(); diff --git a/publicserver.sh b/publicserver.sh new file mode 100755 index 0000000..b47c6d8 --- /dev/null +++ b/publicserver.sh @@ -0,0 +1,5 @@ +#!/bin/bash +export LD_LIBRARY_PATH="/usr/debug/lib/" +ldd -u src/publicserver +ulimit -c unlimited +nohup ./src/publicserver & diff --git a/src/Makefile b/src/Makefile index 9c2938f..67e442b 100755 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,7 @@ #CC = /usr/local/gcc/bin/gcc CC = gcc -CFLAGS = -g -O0 -DSUPPORT_NET_SDL_UDP -DDISTDIR=\"$(DISTDIR)\" `sdl-config --cflags` -I../include -Wall +CFLAGS = -g -O0 -DSUPPORT_NET_SDL_UDP -DDISTDIR=\"$(DISTDIR)\" -I../include -Wall `sdl-config --cflags` #CFLAGS = -O2 -DDISTDIR=\"$(DISTDIR)\" `sdl-config --cflags` -I../include -Wall LIBS = `sdl-config --libs` -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_net @@ -165,4 +165,4 @@ screen_table.o: screen_table.c ../include/screen_table.h $(CC) $(CFLAGS) -o screen_table.o -c screen_table.c clean: - rm -rf *.o *.c~ *.h~ tuxanci-ng + rm -rf *.o *.c~ ../include/*.h~ Makefile~ tuxanci-ng diff --git a/src/Makefile-publicServer b/src/Makefile-publicServer index 4d9df5e..8c4f90f 100755 --- a/src/Makefile-publicServer +++ b/src/Makefile-publicServer @@ -4,7 +4,7 @@ CC = gcc DISTDIR:=/usr/ -CFLAGS = -g -O0 -DBUBLIC_SERVER -DSUPPORT_NET_UNIX_UDP -DDISTDIR=\"$(DISTDIR)\" -I../include -Wall +CFLAGS = -g -O0 -DBUBLIC_SERVER -DSUPPORT_NET_UNIX_UDP -I../include -Wall #CFLAGS = -O2 -DDISTDIR=\"$(DISTDIR)\" `sdl-config --cflags` -I../include -Wall LIBS = @@ -86,5 +86,5 @@ pipe.o: pipe.c ../include/pipe.h $(CC) $(CFLAGS) -o pipe.o -c pipe.c clean: - rm -rf *.o *.c~ *.h~ publicserver + rm -rf *.o *.c~ ../include*.h~ Makefile-publicServer~ publicserver diff --git a/src/arenaFile.c b/src/arenaFile.c index f13750a..a58f3be 100644 --- a/src/arenaFile.c +++ b/src/arenaFile.c @@ -296,7 +296,13 @@ void initArenaFile() isArenaFileInit = TRUE; listArenaFile = newList(); +#ifndef BUBLIC_SERVER p = loadDirector(PATH_ARENA); +#endif + +#ifdef BUBLIC_SERVER + p = loadDirector(PUBLIC_SERVER_PATH_ARENA); +#endif for( i = 0 ; i < p->list->count ; i++ ) { @@ -307,8 +313,13 @@ void initArenaFile() if( strstr(line, ".map") != NULL && strstr(line, "~") == NULL ) { char path[STR_PATH_SIZE]; - sprintf(path, PATH_ARENA "%s", line); +#ifndef BUBLIC_SERVER + sprintf(path, PATH_ARENA "%s", line); +#endif +#ifdef BUBLIC_SERVER + sprintf(path, PUBLIC_SERVER_PATH_ARENA "%s", line); +#endif printf("load map %s\n", line); addList(listArenaFile, loadTextFile(path)); } diff --git a/src/director.c b/src/director.c index 9c11cb2..e0b16b9 100755 --- a/src/director.c +++ b/src/director.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -41,6 +42,7 @@ director_t* loadDirector(char *s) } new->path = strdup(path); + printf("new->path = %s\n", new->path); dir = opendir(new->path); diff --git a/src/main.c b/src/main.c index c53c3fe..384285f 100644 --- a/src/main.c +++ b/src/main.c @@ -154,8 +154,6 @@ int main(int argc, char *argv[]) { srand( (unsigned) time(NULL) ); - printf("dist dir = %s\n", DISTDIR); - my_argc = argc; my_argv = argv; diff --git a/src/publicServer.c b/src/publicServer.c index 1108a20..8206062 100644 --- a/src/publicServer.c +++ b/src/publicServer.c @@ -19,7 +19,7 @@ #include "publicServer.h" #include "net_multiplayer.h" -static int arenaId = 0; +static int arenaId; static arena_t *arena; arena_t* getWorldArena() @@ -39,7 +39,7 @@ void initPublicServer() initShot(); initTimer(); - + arenaId = getArenaIdFormNetName( getParamElse("--arena", "FAGN") ); arena = getArena(arenaId); addNewItem(arena->listItem, NULL); @@ -103,8 +103,9 @@ void eventPublicServer() { return; } - +/* printf("interval = %d\n", interval); +*/ lastActive = getMyTime(); eventConflictTuxWithTeleport(arena->listTux, arena->listTeleport); diff --git a/src/server.c b/src/server.c index 5e4d40b..032a210 100644 --- a/src/server.c +++ b/src/server.c @@ -594,7 +594,7 @@ static void eventClientUdpSelect(sock_udp_t *sock_server) void selectServerUdpSocket() { - static struct timeval tv = { .tv_sec = 0, .tv_usec = 50000 }; + struct timeval tv; fd_set readfds; int max_fd; @@ -605,7 +605,7 @@ void selectServerUdpSocket() #ifdef BUBLIC_SERVER tv.tv_sec = 0; - tv.tv_usec = 50000; + tv.tv_usec = 5000; #endif FD_ZERO(&readfds); -- cgit v1.2.3