From 7f6c40c57b0684261c2d11d9a4f03701040ceb3b Mon Sep 17 00:00:00 2001 From: stpohle Date: Sun, 28 Dec 2003 19:07:37 +0000 Subject: [PATCH] Network Problem with the tilesets fixed. --- ChangeLog | 11 +++++++---- TODO | 6 +++--- src/game.c | 4 ++-- src/map.c | 42 +++++++++++++++++++++--------------------- src/netmenu.c | 12 +++++++++--- src/network.c | 12 ++++++++---- src/packets.c | 3 ++- 7 files changed, 52 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ad380e..7e88345 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.45 2003/12/24 03:25:59 stpohle Exp $ +$Id: ChangeLog,v 1.46 2003/12/28 19:07:37 stpohle Exp $ - wrote new OpenGameCache Server for this game and other games. This server is working almost the same @@ -12,11 +12,14 @@ $Id: ChangeLog,v 1.45 2003/12/24 03:25:59 stpohle Exp $ - Menuhandling complete rewritten and changed. GUI created for menus: lists, buttons, check boxes labels and other things created. - - new menugraphics made by DJ Mirage. + -new menugraphics made by DJ Mirage. + -mapmenu written by Patty + -the bad response form the game to users action + should be fixed. - FullScreen switching from within the game - by pressing F8 + by pressing (F8 Works for some Reason only + in Windows) - AI Players can join network games. diff --git a/TODO b/TODO index b1e82cf..1ab654c 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,10 @@ -$Id: TODO,v 1.27 2003/12/28 05:47:50 stpohle Exp $ - -* tileset name and so on won't be send right. +$Id: TODO,v 1.28 2003/12/28 19:07:37 stpohle Exp $ * check if the player is on a field with an running explosion +* Multiplayer: playerselection get mixed up somehow. + - multiplayer broadcast in the local network ip: 10.*.*.* and 192.168.*.* diff --git a/src/game.c b/src/game.c index de2f6c5..c8d1a44 100644 --- a/src/game.c +++ b/src/game.c @@ -1,4 +1,4 @@ -/* $Id: game.c,v 1.64 2003/12/28 04:51:25 stpohle Exp $ +/* $Id: game.c,v 1.65 2003/12/28 19:07:38 stpohle Exp $ game.c - procedures for the game. */ #include @@ -360,7 +360,7 @@ game_start () }; -/* shor result of the game */ +/* show result of the game */ void game_showresult () { SDL_Rect dest, src; diff --git a/src/map.c b/src/map.c index 81c0e90..4d0062b 100644 --- a/src/map.c +++ b/src/map.c @@ -1,4 +1,4 @@ -/* $Id: map.c,v 1.16 2003/12/28 04:51:25 stpohle Exp $ */ +/* $Id: map.c,v 1.17 2003/12/28 19:07:38 stpohle Exp $ */ /* map handling, like generate and load maps. */ #include "bomberclone.h" @@ -198,8 +198,6 @@ map_set_player_way1 (int pl) p.x = s_random (map.size.x - 2) + 1; p.y = s_random (map.size.y - 2) + 1; - d_printf ("map_set_player_way2 (%d) : %d,%d\n", pl, p.x, p.y); - /* check if there is no block */ if (map.field[p.x][p.y].type != FT_nothing) return; @@ -253,8 +251,6 @@ map_set_player_way2 (int pl) p.x = s_random (map.size.x - 2) + 1; p.y = s_random (map.size.y - 2) + 1; - d_printf ("map_set_player_way2 (%d) : %d,%d\n", pl, p.x, p.y); - /* check if there is no block */ if (map.field[p.x][p.y].type != FT_nothing) return; @@ -358,6 +354,8 @@ map_set_playerposition (int usermap) } if (maxtry) d_fatal ("Not All Player could been set\n"); + + d_printf ("map_set_playerposition\n"); }; #undef PLX @@ -399,21 +397,23 @@ map_random () void init_map_tileset () { - switch (map.map_selection) { - case (0): - map_new (map.map); - break; - case (1): - map_random (); - map_new (map.map); - break; - case (2): - map_new (NULL); - break; - } - - if (map.random_tileset) - tileset_random (); + if (GT_MP_PTPM || GT_SP) { + switch (map.map_selection) { + case (0): + map_new (map.map); + break; + case (1): + map_random (); + map_new (map.map); + break; + case (2): + map_new (NULL); + break; + + if (map.random_tileset) + tileset_random (); + } + } } @@ -490,4 +490,4 @@ map_load (FILE * fmap) map.field[0][i].type = map.field[map.size.x - 1][i].type = FT_block; fclose (fmap); -} +}; diff --git a/src/netmenu.c b/src/netmenu.c index 20831ff..19e8ee7 100644 --- a/src/netmenu.c +++ b/src/netmenu.c @@ -126,6 +126,8 @@ multiplayer_firstrun () * We will host a network game */ void host_multiplayer_game () { + int i; + if (bman.firewall) { return; } @@ -145,7 +147,7 @@ void host_multiplayer_game () { send_ogc_update (); /* send the information that we started an server */ multiplayer_game (); - + net_send_servermode (); network_shutdown (); }; @@ -160,9 +162,11 @@ void multiplayer_game () { if (bman.p_nr != -1 && (GS_WAITRUNNING || bman.state == GS_update)) { bman.state = GS_update; net_new_game (); - if (GT_MP_PTPM) - net_send_servermode (); game_start (); + if (GT_MP_PTPM) { + net_send_mapinfo (); // maybe we have to make a pause + net_send_servermode (); // between mapinfo and servermode + } net_transmit_gamedata (); if (bman.state == GS_ready || bman.state == GS_running) { @@ -221,6 +225,8 @@ join_multiplayer_game () i = NETF_firewall; else i = 0; + + bman.p_nr = -1; send_joingame (&players[0].net.addr, bman.playername); /* go into the normal multiplayer loop */ diff --git a/src/network.c b/src/network.c index bd6146a..c3bef5c 100644 --- a/src/network.c +++ b/src/network.c @@ -1,4 +1,4 @@ -/* $Id: network.c,v 1.47 2003/12/26 16:55:35 stpohle Exp $ */ +/* $Id: network.c,v 1.48 2003/12/28 19:07:38 stpohle Exp $ */ /* network routines. */ @@ -136,9 +136,12 @@ network_shutdown () { int i; + d_printf ("network_shutdown\n"); + if (GT_MP_PTPM) { - for (i = 1; i < MAX_PLAYERS; i++) - if (players[i].net.addr.host[0] != 0) + d_printf ("Server Quit Send information\n"); + for (i = 0; i < MAX_PLAYERS; i++) + if (i != bman.p_servnr && players[i].net.addr.host[0] != 0) send_quit (&players[i].net.addr, NULL, NULL); } else if (players[bman.p_servnr].net.addr.host[0] != 0) @@ -737,7 +740,8 @@ net_new_game () players[p].state = 0; } - players[bman.p_nr].state &= (0xFF - PSF_net); // we are the local player + if (bman.p_nr != -1) + players[bman.p_nr].state &= (0xFF - PSF_net); // we are the local player bman.last_ex_nr = 1; }; diff --git a/src/packets.c b/src/packets.c index b5178f5..37ed634 100644 --- a/src/packets.c +++ b/src/packets.c @@ -855,6 +855,7 @@ send_quit (_net_addr * addr, char *plhost, char * plport) send_pkg ((struct pkg *) &q_dat, addr); }; + void do_quit (struct pkg_quit *q_dat, _net_addr * addr) { @@ -1190,7 +1191,7 @@ send_mapinfo (_net_addr * addr) strcpy (map_pkg.tileset, map.tileset); map_pkg.map_selection = map.map_selection; strcpy (map_pkg.mapname, map.map); - + d_printf ("send_mapinfo: Tileset: %s\n", map.tileset); send_pkg ((struct pkg *) &map_pkg, addr); };