1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_pets_c = |
|
|
4 | * "$Id: pets.C,v 1.7 2006/09/12 21:20:15 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
22 | |
16 | |
23 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
20 | |
27 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
28 | */ |
22 | */ |
29 | |
23 | |
30 | #include <global.h> |
24 | #include <global.h> |
31 | #ifndef __CEXTRACT__ |
25 | #ifndef __CEXTRACT__ |
32 | # include <sproto.h> |
26 | # include <sproto.h> |
… | |
… | |
165 | } |
159 | } |
166 | |
160 | |
167 | /* No threat to owner, check to see if the pet has an attacker */ |
161 | /* No threat to owner, check to see if the pet has an attacker */ |
168 | if (attacker) |
162 | if (attacker) |
169 | { |
163 | { |
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 */ |
164 | /* also need to check to make sure it is not freindly */ |
174 | /* or otherwise non-hostile, and is an appropriate target */ |
165 | /* or otherwise non-hostile, and is an appropriate target */ |
175 | if (!QUERY_FLAG (attacker, FLAG_FRIENDLY) && on_same_map (pet, attacker)) |
166 | if (!QUERY_FLAG (attacker, FLAG_FRIENDLY) && on_same_map (pet, attacker)) |
176 | { |
167 | { |
177 | pet->enemy = attacker; |
168 | pet->enemy = attacker; |
|
|
169 | |
178 | if (check_enemy (pet, rv) != NULL) |
170 | if (check_enemy (pet, rv) != NULL) |
179 | return attacker; |
171 | return attacker; |
180 | else |
172 | else |
181 | pet->enemy = NULL; |
173 | pet->enemy = NULL; |
182 | } |
|
|
183 | } |
174 | } |
184 | } |
175 | } |
185 | |
176 | |
186 | /* Don't have an attacker or legal enemy, so look for a new one!. |
177 | /* 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 |
178 | * This looks for one around where the pet is. Thus, you could lead |