hack.dog.c (a3fb5aa7) | hack.dog.c (3c439f43) |
---|---|
1/* $NetBSD: hack.dog.c,v 1.8 2006/03/30 01:31:13 jnemeth Exp $ */ | 1/* $NetBSD: hack.dog.c,v 1.9 2008/01/28 06:55:41 dholland Exp $ */ |
2 3/* 4 * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, 5 * Amsterdam 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are --- 48 unchanged lines hidden (view full) --- 58 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 59 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 60 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 61 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 62 */ 63 64#include <sys/cdefs.h> 65#ifndef lint | 2 3/* 4 * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, 5 * Amsterdam 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are --- 48 unchanged lines hidden (view full) --- 58 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 59 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 60 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 61 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 62 */ 63 64#include <sys/cdefs.h> 65#ifndef lint |
66__RCSID("$NetBSD: hack.dog.c,v 1.8 2006/03/30 01:31:13 jnemeth Exp $"); | 66__RCSID("$NetBSD: hack.dog.c,v 1.9 2008/01/28 06:55:41 dholland Exp $"); |
67#endif /* not lint */ 68 69#include "hack.h" 70#include "extern.h" 71#include "hack.mfndpos.h" 72#include "def.edog.h" 73#include "def.mkroom.h" 74 --- 159 unchanged lines hidden (view full) --- 234 /* maybe we tamed him while being swallowed --jgm */ 235 if (!udist) 236 return (0); 237 238 /* if we are carrying sth then we drop it (perhaps near @) */ 239 /* Note: if apport == 1 then our behaviour is independent of udist */ 240 if (mtmp->minvent) { 241 if (!rn2(udist) || !rn2((int) edog->apport)) | 67#endif /* not lint */ 68 69#include "hack.h" 70#include "extern.h" 71#include "hack.mfndpos.h" 72#include "def.edog.h" 73#include "def.mkroom.h" 74 --- 159 unchanged lines hidden (view full) --- 234 /* maybe we tamed him while being swallowed --jgm */ 235 if (!udist) 236 return (0); 237 238 /* if we are carrying sth then we drop it (perhaps near @) */ 239 /* Note: if apport == 1 then our behaviour is independent of udist */ 240 if (mtmp->minvent) { 241 if (!rn2(udist) || !rn2((int) edog->apport)) |
242 if (rn2(10) < edog->apport) { | 242 if ((unsigned) rn2(10) < edog->apport) { |
243 relobj(mtmp, (int) mtmp->minvis); 244 if (edog->apport > 1) 245 edog->apport--; 246 edog->dropdist = udist; /* hpscdi!jon */ 247 edog->droptime = moves; 248 } 249 } else { 250 if ((obj = o_at(omx, omy)) != NULL) 251 if (!strchr("0_", obj->olet)) { 252 if ((otyp = dogfood(obj)) <= CADAVER) { 253 nix = omx; 254 niy = omy; 255 goto eatobj; 256 } 257 if (obj->owt < 10 * mtmp->data->mlevel) | 243 relobj(mtmp, (int) mtmp->minvis); 244 if (edog->apport > 1) 245 edog->apport--; 246 edog->dropdist = udist; /* hpscdi!jon */ 247 edog->droptime = moves; 248 } 249 } else { 250 if ((obj = o_at(omx, omy)) != NULL) 251 if (!strchr("0_", obj->olet)) { 252 if ((otyp = dogfood(obj)) <= CADAVER) { 253 nix = omx; 254 niy = omy; 255 goto eatobj; 256 } 257 if (obj->owt < 10 * mtmp->data->mlevel) |
258 if (rn2(20) < edog->apport + 3) | 258 if ((unsigned) rn2(20) < edog->apport + 3) |
259 if (rn2(udist) || !rn2((int) edog->apport)) { 260 freeobj(obj); 261 unpobj(obj); 262 /* 263 * if(levl[omx][omy].s 264 * crsym == 265 * obj->olet) 266 * newsym(omx,omy); --- 19 unchanged lines hidden (view full) --- 286 if (otyp < gtyp || (otyp == gtyp && 287 DDIST(obj->ox, obj->oy) < DDIST(gx, gy))) { 288 gx = obj->ox; 289 gy = obj->oy; 290 gtyp = otyp; 291 } 292 } else if (gtyp == UNDEF && dogroom >= 0 && 293 uroom == dogroom && | 259 if (rn2(udist) || !rn2((int) edog->apport)) { 260 freeobj(obj); 261 unpobj(obj); 262 /* 263 * if(levl[omx][omy].s 264 * crsym == 265 * obj->olet) 266 * newsym(omx,omy); --- 19 unchanged lines hidden (view full) --- 286 if (otyp < gtyp || (otyp == gtyp && 287 DDIST(obj->ox, obj->oy) < DDIST(gx, gy))) { 288 gx = obj->ox; 289 gy = obj->oy; 290 gtyp = otyp; 291 } 292 } else if (gtyp == UNDEF && dogroom >= 0 && 293 uroom == dogroom && |
294 !mtmp->minvent && edog->apport > rn2(8)) { | 294 !mtmp->minvent && edog->apport > (unsigned)rn2(8)) { |
295 gx = obj->ox; 296 gy = obj->oy; 297 gtyp = APPORT; 298 } 299 } 300 if (gtyp == UNDEF || 301 (gtyp != DOGFOOD && gtyp != APPORT && moves < edog->hungrytime)) { 302 if (dogroom < 0 || dogroom == uroom) { --- 225 unchanged lines hidden --- | 295 gx = obj->ox; 296 gy = obj->oy; 297 gtyp = APPORT; 298 } 299 } 300 if (gtyp == UNDEF || 301 (gtyp != DOGFOOD && gtyp != APPORT && moves < edog->hungrytime)) { 302 if (dogroom < 0 || dogroom == uroom) { --- 225 unchanged lines hidden --- |