version 1.50 | | version 1.51 |
---|
| | |
/* | | /* |
* static char *rcsid_monster_c = | | * static char *rcsid_monster_c = |
* "$Id: monster.c,v 1.50 2002/09/05 05:23:15 mwedel Exp $"; | | * "$Id: monster.c,v 1.51 2002/09/06 04:44:46 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
/* checks npc->enemy and returns that enemy if still valid, | | /* checks npc->enemy and returns that enemy if still valid, |
* NULL otherwise. | | * NULL otherwise. |
* this is map tile aware. | | * this is map tile aware. |
| | * If this returns an enemy, the range vector rv should also be |
| | * set to sane values. |
*/ | | */ |
object *check_enemy(object *npc, rv_vector *rv) { | | object *check_enemy(object *npc, rv_vector *rv) { |
| | |
| | |
if(!QUERY_FLAG(npc, FLAG_UNAGGRESSIVE) && !QUERY_FLAG(npc, FLAG_FRIENDLY) && | | if(!QUERY_FLAG(npc, FLAG_UNAGGRESSIVE) && !QUERY_FLAG(npc, FLAG_FRIENDLY) && |
!QUERY_FLAG(npc, FLAG_NEUTRAL)) | | !QUERY_FLAG(npc, FLAG_NEUTRAL)) |
{ | | { |
tmp = get_nearest_player(npc); | | npc->enemy = get_nearest_player(npc); |
| | if (npc->enemy) |
if(QUERY_FLAG(npc, FLAG_FRIENDLY)&&tmp) | | tmp = check_enemy(npc,rv); |
tmp = check_enemy(tmp,rv); | | |
} | | } |
| | |
} | | } |
| | |
/* Sees if this monster should wake up. | | /* Sees if this monster should wake up. |
* Currently, this is only called from move_monster, and | | * Currently, this is only called from move_monster, and |
* if enemy is set, then so should be rv. | | * if enemy is set, then so should be rv. |
| | * returns 1 if the monster should wake up, 0 otherwise. |
*/ | | */ |
| | |
int check_wakeup(object *op, object *enemy, rv_vector *rv) { | | int check_wakeup(object *op, object *enemy, rv_vector *rv) { |