diff --git a/ChangeLog b/ChangeLog index 04ccd43..31664e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + - Added Sound Support (thanks to Henrik Enqvist for the help and the sound files.) @@ -6,6 +7,7 @@ - Fixed make install, so the source will be able to install correctly now with the data packages +- AI Players are working now Version 0.9.8 diff --git a/src/basic.h b/src/basic.h index c81675f..e946d4a 100644 --- a/src/basic.h +++ b/src/basic.h @@ -25,7 +25,7 @@ #define SPECIAL_LIQUID_NUMUSE 5 #define SPECIAL_DESTROY_NUMUSE 5 -#define START_BOMBS 1 +#define START_BOMBS 5 #define START_RANGE 2 #define START_SPEED 16 #define SPEEDMUL 1.2 diff --git a/src/single.c b/src/single.c index fd6c5c4..88be807 100644 --- a/src/single.c +++ b/src/single.c @@ -1,4 +1,4 @@ -/* $Id: single.c,v 1.22 2003/05/28 23:03:21 stpohle Exp $ */ +/* $Id: single.c,v 1.23 2003/05/29 00:56:48 stpohle Exp $ */ /* single player */ #include "basic.h" @@ -116,11 +116,11 @@ ai_easyrunaway (_point p) done = 0; /* check the field left and right beside */ if (i == left || i == right) { - if (ai_checkfield (pos[i].x, pos[i].y - 1) || ai_checkfield (pos[i].x, pos[i].y + 1)) + if (ai_findnearbombs (pos[i]) == 0 && (ai_checkfield (pos[i].x, pos[i].y - 1) || ai_checkfield (pos[i].x, pos[i].y + 1))) dir |= (1 << i); } else { - if (ai_checkfield (pos[i].x - 1, pos[i].y) || ai_checkfield (pos[i].x + 1, pos[i].y)) + if (ai_findnearbombs (pos[i]) == 0 && (ai_checkfield (pos[i].x - 1, pos[i].y) || ai_checkfield (pos[i].x + 1, pos[i].y))) dir |= (1 << i); } pos[i].x += m[i].x; @@ -414,7 +414,7 @@ ai_checkpos (_player * pl, _point * pos) int ai_choosedir (int dir, int nearbomb, int oldpos) { int rdir[4]; - int bdir[4]; + int bdir[4*3]; int i, rnr, bnr; for (rnr = bnr= i = 0; i < 4; i++) { @@ -461,6 +461,30 @@ ai_invertdir (int dir) { }; +int ai_checknewpos (_point pos,int d) { + _point m; + switch (d) { + case (left): + m.x = pos.x - 1; + m.y = pos.y; + break; + case (right): + m.x = pos.x + 1; + m.y = pos.y; + break; + case (up): + m.x = pos.x; + m.y = pos.y - 1; + break; + default: + m.x = pos.x; + m.y = pos.y + 1; + break; + } + + return (ai_findnearbombs (m) == 0); +}; + /* create a giving number of ai players */ void @@ -485,6 +509,7 @@ single_create_ai (int players) }; + void single_playergame () { @@ -525,8 +550,10 @@ single_loop () nearbomb = ai_findnearbombs (plpos); if (nearbomb == 0) { // no bombs found bestbdir = ai_findbestbombdir (plpos, pl->d, pl->range); - if (bestbdir >= 4) - player_drop_bomb (p); + if (bestbdir >= 4) { + if (ai_easyrunaway (plpos) != 0) + player_drop_bomb (p); + } else if (bestbdir == -1) { pl->d = s_random (4); pl->m = 1; @@ -535,6 +562,8 @@ single_loop () pl->d = bestbdir; pl->m = 1; } + if (!ai_checknewpos (plpos, pl->d)) + pl->m = 0; } else { // bombs in the near found