MAke object weight functions more meaningful - getobmass() and getobweight()
This commit is contained in:
parent
d676a33072
commit
a4735d597c
42
Makefile
42
Makefile
|
@ -1,62 +1,64 @@
|
|||
#all: Makefile defs.h nexus.c nexus.h ai.c ai.h attack.c attack.h data.c data.h flag.c flag.h god.c god.h io.c io.h lf.c lf.h map.c map.h move.c move.h objects.c objects.h text.c text.h save.c save.h shops.c shops.h spell.c spell.h vault.c vault.h
|
||||
# gcc -Werror -Wall -g -pg -o nexus nexus.c ai.c attack.c data.c flag.c god.c io.c lf.c map.c move.c objects.c text.c save.c spell.c shops.c vault.c -lncurses -lsqlite3
|
||||
# gcc $(CFLAGS) -o nexus nexus.c ai.c attack.c data.c flag.c god.c io.c lf.c map.c move.c objects.c text.c save.c spell.c shops.c vault.c -lncurses -lsqlite3
|
||||
|
||||
CFLAGS=-fdiagnostics-color=always -g -pg -Wall -Werror
|
||||
|
||||
nexus: ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o ai.h attack.h data.h defs.h flag.h god.h io.h lf.h map.h move.h nexus.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -g -pg -Wall -o nexus ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o -lncurses -lsqlite3
|
||||
gcc $(CFLAGS) -o nexus ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o -lncurses -lsqlite3
|
||||
|
||||
ai.o: ai.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h ai.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o ai.o ai.c
|
||||
gcc $(CFLAGS) -c -o ai.o ai.c
|
||||
|
||||
attack.o: attack.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h attack.h astar.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o attack.o attack.c
|
||||
gcc $(CFLAGS) -c -o attack.o attack.c
|
||||
|
||||
astar.o: astar.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h attack.h astar.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o astar.o astar.c
|
||||
gcc $(CFLAGS) -c -o astar.o astar.c
|
||||
|
||||
data.o: data.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h data.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o data.o data.c
|
||||
gcc $(CFLAGS) -c -o data.o data.c
|
||||
|
||||
: ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o
|
||||
gcc $(CFLAGS) -c -o
|
||||
|
||||
flag.o: flag.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h flag.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o flag.o flag.c
|
||||
gcc $(CFLAGS) -c -o flag.o flag.c
|
||||
|
||||
god.o: god.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h god.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o god.o god.c
|
||||
gcc $(CFLAGS) -c -o god.o god.c
|
||||
|
||||
io.o: io.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h io.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o io.o io.c
|
||||
gcc $(CFLAGS) -c -o io.o io.c
|
||||
|
||||
lf.o: lf.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h lf.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o lf.o lf.c
|
||||
gcc $(CFLAGS) -c -o lf.o lf.c
|
||||
|
||||
map.o: map.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h map.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o map.o map.c
|
||||
gcc $(CFLAGS) -c -o map.o map.c
|
||||
|
||||
move.o: move.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h move.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o move.o move.c
|
||||
gcc $(CFLAGS) -c -o move.o move.c
|
||||
|
||||
nexus.o: nexus.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h nexus.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o nexus.o nexus.c
|
||||
gcc $(CFLAGS) -c -o nexus.o nexus.c
|
||||
|
||||
objects.o: objects.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h objects.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o objects.o objects.c
|
||||
gcc $(CFLAGS) -c -o objects.o objects.c
|
||||
|
||||
save.o: save.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h save.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o save.o save.c
|
||||
gcc $(CFLAGS) -c -o save.o save.c
|
||||
|
||||
shops.o: shops.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h shops.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o shops.o shops.c
|
||||
gcc $(CFLAGS) -c -o shops.o shops.c
|
||||
|
||||
spell.o: spell.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h spell.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o spell.o spell.c
|
||||
gcc $(CFLAGS) -c -o spell.o spell.c
|
||||
|
||||
text.o: text.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h text.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o text.o text.c
|
||||
gcc $(CFLAGS) -c -o text.o text.c
|
||||
|
||||
vault.o: vault.c ai.h attack.h astar.h data.h defs.h flag.h god.h io.h lf.h map.h move.h vault.h objects.h save.h shops.h spell.h text.h vault.h
|
||||
gcc -Werror -Wall -c -g -pg -o vault.o vault.c
|
||||
gcc $(CFLAGS) -c -o vault.o vault.c
|
||||
|
||||
|
||||
######################
|
||||
|
|
8
ai.c
8
ai.c
|
@ -995,7 +995,7 @@ int aigetspelltarget(lifeform_t *lf, objecttype_t *spelltype, lifeform_t *victim
|
|||
object_t *o;
|
||||
for (o = lf->los[i]->obpile->first ; o ; o = o->next) {
|
||||
if (!hasflag(o->flags, F_NOPICKUP) &&
|
||||
getobweight(o) <= maxweight) {
|
||||
getobmass(o) <= maxweight) {
|
||||
poss[nposs] = o;
|
||||
nposs++;
|
||||
if (nposs >= MAXPILEOBS) break;
|
||||
|
@ -1734,7 +1734,7 @@ int ai_inventory_mgt(lifeform_t *lf, int *canattack) {
|
|||
for (o = lf->pack->first ; o ; o = o->next) {
|
||||
if (!isequipped(o)) {
|
||||
float thisweight;
|
||||
thisweight = getobweight(o);
|
||||
thisweight = getobmass(o);
|
||||
if (thisweight > hevweight) {
|
||||
hevweight = thisweight;
|
||||
heaviest = o;
|
||||
|
@ -2104,7 +2104,7 @@ int aimovetolf(lifeform_t *lf, lifeform_t *target, int wantattack) {
|
|||
object_t *o;
|
||||
for (o = lf->los[i]->obpile->first ; o ; o = o->next) {
|
||||
if (!hasflag(o->flags, F_NOPICKUP) &&
|
||||
getobweight(o) <= maxweight) {
|
||||
getobmass(o) <= maxweight) {
|
||||
poss[nposs] = o;
|
||||
nposs++;
|
||||
if (nposs >= MAXPILEOBS) break;
|
||||
|
@ -3069,7 +3069,7 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
|
|||
object_t *o;
|
||||
for (o = lf->los[i]->obpile->first ; o ; o = o->next) {
|
||||
if (!hasflag(o->flags, F_NOPICKUP) &&
|
||||
getobweight(o) <= maxweight) {
|
||||
getobmass(o) <= maxweight) {
|
||||
ok = B_TRUE;
|
||||
break;
|
||||
}
|
||||
|
|
8
io.c
8
io.c
|
@ -3881,7 +3881,7 @@ int askobjectmulti(obpile_t *op, char *prompt, condset_t *cs, int includenothing
|
|||
nselected++;
|
||||
if (selcount[n] == ALL) thiscount = mylist[n]->amt;
|
||||
else thiscount = selcount[n];
|
||||
selweight += (getobunitweight(mylist[n]) * thiscount);
|
||||
selweight += (getobweight(mylist[n]) * thiscount);
|
||||
}
|
||||
}
|
||||
// draw prompt
|
||||
|
@ -6304,7 +6304,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
|
|||
o->material->name);
|
||||
}
|
||||
|
||||
obw = getobweight(o);
|
||||
obw = getobmass(o);
|
||||
if (o->amt == 1) {
|
||||
char wbuf[BUFLEN];
|
||||
getweighttext(obw, wbuf, B_FALSE);
|
||||
|
@ -6314,7 +6314,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
|
|||
char wbuf[BUFLEN];
|
||||
char wbuf2[BUFLEN];
|
||||
getweighttext(obw, wbuf, B_FALSE);
|
||||
getweighttext(getobunitweight(o), wbuf2, B_FALSE);
|
||||
getweighttext(getobweight(o), wbuf2, B_FALSE);
|
||||
snprintf(buf2, BUFLEN, "and weigh %s (%s each)",wbuf, wbuf2);
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
|
@ -6323,7 +6323,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
|
|||
if (compareob && (o->amt == 1)) {
|
||||
int diff;
|
||||
float compareobw;
|
||||
compareobw = getobweight(compareob);
|
||||
compareobw = getobmass(compareob);
|
||||
diff = obw - compareobw;
|
||||
if (diff == 0) {
|
||||
strcpy(buf2, " (=)");
|
||||
|
|
16
lf.c
16
lf.c
|
@ -1257,7 +1257,7 @@ int canpickup(lifeform_t *lf, object_t *o, int amt) {
|
|||
|
||||
// too heavy to lift?
|
||||
//max = getlfweight(lf, B_NOOBS) * 2; // twice your body weight
|
||||
if (getobunitweight(o) + getobpileweight(lf->pack) > (getmaxcarryweight(lf)*2)) {
|
||||
if (getobweight(o) + getobpileweight(lf->pack) > (getmaxcarryweight(lf)*2)) {
|
||||
reason = E_TOOHEAVY;
|
||||
return B_FALSE;
|
||||
}
|
||||
|
@ -1298,7 +1298,7 @@ int canpush(lifeform_t *lf, object_t *o, int dir) {
|
|||
|
||||
// check object weight vs. lf weight
|
||||
// adjust object weight for cell sliperriness.
|
||||
adjweight = getobweight(o);
|
||||
adjweight = getobmass(o);
|
||||
if (o->pile->where) {
|
||||
adjweight -= getslipperyness(o->pile->where, NULL);
|
||||
limitf(&adjweight, 0, NA);
|
||||
|
@ -5112,7 +5112,7 @@ int eat(lifeform_t *lf, object_t *o) {
|
|||
// isn't normally edible (ie. a goat eating wood).
|
||||
if (lfhasflagval(lf, F_CANEATMATERIAL, o->material->id, NA, NA, NULL)) {
|
||||
// nutrition based on object weight
|
||||
nutrition = getobweight(o)*5;
|
||||
nutrition = getobmass(o)*5;
|
||||
} else {
|
||||
if (isplayer(lf)) {
|
||||
msg("That doesn't seem very nutritious...");
|
||||
|
@ -5188,7 +5188,7 @@ int eat(lifeform_t *lf, object_t *o) {
|
|||
turnstoeat = 1;
|
||||
} else {
|
||||
// time to eat entire food:
|
||||
turnstoeat = getobunitweight(o) / (getlfweight(lf, B_NOOBS) / 10);
|
||||
turnstoeat = getobweight(o) / (getlfweight(lf, B_NOOBS) / 10);
|
||||
}
|
||||
|
||||
if (startpcteaten > 0) {
|
||||
|
@ -7830,7 +7830,7 @@ int getarmournoise(lifeform_t *lf) {
|
|||
for (o = lf->pack->first ; o ; o = o->next) {
|
||||
if (isarmour(o) && isequipped(o)) {
|
||||
// heavy metal armour makes noise
|
||||
if (ismetal(o->material->id) && (getobweight(o) >= 4)) {
|
||||
if (ismetal(o->material->id) && (getobmass(o) >= 4)) {
|
||||
volmod++;
|
||||
}
|
||||
}
|
||||
|
@ -8300,7 +8300,7 @@ float getequippedweight(lifeform_t *lf) {
|
|||
float total = 0;
|
||||
for (o = lf->pack->first ; o ; o = o->next) {
|
||||
if (isequipped(o) && isarmour(o)) {
|
||||
total += getobweight(o);
|
||||
total += getobmass(o);
|
||||
}
|
||||
}
|
||||
return total;
|
||||
|
@ -25062,7 +25062,7 @@ int steal(lifeform_t *lf, obpile_t *op, enum FLAG wantflag) {
|
|||
initprompt(&prompt, buf);
|
||||
for (o = op->first ; o ; o = o->next) {
|
||||
int ok = B_TRUE;
|
||||
if ((slev < PR_SKILLED) && (getobunitweight(o) >= 3)) {
|
||||
if ((slev < PR_SKILLED) && (getobweight(o) >= 3)) {
|
||||
// too heavy to steal
|
||||
ok = B_FALSE;
|
||||
} else if ((slev < PR_MASTER) && isequipped(o)) {
|
||||
|
@ -28313,7 +28313,7 @@ int willbleedfrom(lifeform_t *lf, enum BODYPART bp) {
|
|||
// if lf picks up 'o', will they be burdened afterwards?
|
||||
// (if they are _already_ burdened, then stil return true)
|
||||
int willburden(lifeform_t *lf, object_t *o, int howmany) {
|
||||
if (getobpileweight(lf->pack) + (getobunitweight(o)*howmany) > getmaxcarryweight(lf) ) {
|
||||
if (getobpileweight(lf->pack) + (getobweight(o)*howmany) > getmaxcarryweight(lf) ) {
|
||||
return B_TRUE;
|
||||
}
|
||||
return B_FALSE;
|
||||
|
|
28
objects.c
28
objects.c
|
@ -3076,7 +3076,7 @@ void applyobmod(object_t *o, obmod_t *om) {
|
|||
if (!hasflag(o->flags, F_OBHP)) {
|
||||
int myhp;
|
||||
// give hp
|
||||
myhp = getobweight(o) * 20;
|
||||
myhp = getobmass(o) * 20;
|
||||
if (myhp <= 0) myhp = 2;
|
||||
|
||||
addtempflag(o->flags, F_OBHP, myhp, myhp, NA, NULL, FROMOBMOD);
|
||||
|
@ -4675,7 +4675,7 @@ int getbreakob(object_t *o, char *bigobname, char *smallobname) {
|
|||
small = findot(smalloid);
|
||||
|
||||
// now find out how many big obejcts make up the wight.
|
||||
weight = getobweight(o) / 2;
|
||||
weight = getobmass(o) / 2;
|
||||
if (big) {
|
||||
nbig = weight / big->weight;
|
||||
weight -= (nbig*big->weight);
|
||||
|
@ -4944,7 +4944,7 @@ int real_getobvalue(object_t *o, int amt) {
|
|||
price = f->val[0];
|
||||
} else {
|
||||
// base value: weight * material value
|
||||
price = (float)getobweight(o) * (float)getmaterialvalue(o->material->id);
|
||||
price = (float)getobmass(o) * (float)getmaterialvalue(o->material->id);
|
||||
}
|
||||
|
||||
if (o->type->id == OT_SPELLBOOK) {
|
||||
|
@ -5704,7 +5704,7 @@ int getmaxthrowrange(lifeform_t *lf, object_t *o) {
|
|||
str -= 2;
|
||||
limitf(&str, 1, NA); // ie. 1 to 16
|
||||
|
||||
obweight = getobunitweight(o);
|
||||
obweight = getobweight(o);
|
||||
|
||||
maxdist = ceil(str - obweight);
|
||||
|
||||
|
@ -5742,7 +5742,7 @@ char getnextletter(obpile_t *op, char *wantletter) {
|
|||
|
||||
int getnumshards(object_t *o) {
|
||||
int numshards,maxshards;
|
||||
maxshards = ceil(getobunitweight(o)) * 10;
|
||||
maxshards = ceil(getobweight(o)) * 10;
|
||||
if (maxshards < 1) maxshards = 1;
|
||||
numshards = rnd(1,maxshards);
|
||||
numshards *= o->amt;
|
||||
|
@ -5754,7 +5754,7 @@ int getnutritionbase(object_t *o) {
|
|||
flag_t *f;
|
||||
if (o->material->id == MT_ICE) {
|
||||
// use the object's weight
|
||||
basenutr = getobweight(o) * 10;
|
||||
basenutr = getobmass(o) * 10;
|
||||
} else {
|
||||
// use nutrition flag
|
||||
f = hasflag(o->flags, F_EDIBLE);
|
||||
|
@ -6900,7 +6900,7 @@ float getobpileweight(obpile_t *op) {
|
|||
}
|
||||
|
||||
for (o = op->first ; o ; o = o->next) {
|
||||
weight += getobweight(o);
|
||||
weight += getobmass(o);
|
||||
}
|
||||
|
||||
if (op->owner) {
|
||||
|
@ -7022,10 +7022,10 @@ char *getobhurtname(object_t *o, enum DAMTYPE damtype) {
|
|||
return "is damaged";
|
||||
}
|
||||
|
||||
float getobweight(object_t *o) {
|
||||
float getobmass(object_t *o) {
|
||||
float weight;
|
||||
|
||||
weight = getobunitweight(o) * o->amt;
|
||||
weight = getobweight(o) * o->amt;
|
||||
|
||||
// object contents
|
||||
if (hasflag(o->flags, F_CONTAINER) && !hasflag(o->flags, F_HOLDING)) {
|
||||
|
@ -7037,7 +7037,7 @@ float getobweight(object_t *o) {
|
|||
return weight;
|
||||
}
|
||||
|
||||
float getobunitweight(object_t *o) {
|
||||
float getobweight(object_t *o) {
|
||||
float weight;
|
||||
flag_t *f;
|
||||
|
||||
|
@ -7586,7 +7586,7 @@ int getshatterdam(object_t *o) {
|
|||
int shatterdam = 0;
|
||||
if (willshatter(o->material->id)) {
|
||||
int maxshatterdam;
|
||||
maxshatterdam = ceil(getobweight(o));
|
||||
maxshatterdam = ceil(getobmass(o));
|
||||
if (maxshatterdam < 1) maxshatterdam = 1;
|
||||
|
||||
shatterdam = rnd(1, maxshatterdam);
|
||||
|
@ -7638,7 +7638,7 @@ int getthrowdam(object_t *o) {
|
|||
// ie. 5 kg object does 1 damage
|
||||
// ie. 100 kg object does 20 damage (person)
|
||||
// ie. 1 tonne object does 200 damage (car)
|
||||
dam = ceil((double)getobunitweight(o)) / 2;
|
||||
dam = ceil((double)getobweight(o)) / 2;
|
||||
// non-missile objects do 25% less damage
|
||||
if (!hasflag(o->flags, F_THROWMISSILE)) {
|
||||
dam = pctof(75, dam);
|
||||
|
@ -8323,7 +8323,7 @@ int isknownot(objecttype_t *ot) {
|
|||
|
||||
|
||||
int isheavyweapon(object_t *o) {
|
||||
if (getobunitweight(o) >= HEAVYWEPKG) {
|
||||
if (getobweight(o) >= HEAVYWEPKG) {
|
||||
return B_TRUE;
|
||||
}
|
||||
return B_FALSE;
|
||||
|
@ -16107,7 +16107,7 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp
|
|||
|
||||
// heavy ob?
|
||||
if (youhit && target) {
|
||||
if ((getobunitweight(o)*amt) >= getlfweight(target, B_NOOBS)) {
|
||||
if ((getobweight(o)*amt) >= getlfweight(target, B_NOOBS)) {
|
||||
int dir;
|
||||
dir = getdirtowards(srcloc, target->cell, target, B_FALSE, DT_COMPASS);
|
||||
knockback(target, dir, 1, thrower, 0, B_DOANNOUNCE, B_DODAM);
|
||||
|
|
|
@ -156,8 +156,8 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
|
|||
float getobpileweight(obpile_t *op);
|
||||
char *getobconditionname(object_t *o, char *buf);
|
||||
char *getobhurtname(object_t *o, enum DAMTYPE damtype);
|
||||
float getobmass(object_t *o);
|
||||
float getobweight(object_t *o);
|
||||
float getobunitweight(object_t *o);
|
||||
objecttype_t *getoppositestairs(objecttype_t *ot);
|
||||
//objecttype_t *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat, enum LFSIZE maxsize, enum SKILL wepsk, enum RARITY forcerr, int forpickup, ... );
|
||||
objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forcehabitat, enum RARITY forcerr, int forpickup, condset_t *cs);
|
||||
|
|
40
spell.c
40
spell.c
|
@ -4235,15 +4235,15 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
c = getcellindir(caster->cell, d);
|
||||
if (c) {
|
||||
for (o = c->obpile->first ; o ; o = o->next){
|
||||
if (o->type->obclass->id == OC_FLORA) totweight += getobweight(o);
|
||||
if (o->type->obclass->id == OC_FLORA) totweight += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (o = caster->cell->obpile->first ; o ; o = o->next){
|
||||
if (o->type->obclass->id == OC_FLORA) totweight += getobweight(o);
|
||||
if (o->type->obclass->id == OC_FLORA) totweight += getobmass(o);
|
||||
}
|
||||
for (o = caster->pack->first ; o ; o = o->next){
|
||||
if (o->type->obclass->id == OC_FLORA) totweight += getobweight(o);
|
||||
if (o->type->obclass->id == OC_FLORA) totweight += getobmass(o);
|
||||
}
|
||||
powerinc = totweight / 50;
|
||||
if (powerinc > 0) {
|
||||
|
@ -4338,7 +4338,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (isequipped(o) && ismetal(o->material->id)) {
|
||||
takedamage(o, 9999, DT_DIRECT, caster);
|
||||
if (hasflag(o->flags, F_DEAD)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4352,7 +4352,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (ismetal(o->material->id)) {
|
||||
takedamage(o, 9999, DT_DIRECT, caster);
|
||||
if (hasflag(o->flags, F_DEAD)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4366,7 +4366,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (isequipped(o) && ismetal(o->material->id)) {
|
||||
takedamage(o, 9999, DT_DIRECT, caster);
|
||||
if (hasflag(o->flags, F_DEAD)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4422,7 +4422,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (o->material->id == MT_WOOD) {
|
||||
takedamage(o, 9999, DT_DIRECT, caster);
|
||||
if (hasflag(o->flags, F_DEAD)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4438,7 +4438,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (isequipped(o) && (o->material->id == MT_WOOD)) {
|
||||
takedamage(o, 9999, DT_DIRECT, caster);
|
||||
if (hasflag(o->flags, F_DEAD)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4555,7 +4555,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
op = targob->pile;
|
||||
obamt = targob->amt;
|
||||
getobname(targob, obname, targob->amt);
|
||||
obweight = getobweight(targob);
|
||||
obweight = getobmass(targob);
|
||||
// get conversion rate
|
||||
powerpct = ((double)power / getspellmaxpower(spellid)) ;
|
||||
convrate = (powerpct * (4.0 - 0.5)) + 0.5;
|
||||
|
@ -4834,7 +4834,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
// modify by power
|
||||
maxweight = 10;
|
||||
|
||||
if (getobweight(targob) > maxweight) {
|
||||
if (getobmass(targob) > maxweight) {
|
||||
if (haslos(player, obloc)) {
|
||||
msg("%s fades out of view slightly, then reappears.",obname);
|
||||
if (seenbyplayer) *seenbyplayer = B_TRUE;
|
||||
|
@ -5401,7 +5401,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
// modify by power
|
||||
maxweight += (10*power);
|
||||
|
||||
if (getobweight(targob) > maxweight) {
|
||||
if (getobmass(targob) > maxweight) {
|
||||
cell_t *obloc;
|
||||
char obname[BUFLEN];
|
||||
obloc = getoblocation(targob);
|
||||
|
@ -6856,7 +6856,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
nexto = o->next;
|
||||
if (getmaterialstate(o->material->id) == MS_LIQUID) {
|
||||
// if 20kilos or more, make steam
|
||||
if (getobweight(o) >= 25) {
|
||||
if (getobmass(o) >= 25) {
|
||||
dosteam = B_TRUE;
|
||||
if (cellseen) nsteamseen++;
|
||||
}
|
||||
|
@ -6969,7 +6969,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
nexto = o->next;
|
||||
// destroy metal items on the ground
|
||||
if (ismetal(o->material->id)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
removeob(o, o->amt);
|
||||
}
|
||||
}
|
||||
|
@ -8867,7 +8867,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (isequipped(o) && ismetal(o->material->id)) {
|
||||
takedamage(o, 9999, DT_DIRECT, caster);
|
||||
if (hasflag(o->flags, F_DEAD)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8881,7 +8881,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (ismetal(o->material->id)) {
|
||||
takedamage(o, 9999, DT_DIRECT, caster);
|
||||
if (hasflag(o->flags, F_DEAD)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8893,7 +8893,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (isequipped(o) && ismetal(o->material->id)) {
|
||||
takedamage(o, 9999, DT_DIRECT, caster);
|
||||
if (hasflag(o->flags, F_DEAD)) {
|
||||
totalmass += getobweight(o);
|
||||
totalmass += getobmass(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10072,7 +10072,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
if (ismetal(o->material->id) && isequipped(o)) {
|
||||
if (!isequippedon(o, BP_WEAPON) && !isequippedon(o, BP_SECWEAPON)) {
|
||||
gotmetal = B_TRUE;
|
||||
metalweight += getobweight(o);
|
||||
metalweight += getobmass(o);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -10122,7 +10122,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
} else if (cansee(player, caster)) {
|
||||
if (seenbyplayer) *seenbyplayer = B_TRUE;
|
||||
}
|
||||
if (getobpileweight(caster->pack) + getobweight(targob) <= getmaxcarryweight(caster)) {
|
||||
if (getobpileweight(caster->pack) + getobmass(targob) <= getmaxcarryweight(caster)) {
|
||||
// move it to the player
|
||||
pullobto(targob, caster);
|
||||
} else {
|
||||
|
@ -10784,7 +10784,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
for (o = op->first ; o ; o = nexto) {
|
||||
nexto = o->next;
|
||||
if (!hasflag(o->flags, F_NOSTEAL) && !hasflag(o->flags, F_NOPICKUP) && !hasflag(o->flags, F_COSMETIC)) {
|
||||
if ((getobunitweight(o) <= 5) ||
|
||||
if ((getobweight(o) <= 5) ||
|
||||
((isweapon(o)) && (isequipped(o))) ) {
|
||||
poss[nposs++] = o;
|
||||
}
|
||||
|
@ -13197,7 +13197,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
// modify by power
|
||||
maxweight += (10*power);
|
||||
|
||||
if (getobweight(targob) > maxweight) {
|
||||
if (getobmass(targob) > maxweight) {
|
||||
cell_t *obloc;
|
||||
char obname[BUFLEN];
|
||||
obloc = getoblocation(targob);
|
||||
|
|
Loading…
Reference in New Issue