1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_pets_c = |
3 | * static char *rcsid_pets_c = |
4 | * "$Id: pets.C,v 1.7 2006/09/12 21:20:15 root Exp $"; |
4 | * "$Id: pets.C,v 1.8 2006/09/14 17:10:25 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
165 | } |
165 | } |
166 | |
166 | |
167 | /* No threat to owner, check to see if the pet has an attacker */ |
167 | /* No threat to owner, check to see if the pet has an attacker */ |
168 | if (attacker) |
168 | if (attacker) |
169 | { |
169 | { |
170 | /* need to be sure this is the right one! */ |
|
|
171 | if (attacker->count == pet->attacked_by_count) |
|
|
172 | { |
|
|
173 | /* also need to check to make sure it is not freindly */ |
170 | /* also need to check to make sure it is not freindly */ |
174 | /* or otherwise non-hostile, and is an appropriate target */ |
171 | /* or otherwise non-hostile, and is an appropriate target */ |
175 | if (!QUERY_FLAG (attacker, FLAG_FRIENDLY) && on_same_map (pet, attacker)) |
172 | if (!QUERY_FLAG (attacker, FLAG_FRIENDLY) && on_same_map (pet, attacker)) |
176 | { |
173 | { |
177 | pet->enemy = attacker; |
174 | pet->enemy = attacker; |
|
|
175 | |
178 | if (check_enemy (pet, rv) != NULL) |
176 | if (check_enemy (pet, rv) != NULL) |
179 | return attacker; |
177 | return attacker; |
180 | else |
178 | else |
181 | pet->enemy = NULL; |
179 | pet->enemy = NULL; |
182 | } |
|
|
183 | } |
180 | } |
184 | } |
181 | } |
185 | |
182 | |
186 | /* Don't have an attacker or legal enemy, so look for a new one!. |
183 | /* Don't have an attacker or legal enemy, so look for a new one!. |
187 | * This looks for one around where the pet is. Thus, you could lead |
184 | * This looks for one around where the pet is. Thus, you could lead |