diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-03-16 16:32:38 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-03-16 16:32:38 +0000 |
| commit | 642a85360b3846b9e84c8a0e9671e23686313daf (patch) | |
| tree | 9da07aa0d3407ff70d1bb59bee2c3fa8b45209d0 | |
| parent | 2c160370499826609371fa9621b8c31aa8a8566a (diff) | |
- obrazok co som zabudol odolslat
- rozrobene zdrojaky
git-svn-id: http://opensvn.csie.org/tuxanci_ng@20 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
| -rw-r--r-- | image/screen_table.png | bin | 0 -> 170783 bytes | |||
| -rwxr-xr-x | src/Makefile | 4 | ||||
| -rw-r--r-- | src/item.c | 1 | ||||
| -rw-r--r-- | src/myTimer.c | 6 | ||||
| -rw-r--r-- | src/net_multiplayer.c | 1 | ||||
| -rw-r--r-- | src/publicServer.c | 14 | ||||
| -rw-r--r-- | src/server.c | 15 |
7 files changed, 29 insertions, 12 deletions
diff --git a/image/screen_table.png b/image/screen_table.png Binary files differnew file mode 100644 index 0000000..769496e --- /dev/null +++ b/image/screen_table.png diff --git a/src/Makefile b/src/Makefile index 11f664f..9c2938f 100755 --- a/src/Makefile +++ b/src/Makefile @@ -8,12 +8,12 @@ CFLAGS = -g -O0 -DSUPPORT_NET_SDL_UDP -DDISTDIR=\"$(DISTDIR)\" `sdl-config --cfl LIBS = `sdl-config --libs` -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_net FILES = interface.o font.o list.o image.o layer.o director.o configFile.o tux.o main.o \ - screen.o screen_world.o wall.o shot.o myTimer.o panel.o net_multiplayer.o network.o \ + screen.o screen_world.o wall.o shot.o myTimer.o panel.o net_multiplayer.o \ buffer.o dynamicInt.o arena.o arenaFile.o textFile.o sound.o audio.o music.o gun.o \ item.o widget_label.o screen_mainMenu.o widget_button.o screen_analyze.o widget_textfield.o \ widget_check.o widget_image.o screen_setting.o screen_gameType.o screen_choiceArena.o \ widget_buttonimage.o screen_credits.o teleport.o pipe.o homeDirector.o screen_table.o \ - tcp.o udp.o sdl_udp.o proto.o server.o client.o + sdl_udp.o proto.o server.o client.o tuxanci-ng: $(FILES) $(CC) $(CFLAGS) $(LIBS) -o tuxanci-ng $(FILES) @@ -171,7 +171,6 @@ void addNewItem(list_t *listItem, tux_t *author) #ifndef BUBLIC_SERVER }while( isSettingItem(type) == FALSE ); #endif - item = newItem(new_x, new_y, type, author); addList(listItem, item); diff --git a/src/myTimer.c b/src/myTimer.c index 04abef0..ea83fd5 100644 --- a/src/myTimer.c +++ b/src/myTimer.c @@ -30,15 +30,13 @@ void initTimer() my_time_t getMyTime() { - static struct timeval start; + static struct timeval start = { .tv_sec = 0, .tv_usec = 0 }; struct timeval now; - static char first = '0'; my_time_t ticks; - if( first == '0' ) + if( start.tv_sec == 0 && start.tv_usec == 0 ) { gettimeofday(&start, NULL); - first = 'x'; } gettimeofday(&now, NULL); diff --git a/src/net_multiplayer.c b/src/net_multiplayer.c index 84cb28d..4da5b87 100644 --- a/src/net_multiplayer.c +++ b/src/net_multiplayer.c @@ -25,7 +25,6 @@ #endif static int netGameType; -static int netProtoType = NET_PROTOCOL_TYPE_UDP; int getNetTypeGame() { diff --git a/src/publicServer.c b/src/publicServer.c index f76da76..ae229d5 100644 --- a/src/publicServer.c +++ b/src/publicServer.c @@ -37,6 +37,7 @@ void initPublicServer() initShot(); initTimer(); + arena = getArena(arenaId); addNewItem(arena->listItem, NULL); @@ -84,6 +85,17 @@ void findFreeSpace(int *x, int *y, int w, int h) void eventPublicServer() { + static my_time_t time = 0; + + if( time == 0 ) + { + time = getMyTime(); + } + + printf("time %d\n", getMyTime() - time ); + + time = getMyTime(); + eventConflictTuxWithTeleport(arena->listTux, arena->listTeleport); eventConflictTuxWithShot(arena->listTux, arena->listShot); @@ -95,9 +107,9 @@ void eventPublicServer() eventMoveListShot(arena->listShot); eventListItem(arena->listItem); eventListTux(arena->listTux); - eventNetMultiplayer(); eventTimer(); + eventNetMultiplayer(); } void quitPublicServer() diff --git a/src/server.c b/src/server.c index 39aaca6..d2f6598 100644 --- a/src/server.c +++ b/src/server.c @@ -374,7 +374,7 @@ static void eventClientBuffer(client_t *client) while( getBufferLine(client->buffer, line, STR_SIZE) >= 0 ) { - printf("spracuvavam %s", line); + //printf("spracuvavam %s", line); if( strncmp(line, "hello", 5) == 0 )proto_recv_hello_server(client, line); if( strncmp(line, "event", 5) == 0 )proto_recv_event_server(client, line); @@ -590,9 +590,10 @@ static void eventClientUdpSelect(sock_udp_t *sock_server) void selectServerUdpSocket() { + static struct timeval tv = { .tv_sec = 0, .tv_usec = 50000 }; fd_set readfds; - struct timeval tv; int max_fd; + unsigned int z; #ifndef BUBLIC_SERVER tv.tv_sec = 0; @@ -601,7 +602,7 @@ void selectServerUdpSocket() #ifdef BUBLIC_SERVER tv.tv_sec = 0; - tv.tv_usec = 50 * 1000; + tv.tv_usec = 0; #endif FD_ZERO(&readfds); @@ -612,6 +613,14 @@ void selectServerUdpSocket() select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); +#ifdef BUBLIC_SERVER + z = tv.tv_usec; + usleep( 50000 - z ); +#endif + +/* + printf("%d\n", tv.tv_usec); +*/ if( FD_ISSET(sock_server_udp->sock, &readfds) ) { eventClientUdpSelect(sock_server_udp); |