From 70a03c02c385bcc207faa3e0ebeeb4ff3e7c1d2d Mon Sep 17 00:00:00 2001 From: stpohle Date: Fri, 14 Nov 2003 18:14:17 +0000 Subject: [PATCH] tunnel problem fixed.. two of 4 tunnels didn't worked --- src/player.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/player.c b/src/player.c index 1b4461e..8843b6b 100644 --- a/src/player.c +++ b/src/player.c @@ -314,18 +314,16 @@ stepmove_player (int pl_nr) /* check if we can go though a tunnel */ if (_pos.x == 0.0f && _pos.y == 0.0f && map.field[(int)p->pos.x][(int)p->pos.y].type == FT_tunnel && p->tunnelto <= 0.0f) { - d_printf ("Tunnel [%d] Player %s is going to (%d,%d)\n", - map.field[(int)p->pos.x][(int)p->pos.y].special, p->name, - map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].x, - map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].y); + + int tunnelnr = map.field[(int)p->pos.x][(int)p->pos.y].special; + d_printf ("Tunnel [%d] Player %s is going to (%d,%d)\n", tunnelnr, p->name, + map.tunnel[tunnelnr].x, map.tunnel[tunnelnr].y); d.x = d.y = 0.0f; - if (map. - bfield[map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].x] - [map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].y]) + if (map.bfield[map.tunnel[tunnelnr].x][map.tunnel[tunnelnr].y]) d_printf (" *** End of tunnel is with an bomb.\n"); else { - p->pos.x = map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].x; - p->pos.y = map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].y; + p->pos.x = map.tunnel[tunnelnr].x; + p->pos.y = map.tunnel[tunnelnr].y; p->tunnelto = GAME_TUNNEL_TO; speed = p->speed * timefactor; } @@ -371,7 +369,7 @@ move_player (int pl_nr) oldd = p->d; - if (p->tunnelto > 0) { + if (p->tunnelto > 0.0f) { p->tunnelto -= timediff; p->m = 0; if (p->tunnelto <= 0.0f && GT_MP) @@ -392,9 +390,6 @@ move_player (int pl_nr) /* network packet send control - send data if it's time to send or if we need to */ if (GT_MP) net_game_send_playermove (pl_nr, (p->old_m == 0)); - - if (p->tunnelto == 0 && (map.field[postofield(p->pos.x)][postofield(p->pos.y)].type != FT_tunnel || !field_check_alldirs (postofield(p->pos.x), postofield(p->pos.y), FT_nothing))) - p->tunnelto = -1; } /* the player just stopt moving so send data */