From 8d2c74d791862f6011e50011484de3269cbddd05 Mon Sep 17 00:00:00 2001 From: stpohle Date: Mon, 14 Feb 2005 20:09:19 +0000 Subject: [PATCH] crash on irix fix version 2, version 1, didn't worked at all. bomb.pos wasn't initialized. --- src/game.c | 8 +++++--- src/single.c | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/game.c b/src/game.c index 36276e2..bc06efa 100644 --- a/src/game.c +++ b/src/game.c @@ -1,4 +1,4 @@ -/* $Id: game.c,v 1.106 2004/12/26 04:19:20 stpohle Exp $ +/* $Id: game.c,v 1.107 2005/02/14 20:09:19 stpohle Exp $ game.c - procedures for the game. */ #include @@ -501,8 +501,8 @@ game_start () bman.updatestatusbar=1; players[p].frame = 0.0f; players[p].d = 0; - players[p].pos.x = -1; - players[p].pos.y = -1; + players[p].pos.x = 0.0; + players[p].pos.y = 0.0; players[p].tunnelto = 0.0f; players[p].ready = 0; @@ -520,6 +520,8 @@ game_start () players[p].bombs[i].mode = BM_normal; players[p].bombs[i].id.p = p; players[p].bombs[i].id.b = i; + players[p].pos.x = 0; + players[p].pos.x = 0; } } diff --git a/src/single.c b/src/single.c index 53c2666..9c78bd6 100644 --- a/src/single.c +++ b/src/single.c @@ -1,4 +1,4 @@ -/* $Id: single.c,v 1.83 2005/01/30 16:53:37 stpohle Exp $ */ +/* $Id: single.c,v 1.84 2005/02/14 20:09:19 stpohle Exp $ */ /* single player */ #include "basic.h" @@ -7,7 +7,6 @@ #include "player.h" #include "single.h" - /* start a single player game and prepare everything for the game */ void single_game_new () @@ -258,6 +257,12 @@ ai_bombpoints (_point pos, int range) r; _point p; + if (pos.x < 0 || pos.x >= MAX_FIELDSIZE_X || pos.y < 0 || pos.y >= MAX_FIELDSIZE_Y) { + printf ("WARNING: ai_bombpoints: pos out of range.\n"); + printf (" pos.x=%d pos.y=%d range=%d\n", pos.x, pos.y, range); + return 0; + } + if (map.field[pos.x][pos.y].type != FT_block && map.field[pos.x][pos.y].type != FT_stone && ai_checkfield (pos.x, pos.y)) { for (d = 0; d < 4; d++) {