From d4861e906f3d90e94cff09bc921427a081d4434a Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Tue, 16 Nov 2021 11:23:16 +1100 Subject: [PATCH] Fix bug in fire damage calculation --- objects.c | 1003 ++++++++++++++++++++++++++--------------------------- 1 file changed, 501 insertions(+), 502 deletions(-) mode change 100644 => 100755 objects.c diff --git a/objects.c b/objects.c old mode 100644 new mode 100755 index 14e96cb..d4c6d4a --- a/objects.c +++ b/objects.c @@ -197,7 +197,7 @@ hiddennamewithcol_t colour[] = { hiddennamewithcol_t gemtype[] = { { "agate", C_MAGENTA, }, - { "amethyst", C_INDIGO, }, + { "amethyst", C_INDIGO, }, { "brass",C_LIGHTYELLOW }, { "bronze",C_DARKYELLOW }, { "copper",C_DARKYELLOW }, @@ -264,7 +264,7 @@ brand_t *addbrand(enum BRAND id, char *suffix, enum BODYPART bp, enum BLESSTYPE om = findbrand(id); assert(!om); - // add to the end of the list + // add to the end of the list if (firstbrand == NULL) { firstbrand = malloc(sizeof(brand_t)); a = firstbrand; @@ -287,7 +287,7 @@ brand_t *addbrand(enum BRAND id, char *suffix, enum BODYPART bp, enum BLESSTYPE a->suffix = strdup(buf); a->blessed = blessed; a->blesschance = blesschance; - + a->flags = addflagpile(NULL, NULL); return a; @@ -334,7 +334,7 @@ hiddenname_t *addhiddenname(enum OBCLASS obclass, char *text) { // make sure it doesn't already exist assert(counthiddennames(obclass, text) == 0); - // add to the end of the list + // add to the end of the list if (firsthiddenname == NULL) { firsthiddenname = malloc(sizeof(hiddenname_t)); a = firsthiddenname; @@ -360,7 +360,7 @@ hiddenname_t *addhiddenname(enum OBCLASS obclass, char *text) { knowledge_t *addknowledge(enum OBTYPE id, char *hiddenname, int known) { knowledge_t *a; - // add to the end of the list + // add to the end of the list if (knowledge == NULL) { knowledge = malloc(sizeof(knowledge_t)); a = knowledge; @@ -389,7 +389,7 @@ knowledge_t *addknowledge(enum OBTYPE id, char *hiddenname, int known) { material_t *addmaterial(enum MATERIAL id, char *name, float weightrating) { material_t *a; - // add to the end of the list + // add to the end of the list if (material == NULL) { material = malloc(sizeof(material_t)); a = material; @@ -416,7 +416,7 @@ material_t *addmaterial(enum MATERIAL id, char *name, float weightrating) { objectclass_t *addoc(enum OBCLASS id, char *name, char *desc, int glyph, int glyphcolour, enum RARITY rarity) { objectclass_t *a; - // add to the end of the list + // add to the end of the list if (objectclass == NULL) { objectclass = malloc(sizeof(objectclass_t)); a = objectclass; @@ -464,7 +464,7 @@ object_t *addobfast(obpile_t *where, enum OBTYPE oid) { // create a new object // if canstack is true, we are allwoed // to join similar objects together into a single -// object with o->amt set, instead of +// object with o->amt set, instead of // creating new obejct entries. // 'dolinks' determines whether or not to do things like liking holes, assigning destinations to maps, etc. @@ -594,7 +594,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (strstr(localname, om->prefix)) { strrep(&localname, om->prefix, "", NULL); if (db) dblog("DB: found obmod prefix '%s'",om->prefix); - + wantom[nom] = om; nom++; } else { @@ -676,19 +676,19 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum *p3 = '\0'; bonus += (atoi(numbuf) * bonussign); // strip off the "+xxx" / "-xxx", as long as xxx was a number. - // might not be the case if it was part of the object name + // might not be the case if it was part of the object name // eg. "waist-deep water" if (bonus) { int charsremoved; while (*bonusend == ' ') bonusend++; // go past spaces - // using memmove instead - //strcpy(bonusstart, bonusend); - memmove(bonusstart, bonusend, strlen(bonusend)); + // using memmove instead + //strcpy(bonusstart, bonusend); + memmove(bonusstart, bonusend, strlen(bonusend)); charsremoved = strlen(bonusstart) - strlen(bonusend); // NUL out remainder of buffer p[strlen(p) - charsremoved] = '\0'; } - } + } // handle prefixes. strip them off as we go. donesomething = B_TRUE; @@ -726,7 +726,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum wantblessed = B_CURSED; p += strlen("cursed "); donesomething = B_TRUE; - // blood + // blood } else if (strends(p, " blood")) { char *spaceblood,*pp,rname[BUFLEN],*rp,replacefrom[BUFLEN]; race_t *r = NULL; @@ -909,7 +909,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum p += strlen("original "); wantoriginal = B_TRUE; donesomething = B_TRUE; - + // weapon "goodness" } else if (strstarts(p, "average ")) { wantgoodness = G_AVERAGE; @@ -974,7 +974,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum p2 = strstr(p, "roast"); p2 += 6; p2 = readuntil(racename, p2, ' '); - + corpserace = findracebyname(racename, NULL); ot = findot(OT_ROASTMEAT); } else if (strstr(p, "water fountain")) { @@ -1012,7 +1012,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum branch_t *rt; char regionname[BUFLEN]; p2 = strstr(p, "map to "); - p2 += strlen("map to"); + p2 += strlen("map to"); p2++; // go past the space // grab name of region this map leads to strcpy(regionname, p2); @@ -1022,11 +1022,11 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (rt) { // find the regionthing ID of the RT_BRANCHLINK entrance wantregionthing = findbranchlink(rt->id); - } + } ot = findot(OT_MAP); } else if (strstr(p, "statue of ")) { char racename[BUFLEN]; - + // go to end p2 = strstr(p, "statue of "); p2 += 10; // now on either 'a' or 'an' @@ -1071,7 +1071,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum targetcell = getrandomadjcell(targetcell, &ccwalkable, B_ALLOWEXPAND); } } else { - // ie. adding to dummy cell + // ie. adding to dummy cell targetmap = NULL; targetcell = NULL; } @@ -1080,14 +1080,14 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (localname) free(localname); return NULL; } - + ot = findot(OT_PORTAL); } else if (strstarts(p, "generator \"")) { char *pp; char tempbuf[BUFLEN]; char whattomake[BUFLEN]; int radius,pct; - + pp = p + strlen("generator \""); pp = readuntil(tempbuf, pp, ','); if (!pp) { @@ -1103,13 +1103,13 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum } radius = atoi(tempbuf); - pp = readuntil(tempbuf, pp, '"'); + pp = readuntil(tempbuf, pp, '"'); if (!pp) { if (localname) free(localname); return NULL; } pct = atoi(tempbuf); - + addflag(wantflags, F_GENERATES, pct, radius, NA, whattomake); ot = findot(OT_GENERATOR); @@ -1121,7 +1121,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum char *sbp; sbp = sbuf; pp++; - + while (*pp && (*pp != '\"')) { *sbp = *pp; sbp++; @@ -1162,8 +1162,8 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum int found = B_FALSE; // check for things like "weapon" or "random ring" - // for weapons and armour, "matchlfskills" being set - // means that we should only select weapons/armour which + // for weapons and armour, "matchlfskills" being set + // means that we should only select weapons/armour which // matchlfskills is skilled in. for (oc = objectclass; oc ; oc = oc->next) { int i; @@ -1172,7 +1172,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum snprintf(tempname, BUFLEN, "random %s", oc->noun[i]); if (strstarts(p, tempname) || streq(p, oc->noun[i])) { matched = B_TRUE; - } + } if (matched) { condset_t cs; @@ -1201,7 +1201,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (maxar != NA) { addcond(&cs, CC_MAXAR, B_TRUE, maxar); } - } + } if (oc->id == OC_WEAPON) { if (mindr != NA) { @@ -1230,7 +1230,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum // want a specific rarity? //rrtorarity(wantrarity, &minrarity, &maxrarity); - initcondv(&cs, CC_HASFLAG, B_TRUE, F_GEM, + initcondv(&cs, CC_HASFLAG, B_TRUE, F_GEM, CC_NONE); //ot = getrandomobofclass(OC_ROCK, minrarity, maxrarity, NULL, &cs); ot = getrandomobofclass(OC_ROCK, NA, NA, wantrarity, NULL, &cs); @@ -1299,7 +1299,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum setcelltype(where->where, getcellempty(where->where)); } else { // the main thing which will cause this is placing objects - // in a radius - eg. clouds of steam. + // in a radius - eg. clouds of steam. if (localname) free(localname); return NULL; } @@ -1323,17 +1323,17 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum //////////////////////////////////// // we now have the objecttype! //////////////////////////////////// - + // don't put traps on top of stairs if (hasflag(ot->flags, F_TRAP)) { if (hasobwithflag(where, F_CLIMBABLE) || hasobwithflag(where, F_SHOP)) { ot = findot(OT_BLOODSTAIN); } } - - + + if (gamemode != GM_LOADING) { - // don't put floor gratings on low floors + // don't put floor gratings on low floors if (ot->id == OT_GRATINGFLOOR) { if (where->where && (where->where->type->id == CT_LOWFLOOR)) { setcelltype(where->where, where->where->map->habitat->emptycelltype); @@ -1446,9 +1446,9 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum // we asked for a different material. is this possible? - if ((wantdiffmat != MT_NOTHING) && !hasflagval(ot->flags, F_CANBEDIFFMAT, wantdiffmat, NA, NA, NULL)) { + if ((wantdiffmat != MT_NOTHING) && !hasflagval(ot->flags, F_CANBEDIFFMAT, wantdiffmat, NA, NA, NULL)) { wantdiffmat = MT_NOTHING; - } + } if (!wantoriginal) { // chance of being a different material based on ob flags @@ -1527,7 +1527,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum o->type = ot; o->pile = where; - o->birthtime = curtime; + o->birthtime = curtime; o->dying = B_FALSE; o->flags = addflagpile(NULL, o); @@ -1558,7 +1558,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum amt = rnd(f->val[0], f->val[1]); chargeflag = hasflag(o->flags, F_CHARGES); if (chargeflag) { - chargeflag->val[0] = amt; // randomly selected amt + chargeflag->val[0] = amt; // randomly selected amt chargeflag->val[1] = f->val[1]; // highest possible amt chargeflag->known = B_FALSE; } else { @@ -1594,7 +1594,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum } addedob[nadded++] = o; - + if (canstack) { // stop looping through break; @@ -1630,7 +1630,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (wantbloodrace && (wantbloodrace->id != R_NONE)) { flag_t *retflag[MAXCANDIDATES]; int nretflags = 0,i; - // don't duplicate this as then it will count as 'mixed blood' + // don't duplicate this as then it will count as 'mixed blood' if (!hasflagval(o->flags, F_LINKRACE, wantbloodrace->id, NA, NA, NULL)) { addflag(o->flags, F_LINKRACE, wantbloodrace->id, NA, NA, NULL); } @@ -1643,13 +1643,13 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum } } - if (hasflag(o->flags, F_NOBLESS)) { + if (hasflag(o->flags, F_NOBLESS)) { setblessed(o, B_UNCURSED); } else { setblessed(o, wantblessed); } - o->blessknown = wantblessknown; + o->blessknown = wantblessknown; if (wantdiffmat != MT_NOTHING) { changemat(o, wantdiffmat); @@ -1695,7 +1695,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (where->owner && isplayer(where->owner)) { killflagsofid(o->flags, F_UNTOUCHED); } - + // fill in portal destinations if (targetmap) { @@ -1730,7 +1730,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum // fit the game theme anyway. /* msg("DB: created abandoned temple"); more(); - dblog("DB: created abandoned temple"); + dblog("DB: created abandoned temple"); raise(SIGINT); */ // abandoned tamples make no sound @@ -1760,7 +1760,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum val[2] = NA; ok = B_TRUE; break; - default: + default: break; } } @@ -1884,12 +1884,12 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum // add contents to the book if (where->owner && isplayer(where->owner) && (gamemode == GM_CHARGEN)) { // giving to player at start of game - if (hasjobcat(where->owner, JC_MAGE)) { + if (hasjobcat(where->owner, JC_MAGE)) { enum OBTYPE firstspell; nspells = 5; firstlev = 2; - // fixed first spell + // fixed first spell firstspell = getfirstwizspell(bookcontents); assert(addobfast(o->contents, firstspell)); } else { @@ -1900,7 +1900,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum nspells = rnd(2,5); firstlev = rnd(1,4); } - for (i = 0; i < nspells; i++) { + for (i = 0; i < nspells; i++) { enum OBTYPE oid; int lev; lev = firstlev + i; @@ -1927,7 +1927,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (hasjob(where->owner, J_BATTLEMAGE)) { nschools = 3; } else if (hasjobcat(where->owner, JC_MAGE)) { - nschools = 6; + nschools = 6; } } @@ -1939,7 +1939,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (schoolappearsinbooks(ss) && !streq(getschoolname(ss), "badschool")) { school[nschools] = ss; nschools++; - } + } } } else { // select actual random schools to use. @@ -1964,7 +1964,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum } } } else if (where->owner && hasjobcat(where->owner, JC_MAGE)) { - school[i] = getrandomspellschool(where->owner, B_TRUE); + school[i] = getrandomspellschool(where->owner, B_TRUE); } else { // should never happen? school[i] = getrandomspellschool(NULL, B_FALSE); @@ -2063,7 +2063,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum c = getoblocation(o); adjmap = getmapindir(c->map, f->val[0]); if ((c->map->region->rtype->id == BH_WORLDMAP) && !adjmap) { - // ie. going down from the surface, and no dungeon below. + // ie. going down from the surface, and no dungeon below. // ( MUST be down because holes going up make no sense! ) createbranchlink(c->map, c, o, NULL, BH_PIT, c->map->region); } else { @@ -2088,7 +2088,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum // random one. corpserace = getrandomcorpserace(NULL, wantarmsize); } - + o->mass = corpserace->mass; o->material = corpserace->material; @@ -2102,7 +2102,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (cf) { cf->val[1] = sizetonutrition(rf->val[0]); } - } + } // fill in animal subspecies copyflag(o->flags, corpserace->flags, F_AVIAN); @@ -2119,14 +2119,14 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum // fill in map destination. if (!wantregionthing) { getbranchlinks(poss, &nposs, RT_BRANCHLINK, RT_NONE); - + if (nposs) { wantregionthing = poss[rnd(0,nposs-1)]; } } if (dolinks) { if (wantregionthing) { - // we now have the destination branchlink thing which the + // we now have the destination branchlink thing which the // map will lead to. // just using this to fill in srcregion @@ -2150,21 +2150,21 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum // select random race, or correct size. if (where) { corpserace = getrandomcorpserace(where, wantarmsize); - } + } if (!corpserace) { // ie. vending machine, or inside another object/fake cell? corpserace = getrandomcorpserace(NULL, wantarmsize); } if (corpserace->id != corpserace->baseid) corpserace = findrace(corpserace->baseid); } - + ratio = o->material->weightrating / corpserace->material->weightrating; o->mass = corpserace->mass * ratio; // remember the race type addflag(o->flags, F_CORPSEOF, corpserace->id, 1, NA, NULL); - + // set impassable size f = hasflag(o->flags, F_IMPASSABLE); if (f) { @@ -2192,7 +2192,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum flag_t *rf, *cf; assert(corpserace); - + o->mass = pctof(8, corpserace->mass); limitf(&o->mass, 0.01, NA); o->material = corpserace->material; @@ -2207,7 +2207,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (cf) { cf->val[1] = sizetonutrition(rf->val[0]) / 3; } - } + } } else if (o->type->id == OT_JERKY) { if (!corpserace) { corpserace = getrandomcorpserace(NULL, wantarmsize); @@ -2222,7 +2222,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum corpserace = getrandomcorpserace(NULL, wantarmsize); if (corpserace->id != corpserace->baseid) corpserace = findrace(corpserace->baseid); } - + o->mass = corpserace->mass / 2; // remember the race type @@ -2235,9 +2235,9 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (cf) { cf->val[1] = sizetonutrition(rf->val[0]); } - } + } - } + } if (o->type->id == OT_CORPSE) { if (corpserace) { @@ -2413,7 +2413,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum if (f && getoblocation(o)) { // randomly generate container contents if required. gencontainercontents(o); - + givestartobs(NULL, o, o->flags); } @@ -2563,7 +2563,7 @@ obmod_t *addobmod(enum OBMOD id, char *prefix) { om = findobmod(id); assert(!om); - // add to the end of the list + // add to the end of the list if (firstobmod == NULL) { firstobmod = malloc(sizeof(obmod_t)); a = firstobmod; @@ -2583,7 +2583,7 @@ obmod_t *addobmod(enum OBMOD id, char *prefix) { snprintf(buf, BUFLEN, "%s ",prefix); a->prefix = strdup(buf); a->naltprefix = 0; - + a->flags = addflagpile(NULL, NULL); return a; @@ -2627,7 +2627,7 @@ void addobsinradius(cell_t *centre, int radius, int dirtype, char *name, int all ot = findotn(name); if (!ot) return; - getradiuscells(centre, radius, DT_ORTH, B_FALSE, LOF_WALLSTOP, + getradiuscells(centre, radius, DT_ORTH, B_FALSE, LOF_WALLSTOP, (radius == 0) || includecentre ? B_TRUE : B_FALSE, cell, &ncells, B_FALSE); if (nretobs) *nretobs = 0; @@ -2659,7 +2659,7 @@ objecttype_t *addot(enum OBTYPE id, char *name, char *description, int material, ot = findot(id); assert(!ot); - // add to the end of the list + // add to the end of the list if (objecttype == NULL) { objecttype = malloc(sizeof(objecttype_t)); a = objecttype; @@ -2692,7 +2692,7 @@ objecttype_t *addot(enum OBTYPE id, char *name, char *description, int material, // ...but don'to inherit rarity killflagsofid(a->flags, F_RARITY); if (a->material) { - // inherit flags from material + // inherit flags from material copyflags(a->flags, a->material->flags, FROMMAT); } @@ -2701,7 +2701,7 @@ objecttype_t *addot(enum OBTYPE id, char *name, char *description, int material, return a; } -// usage: addrecipe(result, [ ingred_id, ingred_count, ingred_willbeconsumed ], OT_NONE) +// usage: addrecipe(result, [ ingred_id, ingred_count, ingred_willbeconsumed ], OT_NONE) recipe_t *addrecipe(enum OBTYPE result, ...) { recipe_t *a, *recipe_exists; va_list ingreds; @@ -2712,7 +2712,7 @@ recipe_t *addrecipe(enum OBTYPE result, ...) { recipe_exists = findrecipefor(result); assert(!recipe_exists); - // add to the end of the list + // add to the end of the list if (firstrecipe == NULL) { firstrecipe = malloc(sizeof(recipe_t)); a = firstrecipe; @@ -2884,11 +2884,11 @@ void adjustdamob(object_t *o, int *dam, enum DAMTYPE damtype) { } if (hasflag(o->flags, F_INVULNERABLE)) { - *dam = 0; + *dam = 0; return; } if (hasflag(o->flags, F_IMMUTABLE)) { - *dam = 0; + *dam = 0; return; } @@ -2975,7 +2975,7 @@ void adjustdamob(object_t *o, int *dam, enum DAMTYPE damtype) { adjustdamhardness(dam, damtype, o->material->id); } -// adjusts armour's ac//evasion penalty based on skill +// adjusts armour's ac//evasion penalty based on skill int adjustarmourpenalty(lifeform_t *lf, float amt) { enum SKILLLEVEL slev; @@ -2988,11 +2988,11 @@ int adjustarmourpenalty(lifeform_t *lf, float amt) { slev = getskill(lf, SK_ARMOUR); amt -= (slev*10); limitf(&amt, 0, NA); - + return amt; } -// adjusts shield's accuracy penalty based on skill +// adjusts shield's accuracy penalty based on skill int adjustshieldpenalty(lifeform_t *lf, float amt) { enum SKILLLEVEL slev; @@ -3083,16 +3083,16 @@ void applyobmod(object_t *o, obmod_t *om) { // ...but they do melt! f = addtempflag(o->flags, F_OBHPDRAIN, 1, DT_MELT, NA, NULL, FROMOBMOD); - // it needs HP to melt + // it needs HP to melt if (!hasflag(o->flags, F_OBHP)) { int myhp; // give hp myhp = getobmass(o) * 20; if (myhp <= 0) myhp = 2; - + addtempflag(o->flags, F_OBHP, myhp, myhp, NA, NULL, FROMOBMOD); } - if (!hasflag(o->flags, F_DAMAGABLE)) { + if (!hasflag(o->flags, F_DAMAGABLE)) { addtempflag(o->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL, FROMOBMOD); } } @@ -3161,7 +3161,7 @@ void brightflash(cell_t *centre, int range, lifeform_t *immunelf) { int x,y; cell_t *c; char buf[BUFLEN]; - + sprintf(buf, "You see an intense flash of light!"); animradial(centre, range, '}', DT_ORTH, C_WHITE, buf, buf); @@ -3173,7 +3173,7 @@ void brightflash(cell_t *centre, int range, lifeform_t *immunelf) { lifeform_t *lf; lf = haslf(c); if (lf && (lf != immunelf)) { - if (haslos(lf, centre) && !isblind(lf)) { + if (haslos(lf, centre) && !isblind(lf)) { if (!isplayer(lf)) { // we'll blind the player last if (!eyesshaded(lf)) { if (lfhasflag(lf, F_SEEINDARK)) { @@ -3194,7 +3194,7 @@ void brightflash(cell_t *centre, int range, lifeform_t *immunelf) { } // handle the player last, so that you see all the - // 'xx is blinded' messages before losing your own + // 'xx is blinded' messages before losing your own // sight. if (player != immunelf) { if (haslos(player, centre) && (getcelldist(player->cell, centre) <= range) && !isblind(player)) { @@ -3256,7 +3256,7 @@ int canseeob(lifeform_t *lf, object_t *o) { if (hasflag(o->flags, F_SECRET) && isplayer(lf)) { // can't see return B_FALSE; - } + } if (o->pile->where) { object_t *blockob; blockob = hasobwithflag(o->pile, F_BLOCKSVIEW); @@ -3310,7 +3310,7 @@ int canseeob(lifeform_t *lf, object_t *o) { return B_TRUE; } } - + smellrange = getsmellrange(lf); // can't smell your own race... @@ -3384,7 +3384,7 @@ int changemat(object_t *o, enum MATERIAL mat) { } if (o->material->id == mat) return E_NOEFFECT; - + // won't work on pyromania objects f = hasflag(o->flags, F_FLAMESTRIKE); if (f) { @@ -3459,7 +3459,7 @@ int checkobnames(char *haystack, char *needle) { // found it! if (db) dblog("checkobnames(): got exact match: '%s'",haystack); return B_TRUE; - } + } // search for words ending in "s" (eg. "swords") pluralname = strdup(needle); @@ -3476,14 +3476,14 @@ int checkobnames(char *haystack, char *needle) { // search for words ending in "es" (eg. tomatoes) if ((pluralname[strlen(pluralname)-1] == 'e') && - (pluralname[strlen(pluralname)-2] == 'o') + (pluralname[strlen(pluralname)-2] == 'o') ) { // remove trailing 'es' pluralname[strlen(pluralname)-1] = '\0'; pluralname[strlen(pluralname)-2] = '\0'; //if (db) dblog("findotn(): pluralname without 'es' is '%s'",pluralname); // search again - if (!strcmp(haystack, pluralname)) { + if (!strcmp(haystack, pluralname)) { if (db) dblog("checkobnames(): got match after stripping 'es': '%s' -> '%s'",pluralname, needle); free(pluralname); return B_TRUE; @@ -3662,11 +3662,11 @@ int curseob(object_t *o) { lifeform_t *lf; lf = o->pile->owner; - + // announce if (gamemode == GM_GAMESTARTED) { if (lf) { - if (cansee(player, lf)) { + if (cansee(player, lf)) { char lfname[BUFLEN]; char obname[BUFLEN]; getlfname(lf, lfname); @@ -3677,7 +3677,7 @@ int curseob(object_t *o) { } else { // not held cell_t *loc = NULL; loc = getoblocation(o); - if (haslos(player, loc)) { + if (haslos(player, loc)) { char obname[BUFLEN]; getobname(o, obname,o->amt); msg("A black aura surrounds %s.",obname); @@ -3704,7 +3704,7 @@ int curseob(object_t *o) { int countpilewetness(obpile_t *op, int equippedonly, object_t *exclude) { object_t *oo; int count = 0; - + for (oo = op->first ;oo ; oo = oo->next) { if (oo == exclude) continue; if (!equippedonly || isequipped(oo)) { @@ -3810,7 +3810,7 @@ int doobdieconvert(object_t *o, int wantannounce) { capitalise(obname); msg("%s %s.",obname, desc); } - } + } } // end if desc != "" } @@ -3868,7 +3868,7 @@ int triggerattachedtraps(object_t *o, lifeform_t *lf, int announce) { default: break; } - + return B_TRUE; } return B_FALSE; @@ -3892,13 +3892,13 @@ void dumpobs(int ntogen) { } -// this entire function doesn't really make sense anymore. +// this entire function doesn't really make sense anymore. void dumpobrarity(void) { enum RARITY rr; objecttype_t *ot; flag_t *f; int min,max; - + for (rr = RR_FREQUENT; rr <= RR_VERYRARE; rr++) { rrtorarity(rr, &min, &max); dblog("Obs with rarity %s:", getrarityname(rr)); @@ -3927,7 +3927,7 @@ void explodeob(object_t *o, flag_t *f, int bigness, lifeform_t *causedby) { dam = roll(f->text); - // inside a container? if so, it's the container + // inside a container? if so, it's the container // which you will see exploding. if (o->pile->parentob) { outerob = o->pile->parentob; @@ -3963,7 +3963,7 @@ void explodeob(object_t *o, flag_t *f, int bigness, lifeform_t *causedby) { // object dies. //removeob(o, o->amt); - // explode the container + // explode the container removeob(outerob, outerob->amt); } @@ -3975,17 +3975,17 @@ void extinguish(object_t *o) { if (f) { if (o->pile->owner) { if (isplayer(o->pile->owner)) { - msg("Your %s %s extinguished.", noprefix(obname), + msg("Your %s %s extinguished.", noprefix(obname), OB1(o,"is","are")); } else if (cansee(player, o->pile->owner)) { char lfname[BUFLEN]; getlfname(o->pile->owner, lfname); - msg("%s%s %s %s extinguished.", lfname, getpossessive(lfname), noprefix(obname), + msg("%s%s %s %s extinguished.", lfname, getpossessive(lfname), noprefix(obname), OB1(o,"is","are")); } } else if (o->pile->where && haslos(player, o->pile->where)) { getobname(o, obname, o->amt); - msg("%s %s extinguished.", obname, + msg("%s %s extinguished.", obname, OB1(o,"is","are")); } killflag(f); @@ -4100,18 +4100,18 @@ objecttype_t *findotn(char *name) { p++; } tempstr = strdup(p); - strcpy(modname, tempstr); + strcpy(modname, tempstr); free(tempstr); - } + } p = strchr(modname, '-'); if (p) { while (!isalpha(*p)) { p++; } tempstr = strdup(p); - strcpy(modname, tempstr); + strcpy(modname, tempstr); free(tempstr); - } + } if (db) dblog("findotn(): modname is '%s'",modname); @@ -4133,12 +4133,12 @@ objecttype_t *findotn(char *name) { return findot(k->id); } } - + // then partial matches on real name, but exclude certain things like innate attacks ("whipattack") for (ot = objecttype ; ot ; ot = ot->next) { if ((ot->obclass->id != OC_SPELL) && (ot->obclass->id != OC_ABILITY)) { if (!hasflag(ot->flags, F_UNARMEDWEP)) { - if (strstr(ot->name, modname)) { + if (strstr(ot->name, modname)) { free(modname); // found it! return ot; @@ -4152,7 +4152,7 @@ objecttype_t *findotn(char *name) { } // this will return the number to subtract from our percentage die roll -// when determining objects. +// when determining objects. // // lower roll = better object possibilities int getobrollmod(int depth, int range, int oodok) { // TODO: range currently unused @@ -4364,7 +4364,7 @@ void fragments(cell_t *centre, char *what, int speed, int howfar) { if (o) { real_fireat(NULL, o, o->amt, dst, speed, NULL, B_FALSE, OT_NONE, NULL); } - } else { + } else { // add object addob(dst->obpile, what); } @@ -4510,9 +4510,9 @@ enum LFSIZE getarmoursize(object_t *o) { f = hasflag(o->flags, F_ARMOURSIZE); if (f) { return f->val[0]; - } + } return SZ_HUMAN; - } + } return SZ_ANY; } @@ -4540,7 +4540,7 @@ object_t *getbestcontainer(obpile_t *op) { object_t *o,*poss[MAXPILEOBS],*poss2[MAXPILEOBS]; int nposs = 0,nposs2 = 0,i; enum LFSIZE bestsize = SZ_MIN; - + // find best container size for (o = op->first ; o ; o = o->next) { if (hasflag(o->flags, F_CONTAINER)) { @@ -4549,7 +4549,7 @@ object_t *getbestcontainer(obpile_t *op) { nposs++; thissize = getobsize(o); if (thissize > bestsize) bestsize = thissize; - } + } } if (!nposs) { return NULL; @@ -4577,7 +4577,7 @@ object_t *getbestcontainer(obpile_t *op) { // will ALLOCATE breakobs. remember to free afterwards // -// returns TRUE if an break obejct was found. +// returns TRUE if an break obejct was found. int getbreakob(object_t *o, char **breakobname, int *nbreakobs) { enum MATERIAL mid; enum DAMTYPE dt; @@ -4693,7 +4693,7 @@ int getbreakob(object_t *o, char **breakobname, int *nbreakobs) { break; default: break; } - + for (i = 0; i < *nbreakobs; i++) { breakob[i] = findot(breakoid[i]); } @@ -4791,7 +4791,7 @@ int getobaccuracy(object_t *wep, lifeform_t *weilder, int forthrow) { // adjust for weapon skill weplev = getweaponskill(weilder, wep); switch (weplev) { - case PR_INEPT: + case PR_INEPT: if (getskill(weilder, SK_COMBAT)) { acc -= 5; break; } else { @@ -4806,7 +4806,7 @@ int getobaccuracy(object_t *wep, lifeform_t *weilder, int forthrow) { default: break; } } - + return acc; } @@ -4905,7 +4905,7 @@ enum LFSIZE getobsize(object_t *o) { flag_t *ff; r = findrace(f->val[0]); ff = hasflag(r->flags, F_SIZE); - if (ff) { + if (ff) { return ff->val[0]; } else { return SZ_MEDIUM; @@ -4985,7 +4985,7 @@ int real_getobvalue(object_t *o, int amt) { if (f->id == F_DAM) { int min,max; getdamrange(o, f, &min, &max); - price += (max*7); + price += (max*7); } // armour rating if (f->id == F_ARMOURRATING) { @@ -5119,7 +5119,7 @@ object_t *getammo(object_t *gun) { objecttype_t *getbasicammofor(object_t *gun) { flag_t *retflag[MAXCANDIDATES]; int nretflags = 0, i; - + getflags(gun->flags, retflag, &nretflags, F_AMMOOB, F_NONE); for (i = 0; i < nretflags; i++) { if (retflag[i]->val[2] == B_TRUE) { @@ -5257,7 +5257,7 @@ object_t *findammoinobpile(object_t *gun, obpile_t *op) { int nretflags = 0, i; flag_t *f; object_t *o; - + getflags(gun->flags, retflag, &nretflags, F_AMMOOB, F_NONE); for (i = 0; i < nretflags; i++) { f = retflag[i]; @@ -5380,14 +5380,14 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity ((maxrarity == NA) || (f->val[1] <= maxrarity)) ) { rarityok = B_TRUE; } - + if (wantrr != NA) { int rrok = B_FALSE; if (f->val[2] == NA) { rrok = B_TRUE; } else if (f->val[2] == wantrr) { rrok = B_TRUE; - } + } if (!rrok) rarityok = B_FALSE; } } else { @@ -5433,7 +5433,7 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity int minok = B_FALSE,maxok = B_FALSE; if ((mindr == NA) || (f->val[1] >= mindr)) { minok = B_TRUE; - } + } if ((maxdr == NA) || (f->val[1] <= maxdr)) { maxok = B_TRUE; } @@ -5449,8 +5449,8 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity } } else flagok = B_TRUE; */ - - + + if (skillok && rarityok && condok) { poss[nposs++] = ot; count++; @@ -5461,7 +5461,7 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity if ((wantrr != NA) && (wantrr > RR_NONE)) { wantrr--; tryagain = B_TRUE; - } + } } } @@ -5469,7 +5469,7 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity free(poss); return NULL; } - ot = poss[rnd(0,nposs-1)]; + ot = poss[rnd(0,nposs-1)]; free(poss); return ot; @@ -5517,7 +5517,7 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity flagok = B_TRUE; } } else flagok = B_TRUE; - + if (skillok && rarityok && armourok && flagok) { n++; if (n == sel) { @@ -5580,7 +5580,7 @@ char *gethiddenname(object_t *o) { // otherwise return hidden one return k->hiddenname; } - + } } @@ -5613,7 +5613,7 @@ char *gethiddennameot(enum OBTYPE otid) { // otherwise return hidden one return k->hiddenname; } - + } } return ot->name; @@ -5735,7 +5735,7 @@ int getmaxthrowrange(lifeform_t *lf, object_t *o) { // 11 - kilos = distance str = getattr(lf, A_STR)/5; // ie. 1 - 20 - str -= 2; + str -= 2; limitf(&str, 1, NA); // ie. 1 to 16 obweight = getobweight(o); @@ -5800,7 +5800,7 @@ int getnutritionbase(object_t *o) { basenutr = (float)f->val[1]; } else { return 0; - } + } } if (hasflag(o->flags, F_BRUISED)) { @@ -5809,7 +5809,7 @@ int getnutritionbase(object_t *o) { } return basenutr; -} +} int getnutrition(object_t *o) { float nutrpct; @@ -5849,7 +5849,7 @@ enum DEPTH getobdepth(object_t *o, lifeform_t *lf) { lfsize -= 2; limit(&lfsize, SZ_MINI, NA); } - + mod = (SZ_HUMAN - lfsize); limit(&mod, SZ_MINI, NA); mod *= DP_CALF; @@ -5857,7 +5857,7 @@ enum DEPTH getobdepth(object_t *o, lifeform_t *lf) { depth += mod; limit(&depth, DP_NONE, DP_HEAD); } - } + } return depth; } @@ -5986,7 +5986,7 @@ char *getobequipinfo(object_t *o, char *buf) { f = hasflag(o->flags,F_SECONDARY); if (f) { strcat(buf, " (spare weapon)"); - } + } f = hasflag(o->flags,F_EQUIPPED); if (f) { @@ -6007,7 +6007,7 @@ char *getobequipinfo(object_t *o, char *buf) { strcat(buf, " (second weapon)"); } else if (isfirearm(o)) { strcat(buf, " (firearm)"); - } else { + } else { strcat(buf, " (in left hand)"); } } else { @@ -6251,13 +6251,13 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan } else { strcpy(basename, ""); } - + // monster lorelevel of beginner or higher - you get "newt footprints" lorelev = getlorelevel(player, r->raceclass->id); if (( lorelev >= PR_BEGINNER) && !hasflag(r->flags, F_NAME)) { snprintf(buf, BUFLEN, "%s %s",r->name, o->type->name); strcat(basename, buf); - } else if (lorelev >= PR_NOVICE) { + } else if (lorelev >= PR_NOVICE) { flag_t *sf; enum LFSIZE sz = SZ_HUMAN; // novice - you just get 'small animal footprints' etc @@ -6352,7 +6352,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan strcat(basename, getschoolname(f->val[0])); } } else if (o->type->id == OT_GRIMOIRE) { - // check F_NAME field + // check F_NAME field f = hasflag(o->flags, F_NAME); if (f) { sprintf(basename, "%s%s grimoire", f->text, getpossessive(f->text)); @@ -6411,7 +6411,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan } } } - + if ((o->type->id == OT_POT_WATER) && (o->blessed == B_BLESSED) && isblessknown(o) && isknown(o)) { strcpy(basename, "potion of holy water"); } @@ -6541,7 +6541,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan default: strcpy(sizetext, ""); break; - } + } if (strlen(sizetext)) { char newname[BUFLEN]; sprintf(newname, "%s %s", sizetext, basename); @@ -6592,9 +6592,9 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan } } - + // condition - // include mods + // include mods // ie. a blessed ->damaged<- flaming +5 silver sword of pyromania if (wantcondition) { // eaten? @@ -6613,7 +6613,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan - // include mods + // include mods // ie. a blessed damaged ->flaming<- +5 silver sword of pyromania if (wantpremods && (!isblind(player) || !adjustforblind)) { obmod_t *om; @@ -6624,7 +6624,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan if (p && strlen(p)) { strcat(localbuf, p); } - } + } } // other prefixes if (hasflagknown(o->flags, F_HOT)) { @@ -6671,7 +6671,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan // ie. a blessed damaged flaming +5 ->silver<- sword of pyromania if (o->material != o->type->material) { int domaterialprefix = B_TRUE; - // exception: corpse taking on its lf's + // exception: corpse taking on its lf's f = hasflag(o->flags, F_CORPSEOF); if (f) { race_t *r; @@ -6680,7 +6680,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan domaterialprefix = B_FALSE; } } - + if (domaterialprefix) { switch (o->material->id) { case MT_GOLD: @@ -6745,7 +6745,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan strcat(localbuf, br->suffix); } } - + // make sure obname doesn't start with a space while (localbuf[0] == ' ') { strcpy(localbuf, localbuf + 1); @@ -6905,7 +6905,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan strcpy(prefix, ""); } } else { - if (hasflag(o->flags, F_THE) && isknown(o)) { + if (hasflag(o->flags, F_THE) && isknown(o)) { strcpy(prefix, "The "); } else { if (needan(localbuf)) { @@ -6981,7 +6981,7 @@ char *getobconditionname(object_t *o, char *buf) { } // you only know it's rotting if you are smart or a cook - if (isrotting(o) && + if (isrotting(o) && ( (iqb >= AT_GTAVERAGE) || getskill(player, SK_COOKING)) ) { if (strlen(buf)) strcat(buf, " "); /* @@ -6992,7 +6992,7 @@ char *getobconditionname(object_t *o, char *buf) { } */ strcat(buf, "tainted"); - } + } } else { char condbuf[BUFLEN]; @@ -7022,19 +7022,19 @@ char *getobconditionname(object_t *o, char *buf) { char *getobhurtname(object_t *o, enum DAMTYPE damtype) { switch (damtype) { - case DT_ACID: + case DT_ACID: if (o->amt == 1) { return "corrodes"; } else { return "corrode"; } - case DT_DECAY: + case DT_DECAY: if (o->amt == 1) { return "decays"; } else { return "decay"; } - case DT_FIRE: + case DT_FIRE: if (o->amt == 1) { return "burns"; } else { @@ -7058,7 +7058,7 @@ char *getobhurtname(object_t *o, enum DAMTYPE damtype) { float getobmass(object_t *o) { float weight; - + weight = getobweight(o) * o->amt; // object contents @@ -7067,7 +7067,7 @@ float getobmass(object_t *o) { containerweight = getobpileweight(o->contents); weight += containerweight; } - + return weight; } @@ -7085,11 +7085,11 @@ float getobweight(object_t *o) { } else { weight = o->mass; } - + // has its material been changed? if (o->material != o->type->material) { // changed - some materials will - // modify the item's weight + // modify the item's weight float ratio; ratio = o->material->weightrating / o->type->material->weightrating; @@ -7173,7 +7173,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc hab = cell->map->habitat; } else { hab = NULL; - } + } if (hab) { strcpy(habname, hab->name); @@ -7181,7 +7181,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc strcpy(habname, "(any)"); } - if (forcedepth >= 0) { // WAS: if (forcedepth != NA) + if (forcedepth >= 0) { // WAS: if (forcedepth != NA) depth = forcedepth; } else if (cell) { depth = getmapdifficulty(cell->map); @@ -7211,7 +7211,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc if (wantcl == OC_NONE) { if (hab) { addcond(cs, CC_OBCLASS, B_TRUE, getrandomobclass(hab->id)); - } + } } if (!multiwantcl && (wantcl == OC_BUILDING)) { @@ -7221,9 +7221,9 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc for (i = 0; i < nbuildingusage; i++) { if (buildingusage[i].count < minused) { minused = buildingusage[i].count; - } + } } - // find possibilities + // find possibilities nposs = 0; for (i = 0; i < nbuildingusage; i++) { if (buildingusage[i].count == minused) { @@ -7233,10 +7233,10 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc bt = findot(thisoid); assert(bt); if (!hasflag(bt->flags, F_NORANDOM) && !hasflag(bt->flags, F_UNIQUE)) { - poss[nposs] = bt; + poss[nposs] = bt; nposs++; } - } + } } assert(nposs > 0); selot = poss[rnd(0,nposs-1)]; @@ -7244,7 +7244,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc return selot; } - // roll to determine object rarity + // roll to determine object rarity pctroll = rollforob(depth); while (!done) { @@ -7284,7 +7284,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc rarnum = rarflag->val[1]; if (rarnum == NA) rarnum = 100; - //if ((rarnum >= raritymin) && (rarnum <= raritymax)) + //if ((rarnum >= raritymin) && (rarnum <= raritymax)) if (pctroll <= rarnum) { // now check common, rare, etc enum RARITY thisrr; @@ -7294,11 +7294,11 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc } else { thisrr = rarflag->val[2]; } - + if (thisrr == wantrr) { rarok = B_TRUE; } else { - if (db) dblog(" %s rarity(%d) doesn't match wantrr(%d,%s)", ot->name, + if (db) dblog(" %s rarity(%d) doesn't match wantrr(%d,%s)", ot->name, rarflag->val[2], wantrr, getrarityname(wantrr)); } } else { @@ -7339,7 +7339,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc if (pctroll <= 0) { // now lower wantrr if (rrmoddir == -1) { - if (wantrr > RR_FREQUENT) { + if (wantrr > RR_FREQUENT) { wantrr--; if (db || partdb) dblog("pctroll at min (0) and no obs. lowering wantrr to %d (%s).",wantrr,getrarityname(wantrr)); } else { @@ -7349,7 +7349,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc rrmoddir = 1; if (db || partdb) dblog("rarity got below frequent. raising to original rr + 1 (%d, %s)",wantrr,getrarityname(wantrr)); } - } else { + } else { if (wantrr < RR_VERYRARE) { wantrr++; if (db || partdb) dblog("rarity at min/max and no obs. raising wantrr to %d(s).",wantrr,getrarityname(wantrr)); @@ -7402,7 +7402,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc int bonus = 0; int dir,chance; - if (strstr(cursestr, "cursed")){ // cursed WILL have a negative bonus + if (strstr(cursestr, "cursed")){ // cursed WILL have a negative bonus bonus = -1; // always at least -1 chance = 25; dir = -1; @@ -7447,7 +7447,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc if (om) { strcat(cursestr, om->prefix); strcat(cursestr, " "); - } + } if (hab && (hab->id == H_SEWER) && (ot->obclass->id == OC_FOOD)) { strcat(cursestr, "tainted "); @@ -7502,7 +7502,7 @@ enum OBCLASS getrandomobclass(enum HABITAT hab) { while (!nposs) { for (oc = objectclass ; oc ; oc = oc->next) { enum RARITY thisrarity = RR_NONE; - // if we were given a map, check the objectclass for specific + // if we were given a map, check the objectclass for specific // rarity flag for the maps' habitat. if (hab != H_ALL) { flag_t *f; @@ -7511,7 +7511,7 @@ enum OBCLASS getrandomobclass(enum HABITAT hab) { } // otherwise just use the default objectclass rarity if (thisrarity == RR_NONE) thisrarity = oc->rarity; - + if (thisrarity == wantrr) { poss[nposs++] = oc; } @@ -7612,7 +7612,7 @@ int getshatterdam(object_t *o) { int maxshatterdam; maxshatterdam = ceil(getobmass(o)); if (maxshatterdam < 1) maxshatterdam = 1; - + shatterdam = rnd(1, maxshatterdam); } return shatterdam; @@ -7683,11 +7683,11 @@ int getthrowdam(object_t *o) { // note: damage will also be modified based on speed in fireat() if (dam < 0) dam = 0; - + return (int)ceil(dam); } -// get either name of top object, or cell type +// get either name of top object, or cell type char *gettopobname(cell_t *c, char *retbuf) { char buf[BUFLEN]; int nother; @@ -7707,7 +7707,7 @@ char *gettopobname(cell_t *c, char *retbuf) { */ object_t *o; o = gettopobject(c, B_FALSE); - if (o) { + if (o) { getobname(o, buf, o->amt); strcat(retbuf, buf); // other obs here too? @@ -7772,7 +7772,7 @@ int getobwetness(object_t *o) { if (wetflag) { // towel will get slightly wetter. switch (wetflag->val[0]) { - case W_DAMP: count += 1; + case W_DAMP: count += 1; break; case W_WET: count += TM_WETTIME; // 10 damp objects = 1 wet object break; @@ -7872,7 +7872,7 @@ object_t *hasobofmaterial(obpile_t *op, enum MATERIAL mid) { int hasobmod(object_t *o, obmod_t *om) { flag_t *omf; int found = B_TRUE; - for (omf = om->flags->first ; omf ; omf = omf->next){ + for (omf = om->flags->first ; omf ; omf = omf->next){ int val[3],i; for (i = 0; i < 3; i++) { if (omf->obmodignoreval[i]) val[i] = NA; @@ -7923,7 +7923,7 @@ object_t *hasobid(obpile_t *op, long id) { return NULL; } -// is there an object of type oid within 'dist' of cell +// is there an object of type oid within 'dist' of cell object_t *hasobflagwithin(cell_t *start, enum FLAG fid, int dist, int disttype) { cell_t *retcell[MAXCANDIDATES],*c; int nretcells,i,mindist=9999; @@ -7988,7 +7988,7 @@ void ignite(object_t *o) { where = getoblocation(o); // change newob = addob(where->obpile, convertto); - + if (newob) { // announce if (haslos(player, where)) { @@ -8007,10 +8007,10 @@ void ignite(object_t *o) { if (!hasflag(o->flags, F_DAMAGABLE)) { addflag(o->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); } - // on fire for a while + // on fire for a while howlong = rnd(DEF_BURNTIMEMIN,DEF_BURNTIMEMAX); addtempflag(o->flags, F_ONFIRE, B_TRUE, NA, NA, NULL, howlong); - + } } } @@ -8044,7 +8044,7 @@ int isammofor(objecttype_t *ammo, object_t *gun) { int isbadfood(object_t *o) { if (hasflag(o->flags, F_TAINTED)) { return B_TRUE; - } + } if (isrotting(o)) { return B_TRUE; } @@ -8093,7 +8093,7 @@ int isbetterarmourthan(object_t *a, object_t *b) { } if (arma > armb) return B_TRUE; return B_FALSE; - + } // compare weapons using max damage @@ -8127,7 +8127,7 @@ int isbetterwepthan(object_t *a, object_t *b, lifeform_t *owner) { if (db) { msg("PREACC:a=%s:%d(acc %d), b=%s:%d(acc %d)",namea,dama,(int)acca, nameb, damb,(int)accb); } - + // add on the (acc/2)*damage to each one dama = dama + pctof(acca/2, dama); damb = damb + pctof(accb/2, damb); @@ -8344,7 +8344,7 @@ int isknownot(objecttype_t *ot) { } else { return B_FALSE; } - + } } @@ -8388,7 +8388,7 @@ int isimpassableob(object_t *o, lifeform_t *lf, enum LFSIZE forcesize) { enum LFSIZE blockmin, blockmax; if (!lf && (forcesize == SZ_ANY)) return B_TRUE; - + if (forcesize != SZ_ANY) { lfsize = forcesize; } else { @@ -8401,7 +8401,7 @@ int isimpassableob(object_t *o, lifeform_t *lf, enum LFSIZE forcesize) { if ((lfsize >= blockmin) && (lfsize <= blockmax)) { // exception - if you're flying over it if (getfeetheight(lf) >= blockmax) { - } else { + } else { return B_TRUE; } } @@ -8418,7 +8418,7 @@ int isimpassableob(object_t *o, lifeform_t *lf, enum LFSIZE forcesize) { return B_FALSE; } -// 'Interacting' is using things without holding them. +// 'Interacting' is using things without holding them. // // It's fine to interact with a computer, door or treasure chest. // It's NOT fine to interact with a wand, even though it is operable. @@ -8442,7 +8442,7 @@ int ismagicalobtype(objecttype_t *ot) { default: return B_TRUE; break; - } + } break; case OC_RING: case OC_WAND: @@ -8462,7 +8462,7 @@ int ismagicalobtype(objecttype_t *ot) { default: return B_TRUE; break; - } + } break; default: break; @@ -8492,7 +8492,7 @@ int ismagical(object_t *o) { } if (hasflag(o->flags, F_HASBRAND)) { return B_TRUE; - } + } if (hasflag(o->flags, F_ENCHANTABLE) && hasflag(o->flags, F_BONUS)) { return B_TRUE; } @@ -8588,7 +8588,7 @@ knowledge_t *istriedot(objecttype_t *ot) { } else { return NULL; } - + } } @@ -8681,14 +8681,14 @@ int isrotting(object_t *o) { flag_t *f; if (hasflag(o->flags, F_TAINTED)) { return B_TRUE; - } + } if (!iscorpse(o)) return B_FALSE; //getobhp(o, &max); f = hasflag(o->flags, F_DECAY); if (f && (f->val[0] >= 50)) { - // ie. food starts to be destroyed completely after 50 turns. + // ie. food starts to be destroyed completely after 50 turns. return B_TRUE; } @@ -9132,7 +9132,7 @@ void obtodancing(lifeform_t *newlf, object_t *o) { if (!isequipped(o)) { weild(newlf, o); } - + f = hasflag(o->flags, F_OBHP); if (f) { newlf->maxhp = f->val[1]; @@ -9188,13 +9188,13 @@ void makecool(object_t *o, int howmuch, int howlong) { f = hasflag(o->flags, F_HOT); if (f) { int newlife,newpower; - + newpower = f->val[0] - howmuch; if (newpower <= 0) { killflag(f); return; } - + if (f->lifetime > 0) { newlife = f->lifetime - howlong; if (newlife <= 0) { @@ -9202,7 +9202,7 @@ void makecool(object_t *o, int howmuch, int howlong) { return; } } - } + } } // returns true if something hapepned @@ -9307,7 +9307,7 @@ void makeknown(enum OBTYPE otid) { if (player) { // if player is holding an object of that type with F_CONFER.. IFKNOWN... and isn't known... // then by making the object known, we also need to give them the flag. - // + // // keep a list of objects and flags here, then give them afterwards. for (o = player->pack->first ; o ; o = o->next) { if ((o->type->id == otid) && !isknown(o)) { @@ -9405,7 +9405,7 @@ void maketried(enum OBTYPE otid, char *triedon) { knowledge_t *k; objecttype_t *ot; - // avoid adding '[tried]' to certain objects + // avoid adding '[tried]' to certain objects ot = findot(otid); if (ot && hasflag(ot->flags, F_NOTRIED)) { return; @@ -9459,7 +9459,7 @@ void makewet(object_t *o, int amt) { int rustchance = 25; f = hasflag(o->flags, F_RUSTED); if (f) rustchance += 25; - + if (pctchance(rustchance)) { if (amt < R_RUSTY) amt = R_RUSTY; if (amt > R_TRUSTY) amt = R_TRUSTY; @@ -9531,14 +9531,14 @@ void modifybetterwepdam(object_t *o, lifeform_t *owner, int *dam) { } if (hasflag(o->flags, F_ONFIRE)) { *dam += 8; - } + } getflags(o->flags, retflag, &nretflags, F_EXTRADAM, F_NONE); for (i = 0; i < nretflags; i++) { f = retflag[i]; if (f->val[2] == NA) { *dam += real_roll(f->text, B_TRUE); } else { - *dam += f->val[2]; + *dam += f->val[2]; } } // prefer weapons "...of xxxslaying" which match our targets @@ -9625,7 +9625,7 @@ object_t *real_moveob(object_t *src, obpile_t *dst, int howmany, int stackok) { // is it a godstone moving? if so, all other godstones will now vanish if (src->type->obclass->id == OC_GODSTONE) { object_t *oo,*nextoo; - for (oo = src->pile->first ; oo ; oo = nextoo) { + for (oo = src->pile->first ; oo ; oo = nextoo) { nextoo = oo->next; if ((oo != src) && (oo->type->obclass->id == OC_GODSTONE)) { removeob(oo, ALL); @@ -9697,13 +9697,13 @@ object_t *real_moveob(object_t *src, obpile_t *dst, int howmany, int stackok) { } killobpile(tempop); } - - } + + } if (o) { killflagsofid(o->flags, F_SECONDARY); - + if (dst->owner && isplayer(dst->owner) && isblessknown(o)) { o->blessknown = B_TRUE; } @@ -9743,11 +9743,11 @@ object_t *real_moveob(object_t *src, obpile_t *dst, int howmany, int stackok) { drawscreen(); } else { // we can see the floor here - // noone there + // noone there needredraw = B_TRUE; drawscreen(); } - } + } /* @@ -9844,7 +9844,7 @@ void obaction(object_t *o, char *text) { } else if (cansee(player, o->pile->owner)) { char lfname[BUFLEN]; getlfname(o->pile->owner, lfname); - msg("%s%s %s %s!", lfname, getpossessive(lfname), + msg("%s%s %s %s!", lfname, getpossessive(lfname), noprefix(obname), text); } } else if (haslos(player, o->pile->where)) { // on ground @@ -9987,7 +9987,7 @@ void obdie(object_t *o) { loc = getoblocation(o); o->dying = B_TRUE; - + // handle object conversion if (!doobdieconvert(o, B_TRUE)) { char desc[BUFLEN]; @@ -10018,7 +10018,7 @@ void obdie(object_t *o) { } } else if (haslos(player, o->pile->where)) { msg("%s %s.",obname, desc); - } + } } } @@ -10034,7 +10034,7 @@ void obdie(object_t *o) { explodeob(o, f, f->val[1], NULL); return; } - } + } // spell? f = hasflag(o->flags, F_SPELLCLOUDONDEATH); @@ -10063,23 +10063,23 @@ void obdie(object_t *o) { if (f->val[2] == B_IFACTIVATED) { if (isactivated(o)) { - spellcloud(where, f->val[1], DT_ORTH, cloudglyph.ch, cloudglyph.colour, f->val[0], power, B_TRUE, + spellcloud(where, f->val[1], DT_ORTH, cloudglyph.ch, cloudglyph.colour, f->val[0], power, B_TRUE, seebuf, noseebuf, B_FALSE, o, B_INCLUDECENTRE); removeob(o, o->amt); return; } } else { - spellcloud(where, f->val[1], DT_ORTH, cloudglyph.ch, cloudglyph.colour, f->val[0], power, B_TRUE, + spellcloud(where, f->val[1], DT_ORTH, cloudglyph.ch, cloudglyph.colour, f->val[0], power, B_TRUE, seebuf, noseebuf, B_FALSE, o, B_INCLUDECENTRE); removeob(o, o->amt); return; } - } + } - - - if (hasflag(o->flags, F_CONTAINER)) { + + + if (hasflag(o->flags, F_CONTAINER)) { object_t *oo, *nextoo; // dump object's contents into parent container for (oo = o->contents->first ; oo ; oo = nextoo) { @@ -10143,12 +10143,12 @@ void obdie(object_t *o) { } if (killer && - (o->type->obclass->id == OC_FLORA) && + (o->type->obclass->id == OC_FLORA) && (loc->map->region->rtype->id == BH_WOODS)) { magicwoods_angry(killer); } - if (killer && isplayer(killer)) { + if (killer && isplayer(killer)) { if (oblastdamtype(o) == DT_FIRE) { pleasegodmaybe(R_GODFIRE, 5); } else { @@ -10192,7 +10192,7 @@ int obhpknown(object_t *o) { showfullhp = B_TRUE; } else if ((o->type->material->id == MT_METAL) && getskill(player, SK_METALWORK)) { showfullhp = B_TRUE; - } else if ( ((o->type->material->id == MT_LEATHER) || (o->type->material->id == MT_CLOTH)) && + } else if ( ((o->type->material->id == MT_LEATHER) || (o->type->material->id == MT_CLOTH)) && getskill(player, SK_SEWING)) { showfullhp = B_TRUE; } @@ -10227,7 +10227,7 @@ int brandappliesto(brand_t *br, objecttype_t *ot) { } } - // other restrictions? + // other restrictions? if (hasflag(br->flags, F_ONLYFOROBTYPE)) { if (!hasflagval(br->flags, F_ONLYFOROBTYPE, ot->id, NA, NA, NULL)) { return B_FALSE; @@ -10365,7 +10365,7 @@ int obmeetscondition(object_t *o, enum CELLCONDITION cond, int arg, int value) { if (f->val[0] >= arg) { check = B_TRUE; } - } + } break; case CC_MAXAR: f = hasflag(o->flags, F_ARMOURRATING); @@ -10376,7 +10376,7 @@ int obmeetscondition(object_t *o, enum CELLCONDITION cond, int arg, int value) { } if (n <= arg) { check = B_TRUE; - } + } break; case CC_MINDR: f = hasflag(o->flags, F_DAM); @@ -10384,7 +10384,7 @@ int obmeetscondition(object_t *o, enum CELLCONDITION cond, int arg, int value) { if (f->val[1] >= arg) { check = B_TRUE; } - } + } break; case CC_MAXDR: f = hasflag(o->flags, F_DAM); @@ -10392,7 +10392,7 @@ int obmeetscondition(object_t *o, enum CELLCONDITION cond, int arg, int value) { if (f->val[1] <= arg) { check = B_TRUE; } - } + } break; case CC_MAXSIZE: if (getobsize(o) <= arg) check = B_TRUE; @@ -10500,7 +10500,7 @@ int otmeetscondition(objecttype_t *ot, enum CELLCONDITION cond, int arg, int val case CC_ARMOUR: if (ot->obclass->id == OC_ARMOUR) check = B_TRUE; break; - case CC_DAMAGED: + case CC_DAMAGED: assert("CC_DAMAGED not applicable to objecttypes"); break; case CC_DAMTYPE: @@ -10533,7 +10533,7 @@ int otmeetscondition(objecttype_t *ot, enum CELLCONDITION cond, int arg, int val if (f->val[0] >= arg) { check = B_TRUE; } - } + } break; case CC_MAXAR: f = hasflag(ot->flags, F_ARMOURRATING); @@ -10544,7 +10544,7 @@ int otmeetscondition(objecttype_t *ot, enum CELLCONDITION cond, int arg, int val } if (n <= arg) { check = B_TRUE; - } + } break; case CC_MINDR: f = hasflag(ot->flags, F_DAM); @@ -10552,7 +10552,7 @@ int otmeetscondition(objecttype_t *ot, enum CELLCONDITION cond, int arg, int val if (f->val[1] >= arg) { check = B_TRUE; } - } + } break; case CC_MAXDR: f = hasflag(ot->flags, F_DAM); @@ -10560,10 +10560,10 @@ int otmeetscondition(objecttype_t *ot, enum CELLCONDITION cond, int arg, int val if (f->val[1] <= arg) { check = B_TRUE; } - } + } break; case CC_MAXSIZE: - if (ot->size <= arg) check = B_TRUE; + if (ot->size <= arg) check = B_TRUE; break; case CC_OBCLASS: if (ot->obclass->id == arg) check = B_TRUE; @@ -10614,10 +10614,10 @@ int obproduceslight(object_t *o) { int thisamt = 0; if (f->val[2] == IFACTIVE) { if (isactivated(o)) { - sumflags(o->flags, F_PRODUCESLIGHT, &thisamt, NULL, NULL); + sumflags(o->flags, F_PRODUCESLIGHT, &thisamt, NULL, NULL); } } else { - sumflags(o->flags, F_PRODUCESLIGHT, &thisamt, NULL, NULL); + sumflags(o->flags, F_PRODUCESLIGHT, &thisamt, NULL, NULL); } amt += thisamt; } @@ -10688,7 +10688,7 @@ int obsfallthrough(cell_t *c, object_t *pit) { assert(uphole); getobname(uphole,upholename, 1); } - + for (oo = c->obpile->first ; oo ; oo = nextoo) { int canseebelowlf = B_FALSE; char verb[BUFLEN]; @@ -10846,7 +10846,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { ttype = f->val[0]; } if (f->val[2] != NA) range = f->val[2]; - + if (isplayer(lf)) { char subprompt[BUFLEN]; @@ -11076,7 +11076,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { char theob[BUFLEN]; cell_t *where; lifeform_t *mon = NULL; - + if (o->pile->owner) { char ownername[BUFLEN]; getlfname(o->pile->owner,ownername); @@ -11104,7 +11104,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } } else { snprintf(buf, BUFLEN, "Looting %s. Will you:",obname); - + addflagifneeded(o->flags, F_BEENOPENED, B_TRUE, NA, NA, NULL); initprompt(&prompt, buf); if (countobs(lf->pack, B_FALSE)) { @@ -11166,7 +11166,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { return B_TRUE; } else { condset_t cs; - initcondv(&cs, CC_SPECIFIED, B_TRUE, NA, + initcondv(&cs, CC_SPECIFIED, B_TRUE, NA, CC_NONE); snprintf(buf, BUFLEN, "Load %s with what ammo",obname); oo = askobject(lf->pack, buf, NULL, NULL, 'l', &cs, B_FALSE); @@ -11232,7 +11232,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { where = lf->cell; } } - + // random effect switch (rnd(0,22)) { case 0: // butterflies around user @@ -11422,7 +11422,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { dospelleffects(NULL, OT_S_REVEALHIDDEN, 10, lf, NULL, lf->cell, B_UNCURSED, NULL, B_TRUE, o); msg("\"AREA MAPPING COMPLETE.\""); break; - case 'o': + case 'o': // locate all objects on the level for (y = 0; y < lf->cell->map->h; y++) { for (x = 0; x < lf->cell->map->w; x++) { @@ -11511,8 +11511,8 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { if (isplayer(lf)) { condset_t cs; // ask for an object - initcondv(&cs, CC_HASFLAG, B_TRUE, F_REPLENISHABLE, - CC_HASFLAG, B_TRUE, F_TECHLEVEL, + initcondv(&cs, CC_HASFLAG, B_TRUE, F_REPLENISHABLE, + CC_HASFLAG, B_TRUE, F_TECHLEVEL, CC_NONE); targob = doaskobject(lf->pack, "Recharge which object", NULL, NULL, B_TRUE, B_TRUE, B_FALSE, '^', NULL, SA_NONE, &cs, B_FALSE); @@ -11542,7 +11542,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { object_t *oo; cell_t *c; // announce - if (isplayer(lf)){ + if (isplayer(lf)){ msg("Your %s unleashes a blast of power!", noprefix(obname)); } else if (cansee(player, lf)) { char lfname[BUFLEN]; @@ -11551,7 +11551,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } noise(lf->cell, NULL, NC_OTHER, 10, "an ear-splitting crack", NULL); switch (o->type->id) { - case OT_GODSTONE_BATTLE: + case OT_GODSTONE_BATTLE: // bless weapon oo = getweapon(lf); if (oo && (oo->blessed == B_UNCURSED)) { @@ -11591,7 +11591,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { char wname[BUFLEN]; r = poss[rnd(0,nposs-1)]; sprintf(wname, "%s warrior", r->name); - + c = real_getrandomadjcell(lf->cell, &ccwalkable, B_ALLOWEXPAND, LOF_WALLSTOP, NULL, lf); if (c) { summonmonster(lf, c, R_SPECIFIED, wname, rnd(50,90), B_TRUE); @@ -11633,13 +11633,13 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } // revert polymorphs if (lfhasflag(c->lf, F_ORIGRACE)) { - dospelleffects(NULL, OT_A_POLYREVERT, 1, + dospelleffects(NULL, OT_A_POLYREVERT, 1, c->lf, NULL, c->lf->cell, B_BLESSED, NULL, B_TRUE, o); } // fix injuries ("deformities") killflagsofid(c->lf->flags, F_INJURY); // destroy undead - if (isundead(c->lf)) { + if (isundead(c->lf)) { losehp(c->lf, 50, DT_DIRECT, lf, "the Godstone of Purity"); } } @@ -11664,23 +11664,23 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { break; case OT_GODSTONE_LIFE: // life // everything in sight is restored - // all corpses in sight are revived + // all corpses in sight are revived // everyone in lof gets f_rage, and hates everything for (i = 0; i < lf->cell->map->w * lf->cell->map->h; i++) { cell_t *c; c = lf->cell->map->cell[i]; if (haslof(lf->cell, c, LOF_WALLSTOP, NULL)) { if (c->lf) { - // restore - dospelleffects(NULL, OT_S_RESTORATION, 1, + // restore + dospelleffects(NULL, OT_S_RESTORATION, 1, c->lf, NULL, c->lf->cell, B_BLESSED, NULL, B_TRUE, o); } else { object_t *oo, *nextoo; - // revive corpses + // revive corpses for (oo = c->obpile->first ; oo ; oo = nextoo) { nextoo = oo->next; if (oo->type->id == OT_CORPSE) { - dospelleffects(NULL, OT_S_RESSURECTION, 1, + dospelleffects(NULL, OT_S_RESSURECTION, 1, NULL, oo, c, B_BLESSED, NULL, B_TRUE, o); } } @@ -11688,7 +11688,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } } break; - case OT_GODSTONE_MAGIC: + case OT_GODSTONE_MAGIC: // restore all mp gainmp(lf, lf->maxmp); // identify all objects @@ -11700,7 +11700,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { // learn any spell select_new_spell(SS_NONE, NA); break; - case OT_GODSTONE_NATURE: + case OT_GODSTONE_NATURE: // cure diseases dospelleffects(NULL, OT_S_CUREPOISON, 10, lf, NULL, lf->cell, B_UNCURSED, NULL, B_FALSE, o); // everyone in lof... @@ -11752,10 +11752,10 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { // they get an injury dospelleffects(NULL, OT_S_FLAYFLESH, 1, c->lf, NULL, c, B_BLESSED, NULL, B_TRUE, o); - - // they attack themself. + + // they attack themself. attackcell(c->lf, c, B_TRUE); - + // then all their objects appear under you if (isplayer(c->lf)) { msg("All your objects appear at %s%s feet!", lfname, @@ -11834,7 +11834,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } } else if (o->type->id == OT_LOCKPICK) { lockpick(lf, where, NULL, o); - + } else if (isfillable(o)) { object_t *oo,*nextoo; object_t *notenough = NULL; @@ -11918,7 +11918,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { getlfname(lf, lfname); msg("%s sacrifices %s.", lfname, obname); } - + removeob(o, 1); // regain mp @@ -12006,9 +12006,9 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } else if (cansee(player, lf)) { char lfname[BUFLEN]; getlfname(lf, lfname); - msg("%s%s %s beeps.", lfname, getpossessive(lfname), + msg("%s%s %s beeps.", lfname, getpossessive(lfname), noprefix(obname)); - } + } } else { addflag(oo->flags, F_LOCKED, B_TRUE, 100, NA, NULL); if (isplayer(lf)) { @@ -12016,9 +12016,9 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } else if (cansee(player, lf)) { char lfname[BUFLEN]; getlfname(lf, lfname); - msg("%s%s %s buzzes.", lfname, getpossessive(lfname), + msg("%s%s %s buzzes.", lfname, getpossessive(lfname), noprefix(obname)); - } + } } } } @@ -12077,7 +12077,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } else { dir = chartodir(ch); c = getcellindir(lf->cell, dir); - + if (digcell(lf, c, o, B_FALSE)) { // failed return B_TRUE; @@ -12146,7 +12146,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { getchoice(&prompt); o2 = (object_t *) prompt.result; } - + if (o2) { if (isplayer(lf)) { if (confirmknowntraps(o2)) { @@ -12231,7 +12231,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { default: msg("Cancelled."); return B_TRUE; - } + } } else { msg("There doesn't seem to be much you can do to %s.",obname); } @@ -12293,7 +12293,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { thisdist = getcelldist(lf->cell, c); if (thisdist < closest) { closest = thisdist; - dst = c; + dst = c; } } } @@ -12338,25 +12338,25 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { } assert(oo); getobname(oo, obname2, oo->amt); - snprintf(buf, BUFLEN, "There %s %s. Use your %s on %s?", OB1(oo, "is", "are"), + snprintf(buf, BUFLEN, "There %s %s. Use your %s on %s?", OB1(oo, "is", "are"), obname2, noprefix(obname), OB1(oo,"it","them")); - ch = askchar(buf, "yn","n", B_TRUE, B_FALSE); + ch = askchar(buf, "yn","n", B_TRUE, B_FALSE); } else if (nwet || ndryable) { snprintf(buf, BUFLEN, "There are wet objects here. Use your %s on them?", noprefix(obname)); - ch = askchar(buf, "yn","n", B_TRUE, B_FALSE); + ch = askchar(buf, "yn","n", B_TRUE, B_FALSE); } } - + if (ch == 'y') { if (!oo) { condset_t cs; - initcondv(&cs, CC_HASFLAG, B_ONEOF, F_WET, - CC_HASFLAG, B_ONEOF, F_DRYABLE, + initcondv(&cs, CC_HASFLAG, B_ONEOF, F_WET, + CC_HASFLAG, B_ONEOF, F_DRYABLE, CC_NONE); - oo = doaskobject(lf->cell->obpile, "Dry off which object", "There are no wet objects here.", NULL, + oo = doaskobject(lf->cell->obpile, "Dry off which object", "There are no wet objects here.", NULL, B_SHOWLONG, B_NOTFORPICKUP, B_DONTSHOWPOINTS, '\0', NULL, SA_NONE, &cs, B_INCLUDENOTHING); if (oo) { @@ -12370,7 +12370,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { if (isplayer(lf)) msg("%s doesn't need drying!", obname2); return B_TRUE; } - + // announce if (hasflag(oo->flags, F_DRYABLE)) { if (isplayer(lf)) { @@ -12397,7 +12397,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { // make it dry killflagsofid(oo->flags, F_WET); } - + } else { if (isplayer(lf)) msg("Cancelled."); return B_TRUE; @@ -12435,7 +12435,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { // make the towel wet (but it absorbs some of the moisture) count /= TM_WETTIME; - + if (count >= (TM_WETTIME * TM_WETTIME)) { howwet = W_SOAKED; } else if (count >= TM_WETTIME) { @@ -12485,7 +12485,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { snprintf(buf, BUFLEN, "Mix %s into what",obname); if (isplayer(lf)) { condset_t cs; - initcondv(&cs, CC_SPECIFIED, B_TRUE, NA, + initcondv(&cs, CC_SPECIFIED, B_TRUE, NA, CC_NONE); oo = askobject(lf->pack, buf, NULL, NULL, '\0', &cs, B_FALSE); } else { @@ -12524,7 +12524,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { getlfname(lf, lfname); msg("%s%s %s explodes!", lfname, getpossessive(lfname), oldname); } - + } } else { if (isplayer(lf)) msg("Cancelled."); @@ -12624,7 +12624,7 @@ int pour(lifeform_t *lf, object_t *o) { } } } - + } } @@ -12663,7 +12663,7 @@ int pour(lifeform_t *lf, object_t *o) { refillflag = hasflag(dst->flags, F_REFILLWITH); if (refillflag) { flag_t *f; - + if (refillflag->val[0] == o->type->id) { // refill destination f = hasflag(dst->flags, F_CHARGES); @@ -12691,7 +12691,7 @@ int pour(lifeform_t *lf, object_t *o) { if (isplayer(lf)) { msg("You pour %s onto %s.", obname,dstname); } - o->blessknown = B_TRUE; + o->blessknown = B_TRUE; // bless whatever we poured onto blessob(dst); // we now know that this is holy water @@ -12704,7 +12704,7 @@ int pour(lifeform_t *lf, object_t *o) { if (isplayer(lf)) { msg("You pour %s onto %s.", obname,dstname); } - o->blessknown = B_TRUE; + o->blessknown = B_TRUE; // curse whatever we poured onto curseob(dst); // we now know that this is unholy water @@ -12764,7 +12764,7 @@ int pour(lifeform_t *lf, object_t *o) { f->val[0] = f->val[1]; } } - } + } // we now know what the potion was if (!isknown(o)) makeknown(o->type->id); @@ -12805,7 +12805,7 @@ int pour(lifeform_t *lf, object_t *o) { } } - + // empty the flask if (lfhasflag(lf, F_NOPACK)) { // ie. if you drunk a gaseous form potion @@ -12841,7 +12841,7 @@ void quaff(lifeform_t *lf, object_t *o) { } else { playercansee = B_FALSE; } - + taketime(lf, getactspeed(lf)); if (o->type->id == OT_FOUNTAIN) { @@ -12884,9 +12884,9 @@ void quaff(lifeform_t *lf, object_t *o) { if (f->val[2] == B_TRUE) { // fountain which is already identified willid = B_FALSE; - } + } // otherwise identify based on potion effects... - } + } switch (realobid) { case OT_NONE: @@ -12958,7 +12958,7 @@ void quaff(lifeform_t *lf, object_t *o) { drinkflag->val[2] = NA; } } - + if (drinkflag->val[2] == B_DONTKILL) { killobwhendone = B_FALSE; } @@ -12982,7 +12982,7 @@ void quaff(lifeform_t *lf, object_t *o) { // remove the potion (or whatever it is) removeob(o, 1); } - + } // o can be NULL if we're just doing potion EFFECTS, not actually drinking one. @@ -13046,7 +13046,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE seenbyplayer = B_FALSE; if (seen) *seen = B_FALSE; } else { - addtempflag(lf->flags, F_CANWILL, OT_A_JUMP, NA, NA, NULL, i); + addtempflag(lf->flags, F_CANWILL, OT_A_JUMP, NA, NA, NULL, i); } break; case OT_POT_AMBROSIA: @@ -13078,7 +13078,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE default: case B_UNCURSED: i = rnd(10,20); break; } - addtempflag(lf->flags, F_BLIND, B_TRUE, NA, NA, NULL, i); + addtempflag(lf->flags, F_BLIND, B_TRUE, NA, NA, NULL, i); break; case OT_POT_CANINETRACKING: dospelleffects(lf, OT_S_CANINETRACKING, 8, lf, NULL, lf->cell, potblessed, seen, B_TRUE, NULL); @@ -13091,7 +13091,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE modhunger(lf, -pctof(10, (float)HUNGERCONST)); // sobers you up killtransitoryflags(lf->flags, F_DRUNK); - // no more sleeping for a while! + // no more sleeping for a while! addtempflag(lf->flags, F_CAFFEINATED, B_TRUE, NA, NA, NULL,rnd(30,60)); break; @@ -13149,7 +13149,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE } f->lifetime += TM_DRUNKTIME; } else { - addtempflag(lf->flags, F_DRUNK, 1, NA, NA, NULL, TM_DRUNKTIME); + addtempflag(lf->flags, F_DRUNK, 1, NA, NA, NULL, TM_DRUNKTIME); } } // also a bit filling @@ -13168,10 +13168,10 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE i = geteffecttime(15,25,potblessed); if (!isimmuneto(lf->flags, DT_FIRE, B_FALSE)) { - addtempflag(lf->flags, F_DTIMMUNE, DT_FIRE, NA, NA, NULL, i); + addtempflag(lf->flags, F_DTIMMUNE, DT_FIRE, NA, NA, NULL, i); } if (!isimmuneto(lf->flags, DT_COLD, B_FALSE)) { - addtempflag(lf->flags, F_DTIMMUNE, DT_COLD, NA, NA, NULL, i); + addtempflag(lf->flags, F_DTIMMUNE, DT_COLD, NA, NA, NULL, i); } break; case OT_POT_ETHEREALNESS: @@ -13211,7 +13211,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE i = geteffecttime(50,100,potblessed); if (!lfhasflag(lf, F_BREATHWATER)) { - addtempflag(lf->flags, F_BREATHWATER, B_TRUE, NA, NA, NULL, i); + addtempflag(lf->flags, F_BREATHWATER, B_TRUE, NA, NA, NULL, i); } break; case OT_POT_FURY: @@ -13262,7 +13262,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE } } else { if (!lfhasflagval(lf, F_INVULNERABLE, B_TRUE, NA, NA, NULL)) { - addtempflag(lf->flags, F_INVULNERABLE, B_TRUE, NA, NA, NULL, i); + addtempflag(lf->flags, F_INVULNERABLE, B_TRUE, NA, NA, NULL, i); } } break; @@ -13291,7 +13291,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE nothinghappens(); if (seen) *seen = B_FALSE; } - + break; case OT_POT_OIL: if (isplayer(lf)) { @@ -13344,7 +13344,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE msg("Some nearby objects disappear!"); } } - + // add holy barriers all around for (dir = DC_N; dir <= DC_NW; dir++) { cell_t *c; @@ -13354,7 +13354,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE // get lifeforms out of the way if (c->lf) { - knockback(c->lf, getdiraway(c, lf->cell, NULL, B_FALSE, DT_ORTH, B_FALSE), + knockback(c->lf, getdiraway(c, lf->cell, NULL, B_FALSE, DT_ORTH, B_FALSE), 1, lf, 0, B_DOANNOUNCE, B_DODAM); } @@ -13372,7 +13372,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE addflag(newob->flags, F_CREATEDBY, lf->id, NA, NA, NULL); } } - + } } break; @@ -13394,7 +13394,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE i = geteffecttime(20,50,potblessed); addtempflag(lf->flags, F_SPIDERCLIMB, B_TRUE, NA, NA, NULL, i); if (!lfhasflagval(lf, F_CANWILL, OT_A_CLIMB, NA, NA, NULL)) { - addtempflag(lf->flags, F_CANWILL, OT_A_CLIMB, NA, NA, NULL, i); + addtempflag(lf->flags, F_CANWILL, OT_A_CLIMB, NA, NA, NULL, i); } break; case OT_POT_WATER: @@ -13439,7 +13439,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE getobname(o2, o2name, o2->amt); msg("^gYour %s pulses as your drink!^n", noprefix(o2name)); makeknown(o2->type->id); - } + } msg("This blood is delicious!"); } if (potblessed == B_BLESSED) { @@ -13546,7 +13546,7 @@ int readsomething(lifeform_t *lf, object_t *o) { } return B_TRUE; } - + if (lfhasflag(lf, F_SILENCED)) { if (o->type->obclass->id != OC_BOOK) { if (isplayer(lf)) { @@ -13585,7 +13585,7 @@ int readsomething(lifeform_t *lf, object_t *o) { if (hasflag(o->flags, F_DEAD)) { return B_TRUE; } - + if (lf->controller != C_PLAYER) { if (cansee(player, lf)) { @@ -13612,19 +13612,19 @@ int readsomething(lifeform_t *lf, object_t *o) { } } else { switch (o->type->id) { - case OT_SCR_IDENTIFY: - case OT_SCR_MENDING: + case OT_SCR_IDENTIFY: + case OT_SCR_MENDING: if (isblessed(o)) { willid = B_TRUE; } else { // only id if it does something willid = B_FALSE; } - case OT_SCR_REPLENISHMENT: - case OT_SCR_ENCHANT: + case OT_SCR_REPLENISHMENT: + case OT_SCR_ENCHANT: case OT_SCR_CREATEMONSTER: - case OT_SCR_REMOVECURSE: - case OT_SCR_DETECTAURA: + case OT_SCR_REMOVECURSE: + case OT_SCR_DETECTAURA: // only id if it does something willid = B_FALSE; break; @@ -13653,7 +13653,7 @@ int readsomething(lifeform_t *lf, object_t *o) { } } - if (willid && + if (willid && (!isknown(o) || ((o->type->id == OT_MAP) && !isidentified(o)) ) ) { // id the object if ((o->type->obclass->id == OC_BOOK) || (o->type->id == OT_MAP)) { @@ -13681,7 +13681,7 @@ int readsomething(lifeform_t *lf, object_t *o) { // dont double up the god bonus for using magic. } - // special scrolls + // special scrolls if ((o->type->id == OT_SCR_IDENTIFY) && isblessed(o)) { int seen = B_FALSE; if (isplayer(lf)) { @@ -13739,7 +13739,7 @@ int readsomething(lifeform_t *lf, object_t *o) { if (targob) { if (isplayer(lf)) { // this will be used by maketried() later - real_getobname(targob, triedonbuf, 1, B_NOPREMODS, B_NOCONDITION, + real_getobname(targob, triedonbuf, 1, B_NOPREMODS, B_NOCONDITION, B_BLINDADJUST, B_NOBLESSINGS, B_USED, B_NOSHOWALL); } } else { @@ -13756,7 +13756,7 @@ int readsomething(lifeform_t *lf, object_t *o) { targlf = lf; } castspell(lf, f->val[0], targlf, targob, targcell, o, &seen); - + /* dospelleffects(lf, f->val[0], power, NULL, targob, NULL, o->blessed, &seen, B_FALSE); */ @@ -13782,7 +13782,7 @@ int readsomething(lifeform_t *lf, object_t *o) { char isare[BUFLENSMALL]; f = hasflag(o->flags, F_MAPTO); if (f) { - srcregion = findregion(f->val[0]); + srcregion = findregion(f->val[0]); srcdepth = f->val[1]; destthing = findregionthing(f->val[2], NULL); destbranch = findbranch(destthing->value); @@ -13810,7 +13810,7 @@ int readsomething(lifeform_t *lf, object_t *o) { region_t *destregion = NULL; int dist; destregion = findregionbytype(destthing->value); - + destob = findmapobwithflagval(lf->cell->map, F_CLIMBABLE, NA, destregion->id, NA, NULL); if (!destob) { // doesn't exist for some reason?!?!? @@ -13825,7 +13825,7 @@ int readsomething(lifeform_t *lf, object_t *o) { if (lf->cell == destcell) { msg("%s %s right here, according to the map!", f->text, isare); if (slev == PR_MASTER) { - // still reveal around it + // still reveal around it setcellknownradius(destcell, PR_MASTER, 5, DT_ORTH); needredraw = B_TRUE; } @@ -13843,22 +13843,22 @@ int readsomething(lifeform_t *lf, object_t *o) { msg("%s %s to the %s.", f->text, isare, dirbuf); break; case PR_ADEPT: - // direction + + // direction + // near/far dist to cell msg("%s %s %s to the %s.", f->text, isare, distbufbad, dirbuf); break; case PR_SKILLED: - // direction + + // direction + // good dist to cell msg("%s %s %s to the %s.", f->text, isare, distbuf, dirbuf); break; case PR_EXPERT: - // direction + + // direction + // exact dist to cell msg("%s %s %d metres away to the %s.", f->text, isare, dist, dirbuf); break; case PR_MASTER: - // reveal it + // reveal it msg("You have located %s in this area.", f->text); setcellknownradius(destcell, PR_MASTER, 5, DT_ORTH); needredraw = B_TRUE; @@ -13878,7 +13878,7 @@ int readsomething(lifeform_t *lf, object_t *o) { msg("%s %s in this area.", f->text, plural ? "aren't" : "isn't"); break; case PR_ADEPT: - // up/down + // up/down if (lf->cell->map->depth > srcdepth) { msg("%s %s somewhere above you.", f->text, isare); } else { @@ -13973,7 +13973,7 @@ int readsomething(lifeform_t *lf, object_t *o) { } // make enhanced/reduced attributes permenant for (a = 0; a < MAXATTS; a++) { - int innate,actual; + int innate,actual; innate = lf->att[a]; actual = getattr(lf, a); if (actual != innate) { @@ -13989,7 +13989,7 @@ int readsomething(lifeform_t *lf, object_t *o) { if (!ndone) { object_t *oo,*poss[MAXPILEOBS]; int nposs = 0; - + // make a weapon or piece of armour invulnerable for (oo = lf->pack->first ; oo ; oo = oo->next) { if (isweapon(oo) || isarmour(oo)) { @@ -14059,12 +14059,12 @@ int readsomething(lifeform_t *lf, object_t *o) { getobname(oo,obname,oo->amt); getlfname(lf, lfname); if (oo->pile->owner == lf) { - msg("%s%s %s vanishes and reappears in %ss pack.", lfname, - getpossessive(lfname), + msg("%s%s %s vanishes and reappears in %ss pack.", lfname, + getpossessive(lfname), noprefix(obname), it(lf)); } else { - msg("%s%s %s vanishes and appears on the ground.", lfname, - getpossessive(lfname), + msg("%s%s %s vanishes and appears on the ground.", lfname, + getpossessive(lfname), noprefix(obname)); } } @@ -14076,7 +14076,7 @@ int readsomething(lifeform_t *lf, object_t *o) { if (fixcurses(lf)) { if (isplayer(lf) || cansee(player, lf)) seen = B_TRUE; } - + if (seen) { // id the scroll now makeknown(o->type->id); o->blessknown = B_TRUE; @@ -14270,7 +14270,7 @@ object_t *relinkob(object_t *src, obpile_t *dst) { // adjust letter if going to player? if (dst->owner && isplayer(dst->owner)) { src->letter = getnextletter(dst, &src->letter); - } + } // unlink this object from the current list if (src->prev == NULL) { @@ -14288,7 +14288,7 @@ object_t *relinkob(object_t *src, obpile_t *dst) { src->next->prev = src->prev; } - // add this object to the end of the list for the new pile + // add this object to the end of the list for the new pile if (dst->first == NULL) { // first element in new list dst->first = src; @@ -14322,7 +14322,7 @@ object_t *relinkob(object_t *src, obpile_t *dst) { //calclight(pos->map); if (gamemode == GM_GAMESTARTED) { if (haslos(player, pos)) { - setlosdirty(player); + setlosdirty(player); } //precalclos(player); } @@ -14403,36 +14403,36 @@ int rollforob(int depth) { void rrtorarity(enum RARITY r, int *minr, int *maxr) { switch (r) { - case RR_UNIQUE: - case RR_NEVER: + case RR_UNIQUE: + case RR_NEVER: if (minr) *minr = 0; - if (maxr) *maxr = 0; + if (maxr) *maxr = 0; break; - case RR_VERYRARE: + case RR_VERYRARE: if (minr) *minr = 0; - if (maxr) *maxr = 25; + if (maxr) *maxr = 25; break; - case RR_RARE: + case RR_RARE: if (minr) *minr = 25; - if (maxr) *maxr = 45; + if (maxr) *maxr = 45; break; - case RR_UNCOMMON: + case RR_UNCOMMON: if (minr) *minr = 45; - if (maxr) *maxr = 65; + if (maxr) *maxr = 65; break; - case RR_COMMON: + case RR_COMMON: if (minr) *minr = 65; - if (maxr) *maxr = 85; + if (maxr) *maxr = 85; break; - case RR_FREQUENT: + case RR_FREQUENT: if (minr) *minr = 85; - if (maxr) *maxr = 100; + if (maxr) *maxr = 100; break; - default: + default: if (minr) *minr = 0; if (maxr) *maxr = 100; // ie. rarity can be anything break; - + } } @@ -14442,7 +14442,7 @@ void setblessed(object_t *o, enum BLESSTYPE wantbless) { flag_t *f,*nextf; // remove glowing from blessings for (f = o->flags->first ; f ; f = nextf) { - nextf = f->next; + nextf = f->next; if (f->lifetime == FROMBLESSING) { killflag(f); } @@ -14583,7 +14583,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) { } msg("%s%s shatter%s!",prefix, strlen(prefix) ? noprefix(obname) : obname, OBS1(o)); - + seen = B_TRUE; } else { noise(where, NULL, NC_OTHER, SV_SHOUT, "shattering glass.", NULL); @@ -14598,7 +14598,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) { targetname, is(target), o->material->name); } losehp(target, shatterdam, DT_SLASH, fromlf, damstring); - } + } } // place shards @@ -14612,11 +14612,11 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) { int numshards; numshards = getnumshards(o) / 15; if (numshards < 1) numshards = 1; - - // ice + + // ice snprintf(buf, BUFLEN, "%d chunks of ice",numshards); addob(o->pile, buf); - } + } // potion effects (only if you hit)? if (o->type->obclass->id == OC_POTION) { @@ -14632,7 +14632,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) { } if (target) { if (seen) { - msg("%s %s splashed with acid!", targetname, + msg("%s %s splashed with acid!", targetname, is(target)); } losehp(target, rnd(1,5)*o->amt, DT_ACID, fromlf, "a splash of acid"); @@ -14649,7 +14649,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) { } if (target) { if (seen) { - msg("%s %s splashed with blood.", targetname, + msg("%s %s splashed with blood.", targetname, is(target)); } } else { @@ -14710,7 +14710,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) { if (seen) makeknown(o->type->id); if (target) { if (seen) { - msg("%s %s splashed with water.", targetname, + msg("%s %s splashed with water.", targetname, is(target)); } @@ -14742,7 +14742,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) { takedamage(oo, 0, DT_WATER, fromlf); } } - + break; default: break; @@ -14805,7 +14805,7 @@ void shufflehiddennames(void) { for (i = 0; i < shuffleamt; i++) { int which; - + // select random element (but never the first) which = (rand() % (total-1))+1; @@ -14861,10 +14861,10 @@ int sizetonutrition(enum LFSIZE size) { object_t *splitob(object_t *o) { object_t *newob; // decrease count on original stack temporarily, in case we - // can't place the new object (at our weight limit?). + // can't place the new object (at our weight limit?). // doesn't matter if it goes down to zero, as we will put it back up soon. o->amt--; - // give new object + // give new object newob = addobject(o->pile, NULL, B_NOSTACK, B_FALSE, o->type->id); // restore count o->amt++; @@ -14892,9 +14892,9 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif return howmuch; } - // some checks need to happen before + // some checks need to happen before // making sure the damage will happen. - // for example, even if an object is + // for example, even if an object is // immune to water damage, water will // still put out fire @@ -14913,7 +14913,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif if (c) { addob(c->obpile, "puff of steam"); } - } + } // water dissolves powders if (hasflag(o->flags, F_POWDER)) { @@ -14931,7 +14931,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif // initial effects based on damage type if (damtype == DT_FIRE) { - if ( ((o->type->id == OT_CANDLE) || (o->type->id == OT_TORCH) || (o->type->id == OT_CANDELABRUM)) && + if ( ((o->type->id == OT_CANDLE) || (o->type->id == OT_TORCH) || (o->type->id == OT_CANDELABRUM)) && !isactivated(o)) { cell_t *c; c = getoblocation(o); @@ -14946,15 +14946,15 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif howmuch--; } else if (isflammable(o) && !hasflag(o->flags, F_ONFIRE)) { if (!isimmuneto(o->flags, DT_FIRE, B_FALSE)) { - ignite(o); + ignite(o); if (isdeadob(o)) { return howmuch; } } - } + } // actually take fire damage - // fire damage falls through to owner + // fire damage falls through to owner if (o->pile->owner) { flag_t *f; lifeform_t *owner; @@ -14963,9 +14963,8 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif f = hasflag(o->flags, F_EQUIPPED); if (f) { // no damage from equipped _weapons_ - if ((f->val[0] != BP_WEAPON) || (f->val[0] != BP_SECWEAPON)) { - } else { - // equipped clothes/armour? full damage. + if ((f->val[0] != BP_WEAPON) && (f->val[0] != BP_SECWEAPON)) { + // equipped clothes/armour? full damage. lfdam = howmuch; } } else { @@ -14990,7 +14989,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif return howmuch; } } - } + } } else if (damtype == DT_COLD) { // cold might shatter glass @@ -15053,7 +15052,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif // object dies, but don't announce it addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL); addflag(o->flags, F_NOOBDIETEXT, B_TRUE, NA, NA, NULL); - + return howmuch; } @@ -15119,14 +15118,14 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif if (f->val[2] == B_IFACTIVATED) { if (isactivated(o)) { if (!hasflag(o->flags, F_SPELLCLOUDONDEATH)) { - spellcloud(where, f->val[1], DT_ORTH, cloudglyph.ch, cloudglyph.colour, f->val[0], power, B_TRUE, + spellcloud(where, f->val[1], DT_ORTH, cloudglyph.ch, cloudglyph.colour, f->val[0], power, B_TRUE, seebuf, noseebuf, B_FALSE, o, B_INCLUDECENTRE); } addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL); } } else { if (!hasflag(o->flags, F_SPELLCLOUDONDEATH)) { - spellcloud(where, f->val[1], DT_ORTH, cloudglyph.ch, cloudglyph.colour, f->val[0], power, B_TRUE, + spellcloud(where, f->val[1], DT_ORTH, cloudglyph.ch, cloudglyph.colour, f->val[0], power, B_TRUE, seebuf, noseebuf, B_FALSE, o, B_INCLUDECENTRE); } addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL); @@ -15193,7 +15192,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif damtaken = MAXOF(hpflag->val[0], howmuch); // object loses hp hpflag->val[0] -= howmuch; - } + } if (hpflag) { assert(hpflag->val[0] <= hpflag->val[1]); @@ -15213,7 +15212,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif if (ff) { killflagsofid(meat->flags, F_OBHP); addflag(meat->flags, F_OBHP, ff->val[1], ff->val[1], NA, NULL); - + } if (hasflag(o->flags, F_DECAY)) { copyflag(meat->flags, o->flags, F_OBHP); @@ -15223,9 +15222,9 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif } } copyflag(meat->flags, o->flags, F_TAINTED); - } + } } - + // object dies! addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL); @@ -15275,7 +15274,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce, lif } // if you see a secret object get damaged, it's not secret anymore. killflagsofid(o->flags, F_SECRET); - } + } } @@ -15391,7 +15390,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp if ((o->blessed == B_CURSED) && (!firearm)) { // is object in thrower's pack? we need to check this // because of things like telekenises which let us throw - // things we don't have. + // things we don't have. if (thrower && (o->pile->owner == thrower)) { // object equipped? if (hasflag(o->flags, F_EQUIPPED)) { @@ -15423,7 +15422,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp if (haslos(player, where)) { seendst = B_TRUE; } - if (haslos(player, srcloc)) { + if (haslos(player, srcloc)) { seensrc = B_TRUE; } if (seensrc || seendst) { @@ -15492,7 +15491,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp if (target && haslos(player, where) && !hasflag(o->flags, F_POWDER)) { strcat(throwstring, willcatch ? " to " : " at "); strcat(throwstring, targetname); - } + } strcat(throwstring, "."); msg("%s", throwstring); } else if (seen) { @@ -15519,7 +15518,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp strcat(throwstring, " toward "); strcat(throwstring, targetname); } - } + } strcat(throwstring, "."); msg("%s", throwstring); } @@ -15544,7 +15543,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp // use a charge. if (usecharge(o) <= 0) { // no charges left? change into a normal javelin. - o->type = findot(OT_JAVELIN); + o->type = findot(OT_JAVELIN); // move it to target cell newob = real_moveob(o, where->obpile, amt, B_FALSE); if (newobptr) *newobptr = newob; @@ -15578,7 +15577,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp int radius; // make smoke if (haslos(player, srcloc)) { - msg("%s dispers%s into a thick cloud of smoke!", obname, + msg("%s dispers%s into a thick cloud of smoke!", obname, (amt == 1) ? "es" : "e", (amt == 1) ? "es" : "e" ); @@ -15591,9 +15590,9 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp char diebuf[BUFLEN]; // explosion! snprintf(diebuf, BUFLEN, "%dd6",o->amt); - + if (haslos(player, srcloc)) { - msg("%s dispers%s and explod%s!", obname, + msg("%s dispers%s and explod%s!", obname, (amt == 1) ? "es" : "e", (amt == 1) ? "es" : "e" ); @@ -15611,7 +15610,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp } radius = o->amt * 2; if (radius > 10) radius = 10; - + spellcloud(srcloc, radius, DT_ORTH, UNI_SHADELIGHT, C_RANDOM, OT_S_INVISIBILITY, radius, B_TRUE, buf, "A cloud of twinkling lights appear!", B_FALSE, NULL, B_INCLUDECENTRE); } else if (o->type->id == OT_ASHSLEEP) { int radius; @@ -15624,14 +15623,14 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp } radius = o->amt * 2; if (radius > 10) radius = 10; - + spellcloud(srcloc, radius, DT_ORTH, UNI_SHADELIGHT, C_MAGENTA, OT_S_SLEEP, radius, B_TRUE, buf, "A wispy mist appears!", B_FALSE, NULL, B_INCLUDECENTRE); } else if (o->type->id == OT_SALT) { int dist; dist = getcelldist(srcloc, where); if (target && (dist <= 1)) { // salt won't work if they're immersed in water - if (lfhasflag(target, F_VULNTOSALT) && + if (lfhasflag(target, F_VULNTOSALT) && (getcellwaterdepth(target->cell, target) < DP_WAIST)) { // instakill if (cansee(player, target)) { @@ -15641,8 +15640,8 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp setlastdam(target, "osmosis"); setkillverb(target, "Dehydrated"); } else { - if (hasbp(target, BP_EYES) && - !isblind(target) && + if (hasbp(target, BP_EYES) && + !isblind(target) && !getequippedob(target->pack, BP_EYES)) { if (cansee(player, target)) { msg("%s stings %s%s eyes!", obname, targetname, getpossessive(targetname)); @@ -15722,7 +15721,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp makeknown(tempo->type->id); } // change dest cell. - calcbresnham(where->map, thrower->cell->x, thrower->cell->y, + calcbresnham(where->map, thrower->cell->x, thrower->cell->y, where->x, where->y, retcell, &nretcells ); if (nretcells > 1) { // 1 cell in front of thrower. @@ -15791,8 +15790,8 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp case PR_NOVICE: acc -= 30; break; case PR_BEGINNER: acc -= 20; break; case PR_ADEPT: acc -= 10; break; - case PR_SKILLED: - case PR_EXPERT: + case PR_SKILLED: + case PR_EXPERT: case PR_MASTER: break; } @@ -15807,7 +15806,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp } else { strcpy(fatext,""); } - dblog("%s is %s %s%s - acc = %d, speed = %d\n", realthrowername, + dblog("%s is %s %s%s - acc = %d, speed = %d\n", realthrowername, firearm ? "firing" : "throwing", obname, fatext, acc, speed); } @@ -15879,7 +15878,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp } else if (dist == 2) { difficulty += 10; } - if (check_for_block(thrower, target, getthrowdam(o) + speed, + if (check_for_block(thrower, target, getthrowdam(o) + speed, DT_PROJECTILE, difficulty, attackname, B_RANGED)) { announcedmiss = B_TRUE; youhit = B_FALSE; @@ -15921,8 +15920,8 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp if (!lfhasflag(target, F_NOPACK) && hasbp(target, BP_HANDS) && lfhasflag(target, F_HUMANOID) && canpickup(target, o, o->amt) && - !willburden(target, o, o->amt) && - !isimmobile(target) && + !willburden(target, o, o->amt) && + !isimmobile(target) && skillcheck(target, SC_DEX, 100 + (speed*10), catchmod)) { if (db) dblog("target passed catch check."); willcatch = B_TRUE; @@ -15978,7 +15977,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp if (youhit) { if (willcatch) { if (seen) { - msg("^%c%s catch%s %s.", isplayer(target) ? 'g' : 'n', + msg("^%c%s catch%s %s.", isplayer(target) ? 'g' : 'n', targetname, isplayer(target) ? "" : "es", obname); } moveob(o, target->pack, amt); @@ -15995,7 +15994,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp op = addobpile(NOOWNER, NOLOC, NULL); // split off new object into a fake obpile - // so we don't modify the original stack with + // so we don't modify the original stack with // things like poison rubbing off. o = real_moveob(o, op, amt, B_FALSE); o->birthtime = -1; @@ -16075,11 +16074,11 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp // throw an object at something. is this okay? if (thrower && (thrower->cell == srcloc)) { whogetsxp = thrower; - } - losehp_real(target, dam, DT_PROJECTILE, whogetsxp, damstring, B_DAMADJUST, o, + } + losehp_real(target, dam, DT_PROJECTILE, whogetsxp, damstring, B_DAMADJUST, o, B_RETALIATE, NULL, B_DAMEFFECTS, BP_NONE, B_NOCRIT); } - + if (reduceamt && (speed >= 3)) { applyarmourdamage(target, o, reduceamt, DT_PROJECTILE, NULL); } @@ -16117,7 +16116,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp announcedmiss = B_TRUE; } } - } // end if target + } // end if target // heavy ob? if (youhit && target) { @@ -16154,7 +16153,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp newob = real_moveob(o, where->obpile, amt, B_FALSE); } - + // fake its birth time so that it can be damaged newob->birthtime = -1; @@ -16191,7 +16190,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp } else { // ie things like bruising real_takedamage(newob, 0, DT_BASH, B_FALSE, thrower); - } + } } if (thrower && hasactivespell(thrower, OT_S_WHATGOESUP)) { @@ -16208,12 +16207,12 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp moveob(newob, thrower->pack, newob->amt); } } - } + } } if (newob && !isdeadob(newob)) { killflagsofid(newob->flags, F_THROWNBY); - } + } /* if (firearm && outofammo && isplayer(thrower)) { @@ -16324,7 +16323,7 @@ void timeeffectsob(object_t *o) { if (newob) { killflagsofid(newob->flags, F_FILLPOT); killflagsofid(newob->flags, F_LINKRACE); - // restore remembered flags + // restore remembered flags copyflags(newob->flags, fp, NA); } } @@ -16372,11 +16371,11 @@ void timeeffectsob(object_t *o) { int nearundead = B_FALSE; // are we glowing? - getflags(o->flags, retflag, &nretflags, F_PRODUCESLIGHT, F_NONE); + getflags(o->flags, retflag, &nretflags, F_PRODUCESLIGHT, F_NONE); for (i = 0; i < nretflags; i++) { f = retflag[i]; if ((f->id == F_PRODUCESLIGHT) && (f->lifetime == FROMBLESSING)) { - glowflag = f; + glowflag = f; break; } } @@ -16404,7 +16403,7 @@ void timeeffectsob(object_t *o) { glowflag = addtempflag(o->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL, FROMBLESSING); if (haslos(player, ourcell)) { if (!o->blessknown) o->blessknown = B_TRUE; - setlosdirty(player); + setlosdirty(player); } //calclight(ourcell->map); //precalclos(player); @@ -16416,12 +16415,12 @@ void timeeffectsob(object_t *o) { } } } - } else { // not equipped + } else { // not equipped if (glowflag) { // if not equipped and glowing... // stop glowing killflag(glowflag); glowflag = NULL; - } + } } } @@ -16433,11 +16432,11 @@ void timeeffectsob(object_t *o) { int canseeloc = B_FALSE; condset_t cs; initcondv(&cs, CC_IMPASSABLE, B_FALSE, NA, CC_NONE); - + if (haslos(player, location) && canseeob(player, sg)) { getobname(sg, sgname, sg->amt); canseeloc = B_TRUE; - msg("The %s pulses %s!", noprefix(sgname), + msg("The %s pulses %s!", noprefix(sgname), (o->blessed == B_CURSED) ? "white" : "black"); } @@ -16474,7 +16473,7 @@ void timeeffectsob(object_t *o) { } } if (isplayer(o->pile->owner)) { - // sacred ground bless/curse detect + // sacred ground bless/curse detect sg = hasobwithflagval(location->obpile, F_REPELBLESSED, NA, o->blessed, NA, NULL); if (sg && !o->blessknown) { // announce @@ -16486,7 +16485,7 @@ void timeeffectsob(object_t *o) { if (hasflag(o->flags, F_TANGLEMISSILE)) { if (!location || !location->lf) { - // thrown entangling weapons lose their "stickiness" + // thrown entangling weapons lose their "stickiness" // once the target escapes killflagsofid(o->flags, F_RESTRICTMOVEMENT); } @@ -16499,14 +16498,14 @@ void timeeffectsob(object_t *o) { if (f) f->val[0]--; if (!f || (f->val[0] <= 0)) { if (isplayer(owner)) { - msg("Your %s dim%s and crumbles.",noprefix(obname), + msg("Your %s dim%s and crumbles.",noprefix(obname), (o->amt == 1) ? "s" : ""); } removeob(o, ALL); return; } else { if (isplayer(owner)) { - msg("Your %s dim%s slightly.",noprefix(obname), + msg("Your %s dim%s slightly.",noprefix(obname), (o->amt == 1) ? "s" : ""); } } @@ -16528,17 +16527,17 @@ void timeeffectsob(object_t *o) { if (location) { // object makes noise? - getflags(o->flags, retflag, &nretflags, F_MAKESNOISE, F_NONE); + getflags(o->flags, retflag, &nretflags, F_MAKESNOISE, F_NONE); if (nretflags) { int chance; f = retflag[rnd(0,nretflags-1)]; - + chance = f->val[0]; // closed shops don't make cash register noises! if (hasflag(o->flags, F_SHOP) && shopisclosed(o)) { chance = 0; } - + if (pctchance(chance)) { // these are generally just to notify the player that something // is nearby, so don't make noises the the player is already there. @@ -16652,15 +16651,15 @@ void timeeffectsob(object_t *o) { if (location->type->absorbent && !hasflag(o->flags, F_NOABSORB)) { if (getoption(OPT_ABSORBNOTIFY)) { if (haslos(player, location)) { - msg("%s %s absorbed into the %s.", obname, + msg("%s %s absorbed into the %s.", obname, OB1(o,"is","are"), location->type->name); - } + } } removeob(o, ALL); return; } } - getflags(o->flags, retflag, &nretflags, F_GENERATES, F_NONE); + getflags(o->flags, retflag, &nretflags, F_GENERATES, F_NONE); for (i = 0; i < nretflags; i++) { f = retflag[i]; if (pctchance(f->val[0])) { @@ -16673,11 +16672,11 @@ void timeeffectsob(object_t *o) { where = getrandomadjcell(location, &cs, B_NOEXPAND); } - if (where) { + if (where) { if (f->val[1] == 0) { addob(where->obpile, f->text); } else { - addobsinradius(where, f->val[1], DT_COMPASS, f->text, B_TRUE, B_INCLUDECENTRE, + addobsinradius(where, f->val[1], DT_COMPASS, f->text, B_TRUE, B_INCLUDECENTRE, NULL, NULL, NULL, NULL); } } @@ -16687,9 +16686,9 @@ void timeeffectsob(object_t *o) { // check each flag for this object... - getflags(o->flags, retflag, &nretflags, F_ACTIVATED, F_EDIBLE, F_EXPLODEONDEATH, F_MATCONVERT, - F_HOT, F_KNOCKAWAY, F_LFINSIDE, F_OBHPDRAIN, F_ONFIRE, F_POWDER, F_RECHARGE, F_REVIVETIMER, - F_WALKDAM, F_WET, F_NONE); + getflags(o->flags, retflag, &nretflags, F_ACTIVATED, F_EDIBLE, F_EXPLODEONDEATH, F_MATCONVERT, + F_HOT, F_KNOCKAWAY, F_LFINSIDE, F_OBHPDRAIN, F_ONFIRE, F_POWDER, F_RECHARGE, F_REVIVETIMER, + F_WALKDAM, F_WET, F_NONE); for (i = 0; i < nretflags; i++) { object_t *oo,*nextoo; f = retflag[i]; @@ -16732,7 +16731,7 @@ void timeeffectsob(object_t *o) { if (cansee(player, owner)) { char lfname[BUFLEN]; getlfname(owner, lfname); - msg("%s crash%s to the ground!",lfname, + msg("%s crash%s to the ground!",lfname, isplayer(owner) ? "" : "es"); } losehp(owner, rnd(1,4), DT_BASH, NULL, "falling"); @@ -16805,7 +16804,7 @@ void timeeffectsob(object_t *o) { } } } - } + } if (f->id == F_EXPLODEONDEATH) { if (hasflag(o->flags, F_OBHPDRAIN)) { @@ -16857,7 +16856,7 @@ void timeeffectsob(object_t *o) { } losehp(lf, roll(f->text), DT_PROJECTILE, creator, damstring); // lfs then get knocked away (and might take further damage from hitting something) - knockback(lf, getrandomdir(DT_COMPASS), f->val[0], creator, f->val[1], + knockback(lf, getrandomdir(DT_COMPASS), f->val[0], creator, f->val[1], B_DOANNOUNCE, B_DODAM); } // objects get knocked away @@ -16866,9 +16865,9 @@ void timeeffectsob(object_t *o) { // note: f_nopickup obs will still get moved! - if (hasflag(oo->flags, F_COSMETIC) || hasflag(oo->flags, F_CLIMBABLE) || - (hasflag(oo->flags, F_TRAIL)) || - (getmaterialstate(o->material->id) != MS_SOLID) || + if (hasflag(oo->flags, F_COSMETIC) || hasflag(oo->flags, F_CLIMBABLE) || + (hasflag(oo->flags, F_TRAIL)) || + (getmaterialstate(o->material->id) != MS_SOLID) || (hasflag(oo->flags, F_KNOCKAWAY)) || // don't affect other wind knockaway objects (oo->type->obclass->id == OC_BUILDING)) { } else { @@ -16877,7 +16876,7 @@ void timeeffectsob(object_t *o) { getradiuscells(oo->pile->where, f->val[0], DT_COMPASS, B_FALSE, LOF_WALLSTOP, B_FALSE, retcell, &nretcells, 0); if (nretcells) { c = retcell[rnd(0,nretcells-1)]; - fireat(NULL, oo, oo->amt, c, f->val[2], NULL); + fireat(NULL, oo, oo->amt, c, f->val[2], NULL); } } } @@ -16899,7 +16898,7 @@ void timeeffectsob(object_t *o) { if (hasflag(o->flags, F_ONFIRE)) { doit = B_FALSE; //} else if (hasobofmaterial(o->pile, MT_ICE)) { - } else if (location) { + } else if (location) { enum TEMPERATURE ct; ct = getcelltemp(location, NULL); if (ct <= T_COLD) { @@ -16916,7 +16915,7 @@ void timeeffectsob(object_t *o) { if ((damtype == DT_MELT) && location) { enum TEMPERATURE ct; ct = getcelltemp(location, NULL); - + if (ct <= T_CHILLY) { doit = B_FALSE; } else if (ct >= T_WARM) { @@ -16926,7 +16925,7 @@ void timeeffectsob(object_t *o) { damamt += ((ct - T_NORMAL)*3); } } - // special case - fire doesn't naturally die down + // special case - fire doesn't naturally die down // if there are larger fires in adjacent cells. if ((o->type->material->id == MT_FIRE) && (o->pile->where)) { int dir,myhp; @@ -16945,7 +16944,7 @@ void timeeffectsob(object_t *o) { } if (doit) { takedamage(o, f->val[0], damtype, NULL); - if (hasflag(o->flags, F_DEAD)) return; + if (hasflag(o->flags, F_DEAD)) return; } } @@ -16990,7 +16989,7 @@ void timeeffectsob(object_t *o) { } else { lfloc = obloc; } - } + } if (lfloc) { char *revivetext; @@ -17017,13 +17016,13 @@ void timeeffectsob(object_t *o) { // no more xp. killflagsofid(lf->flags, F_XPVAL); addflag(lf->flags, F_XPVAL, 0, NA, NA, NULL); - + // corpse vanishes removeob(o, o->amt); // announce if (haslos(player, lfloc) || haslos(player, obloc)) { msg("^W%s %s!^n", obname, revivetext); - interrupt(player); + interrupt(player); } } free(revivetext); @@ -17059,7 +17058,7 @@ void timeeffectsob(object_t *o) { // everything here takes damage //damageallobs(o, o->pile, f->val[0] * timespent, f->val[1]); damageallobs(o, o->pile, roll(f->text), f->val[0], getobcreatedby(o)); - //if (hasflag(o->flags, F_DEAD)) return; + //if (hasflag(o->flags, F_DEAD)) return; } // is object on fire or hot? @@ -17071,7 +17070,7 @@ void timeeffectsob(object_t *o) { if ((oo != o) && (oo->material->id == MT_WATER)) { willputout = B_TRUE; break; - } + } } if (willputout) { if (f->id == F_ONFIRE) { @@ -17090,7 +17089,7 @@ void timeeffectsob(object_t *o) { // with weapons is that only the blade is on fire. } else { takedamage(o, rnd(2,4), DT_FIRE, NULL); // TODO: don't hardcode - if (hasflag(o->flags, F_DEAD)) return; + if (hasflag(o->flags, F_DEAD)) return; } } } @@ -17133,14 +17132,14 @@ void timeeffectsob(object_t *o) { if (!f2) { f2 = hasflagval(o->flags, F_MATCONVERTTEXT, mat, NA, NA, NULL); } - + if (f2) { char *locbuf; getobname(o, buf, o->amt); locbuf = strdup(buf); capitalise(locbuf); if (o->pile->owner == player) { - // Remove prefix + // Remove prefix strrep(&locbuf, "An ", "", NULL); strrep(&locbuf, "A ", "", NULL); } @@ -17194,7 +17193,7 @@ void timeeffectsob(object_t *o) { } } } - + // now pick a direction to move. for (dir = DC_N; dir <= DC_NW; dir++) { c = getcellindir(o->pile->where, dir); @@ -17236,7 +17235,7 @@ void timeeffectsob(object_t *o) { if (!dead) { moveob(adjob[i], c->obpile, adjob[i]->amt); } - } + } } } } @@ -17257,7 +17256,7 @@ int touch_battle_spoils(object_t *o) { return ndone; } -// both trapob and oid are passed, because trapob might be NULL if +// both trapob and oid are passed, because trapob might be NULL if // coming from a door/chest trap. void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trappedob) { lifeform_t *lf = NULL; @@ -17304,7 +17303,7 @@ void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trapped avoided = B_TRUE; } - + if (oid == OT_TRAPWIND) { // can't be dodged dospelleffects(NULL, OT_S_GUSTOFWIND, 10, NULL, NULL, c, B_UNCURSED, NULL, B_TRUE, NULL); @@ -17410,13 +17409,13 @@ void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trapped cell_t *escapeto = NULL; addob(c->obpile, "hole in the ground"); if (trapob) removeob(trapob, trapob->amt); // trap dies afterwards - + if (lf) { if (avoided) { escapeto = getrandomadjcell(lf->cell, &ccwalkable, B_NOEXPAND); if (!escapeto) avoided = B_FALSE; } - + if (avoided) { if (isplayer(lf)) { msg("You leap away from the pit!"); @@ -17444,7 +17443,7 @@ void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trapped cc = c; cc = getcellindir(cc, dir); while (!cc->type->solid) { - thisdist++; + thisdist++; prevc = cc; cc = getcellindir(cc, dir); } @@ -17481,7 +17480,7 @@ void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trapped } else if (oid == OT_TRAPEBLAST) { if (isplayer(lf) && !haslos(player, c)) { msg("A blast of energy comes out of nowhere!"); - // if we DO have los, then spelleffects() will take care of the + // if we DO have los, then spelleffects() will take care of the // announcement. } // can't be dodged @@ -17525,7 +17524,7 @@ void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trapped summonmonster(NULL, cc, R_SPECIFIED, "random", PERMENANT, B_FALSE); } if (trapob) removeob(trapob, trapob->amt); // trap dies afterwards - + } else if (oid == OT_TRAPTRIP) { if (lf) { if (avoided) { @@ -17537,7 +17536,7 @@ void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trapped } else { fall(lf, NULL, B_TRUE); } - } + } } } @@ -17545,7 +17544,7 @@ void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trapped // anything important like stairs. // // returns FALSE if we cleared all objects, or didn't need to. -// returns TRUE if there were objects which we couldn't clear +// returns TRUE if there were objects which we couldn't clear int trytokillobs(obpile_t *op) { object_t *o, *nexto; int failed = B_FALSE; @@ -17565,7 +17564,7 @@ void turnoff(lifeform_t *lf, object_t *o) { char obname[BUFLEN]; flag_t *f; - f = hasflag(o->flags, F_ACTIVATED); + f = hasflag(o->flags, F_ACTIVATED); if (!f) { // already off return; @@ -17625,7 +17624,7 @@ void turnon(lifeform_t *lf, object_t *o) { held = B_TRUE; } - f = hasflag(o->flags, F_ACTIVATED); + f = hasflag(o->flags, F_ACTIVATED); if (f) { // already on if (lf && isplayer(lf)) { @@ -17651,7 +17650,7 @@ void turnon(lifeform_t *lf, object_t *o) { getobname(o, obname, 1); if (lf) { if (isplayer(lf)) { - msg("You activate%s %s.", held ? " your" : "", + msg("You activate%s %s.", held ? " your" : "", held ? noprefix(obname) : obname); } else if (cansee(player, lf)) { char lfname[BUFLEN]; @@ -17669,11 +17668,11 @@ void turnon(lifeform_t *lf, object_t *o) { if (newob) { char newobname[BUFLEN]; // announce new ob - addflag(newob->flags, F_ACTIVATED, B_TRUE, NA, NA, NULL); + addflag(newob->flags, F_ACTIVATED, B_TRUE, NA, NA, NULL); getobname(newob, newobname, 1); if (lf && isplayer(lf)) { // announce. - if (held) { + if (held) { msgnocap("%c - %s [activated].",newob->letter, newobname); more(); // ask where to throw it @@ -17690,7 +17689,7 @@ void turnon(lifeform_t *lf, object_t *o) { } } } else { - addflag(o->flags, F_ACTIVATED, B_TRUE, NA, NA, NULL); + addflag(o->flags, F_ACTIVATED, B_TRUE, NA, NA, NULL); } if (held) { @@ -17709,10 +17708,10 @@ int uncurseob(object_t *o, int *seen) { return B_TRUE; } lf = o->pile->owner; - + // announce if (lf) { - if (cansee(player, lf)) { + if (cansee(player, lf)) { char lfname[BUFLEN]; char obname[BUFLEN]; getlfname(lf, lfname); @@ -17723,7 +17722,7 @@ int uncurseob(object_t *o, int *seen) { } else { // not held cell_t *loc = NULL; loc = getoblocation(o); - if (haslos(player, loc)) { + if (haslos(player, loc)) { char obname[BUFLEN]; getobname(o, obname,o->amt); msg("A black aura breaks away from %s.",obname); @@ -17760,7 +17759,7 @@ int unjam(lifeform_t *lf, object_t *o) { if (amt > 0) { f->val[0] -= amt; } - + if (isplayer(lf)) { if (amt > 0) { if (f->val[0] > 0) { @@ -17770,7 +17769,7 @@ int unjam(lifeform_t *lf, object_t *o) { if (!isdoor(o, NULL)) { msg("You force %s open!",obname); } - + } else { msg("You cannot budge the jammed %s.", noprefix(obname)); } @@ -17799,7 +17798,7 @@ int unjam(lifeform_t *lf, object_t *o) { if (f->val[0] <= 0) { killflag(f); f = NULL; - openit = B_TRUE; + openit = B_TRUE; } else { openit = B_FALSE; // don't open the door } @@ -17821,7 +17820,7 @@ int usecharge(object_t *o) { f = NULL; } } - + // if no battery, use charges from the object itself. if (!f) { f = hasflag(o->flags, F_CHARGES); @@ -17878,7 +17877,7 @@ int validatehiddennames(void) { if (count > 1) { printf("Error - duplicate hiddenname found for class %s, text '%s'. (%d found)\n", oc->name, hn->text, count); goterror = B_TRUE; - } + } } } } @@ -17957,16 +17956,16 @@ int validateobs(void) { if (!hasflag(ot->flags, F_RANGE)) { printf("ERROR in object '%s' - firearms need to have F_RANGE.\n", ot->name); goterror = B_TRUE; - } + } if (!hasflag(ot->flags, F_AMMOCAPACITY)) { printf("ERROR in object '%s' - firearms need to have F_AMMOCAPACITY.\n", ot->name); goterror = B_TRUE; - } + } if (!hasflag(ot->flags, F_RELOADTURNS)) { printf("ERROR in object '%s' - firearms need to have F_RELOADTURNS.\n", ot->name); goterror = B_TRUE; - } - + } + } f = hasflag(ot->flags, F_HOMEOB); if (f && (f->val[0] == NA)) { @@ -17980,7 +17979,7 @@ int validateobs(void) { goterror = B_TRUE; } } - + f = hasflag(ot->flags, F_TECHLEVEL); if (f && (f->val[0] != PR_INEPT)) { if (!hasflag(ot->flags, F_HASHIDDENNAME)) { @@ -18140,7 +18139,7 @@ enum SKILL getclassloreskill(enum OBCLASS ocid) { switch (ocid) { case OC_POTION: return SK_LORE_CHEMISTRY; case OC_SCROLL: return SK_LORE_LANGUAGE; - case OC_BOOK: return SK_LORE_LANGUAGE; + case OC_BOOK: return SK_LORE_LANGUAGE; case OC_WAND: return SK_LORE_ARCANA; case OC_RING: return SK_LORE_RELICS; case OC_AMULET: return SK_LORE_RELICS; @@ -18212,7 +18211,7 @@ int chargesknown(object_t *o) { case PR_ADEPT: cutoff = 3; break; case PR_SKILLED: cutoff = 6; break; case PR_EXPERT: break; // f->known will be set after use. - case PR_MASTER: cutoff = 9999; break; + case PR_MASTER: cutoff = 9999; break; default: break; } if (f->val[0] <= cutoff) { @@ -18301,14 +18300,14 @@ int getingredients(obpile_t *op, recipe_t *rec, object_t **retob, int *retcount, if (!hasflagval(o->flags, F_CORPSEOF, R_CHICKEN, NA, NA, NULL)) { obmatches = B_FALSE; } - } + } } if (obmatches && (o->amt >= rec->count[i])) { poss[nposs++] = o; } } - + if ((nposs > 1) && promptformulti) { int n,ch; // ask which one to use @@ -18384,13 +18383,13 @@ enum COLOUR getmaterialcolour(enum MATERIAL mat) { col = C_YELLOW; break; case MT_WATER: - col = C_BLUE; + col = C_BLUE; break; case MT_SLIME: - col = C_DARKGREEN; + col = C_DARKGREEN; break; case MT_ACID: - col = C_GREEN; + col = C_GREEN; break; default: col = C_GREY; @@ -18486,7 +18485,7 @@ int getmissileaccuracy(lifeform_t *thrower, cell_t *where, object_t *missile, ob // modify for prone throwers if (isprone(thrower)) { acc -= 50; - } + } // modify for prone defenders if (where->lf && isprone(where->lf)) {