version 1.15 | | version 1.16 |
---|
| | |
/* | | /* |
* static char *rcsid_pets_c = | | * static char *rcsid_pets_c = |
* "$Id: pets.c,v 1.15 2002/12/25 06:45:46 garbled Exp $"; | | * "$Id: pets.c,v 1.16 2003/01/05 23:50:15 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
object *get_pet_enemy(object * pet, rv_vector *rv){ | | object *get_pet_enemy(object * pet, rv_vector *rv){ |
object *owner, *tmp, *attacker, *tmp3; | | object *owner, *tmp, *attacker, *tmp3; |
int i,j,x,y; | | int i,x,y; |
mapstruct *nm; | | mapstruct *nm; |
int search_arr[SIZEOFFREE]; | | int search_arr[SIZEOFFREE]; |
| | |
| | |
!QUERY_FLAG(tmp2,FLAG_FRIENDLY) | | !QUERY_FLAG(tmp2,FLAG_FRIENDLY) |
&& !QUERY_FLAG(tmp2,FLAG_UNAGGRESSIVE) && | | && !QUERY_FLAG(tmp2,FLAG_UNAGGRESSIVE) && |
tmp2 != pet && tmp2 != owner && tmp2->type != PLAYER && | | tmp2 != pet && tmp2 != owner && tmp2->type != PLAYER && |
can_detect_enemy(pet, tmp2, rv)) | | can_detect_enemy(pet, tmp2, rv)) { |
| | |
if (!can_see_enemy(pet, tmp2)) { | | if (!can_see_enemy(pet, tmp2)) { |
if (tmp3 != NULL) | | if (tmp3 != NULL) |
tmp3 = tmp2; | | tmp3 = tmp2; |
| | |
return tmp2; | | return tmp2; |
else | | else |
pet->enemy = NULL; | | pet->enemy = NULL; |
| | } |
} /* make sure we can get to the bugger */ | | } /* make sure we can get to the bugger */ |
} /* for objects on this space */ | | } /* for objects on this space */ |
} /* if there is something living on this space */ | | } /* if there is something living on this space */ |
| | |
return; | | return; |
} | | } |
/* Calculate Direction */ | | /* Calculate Direction */ |
if (owner->contr->petmode == pet_sad) { | | if (owner->type == PLAYER && owner->contr->petmode == pet_sad) { |
/* in S&D mode, if we have no enemy, run randomly about. */ | | /* in S&D mode, if we have no enemy, run randomly about. */ |
for (i=0; i < 15; i++) { | | for (i=0; i < 15; i++) { |
dir = rndm(1, 8); | | dir = rndm(1, 8); |