ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/disease.C
(Generate patch)

Comparing deliantra/server/server/disease.C (file contents):
Revision 1.4 by root, Sun Sep 10 15:59:57 2006 UTC vs.
Revision 1.7 by root, Thu Oct 5 16:50:07 2006 UTC

1
2/*
3 * static char *rcsid_disease_c =
4 * "$Id: disease.C,v 1.4 2006/09/10 15:59:57 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 to crossfire-devel@real-time.com 21 The authors can be reached via e-mail to <crossfire@schmorp.de>
28*/ 22*/
29 23
30/* This file contains all the code implementing diseases, 24/* This file contains all the code implementing diseases,
31 except for odds and ends in attack.c and in 25 except for odds and ends in attack.c and in
32 living.c*/ 26 living.c*/
252/* searches around for more victims to infect */ 246/* searches around for more victims to infect */
253int 247int
254check_infection (object *disease) 248check_infection (object *disease)
255{ 249{
256 int x, y, range, mflags; 250 int x, y, range, mflags;
257 mapstruct *map, *map2; 251 maptile *map, *map2;
258 object *tmp; 252 object *tmp;
259 sint16 i, j, i2, j2;
260 253
261 range = abs (disease->magic); 254 range = abs (disease->magic);
255
262 if (disease->env) 256 if (disease->env)
263 { 257 {
264 x = disease->env->x; 258 x = disease->env->x;
265 y = disease->env->y; 259 y = disease->env->y;
266 map = disease->env->map; 260 map = disease->env->map;
267 } 261 }
268 else 262 else
269 { 263 {
270 x = disease->x; 264 x = disease->x;
271 y = disease->y; 265 y = disease->y;
272 map = disease->map; 266 map = disease->map;
273 } 267 }
274 268
275 if (map == NULL) 269 if (!map)
276 return 0; 270 return 0;
271
277 for (i = x - range; i <= x + range; i++) 272 for (int i = x - range; i <= x + range; i++)
278 {
279 for (j = y - range; j <= y + range; j++) 273 for (int j = y - range; j <= y + range; j++)
280 { 274 {
275 sint16 i2, j2;
281 mflags = get_map_flags (map, &map2, i, j, &i2, &j2); 276 mflags = get_map_flags (map, &map2, i, j, &i2, &j2);
277
282 if (!(mflags & P_OUT_OF_MAP) && (mflags & P_IS_ALIVE)) 278 if (!(mflags & P_OUT_OF_MAP) && (mflags & P_IS_ALIVE))
283 {
284 for (tmp = get_map_ob (map2, i2, j2); tmp; tmp = tmp->above) 279 for (tmp = get_map_ob (map2, i2, j2); tmp; tmp = tmp->above)
285 {
286 infect_object (tmp, disease, 0); 280 infect_object (tmp, disease, 0);
287 }
288 }
289 } 281 }
290 } 282
291 return 1; 283 return 1;
292} 284}
293 285
294 286
295/* check to see if an object is infectable: 287/* check to see if an object is infectable:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines