* [+] bug: Hunger: [********..ve]

- [+] debugging assertion broke loading a game (loading obs into
      dummycell with no "->where"). fixed.
This commit is contained in:
Rob Pearce 2011-09-12 01:42:31 +00:00
parent 273ed162d1
commit c8a42323d2
5 changed files with 29 additions and 13 deletions

Binary file not shown.

1
defs.h
View File

@ -2479,6 +2479,7 @@ enum INJURY {
IJ_LEGBLEED, IJ_LEGBLEED,
IJ_LEGBROKEN, IJ_LEGBROKEN,
IJ_LEGBRUISE, IJ_LEGBRUISE,
IJ_NOSEBROKEN,
IJ_RIBCRACKED, IJ_RIBCRACKED,
IJ_SHOULDERDISLOCATED, IJ_SHOULDERDISLOCATED,
IJ_TENDONCUT, IJ_TENDONCUT,

5
io.c
View File

@ -1252,7 +1252,7 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
if (isplayer(lf)) { if (isplayer(lf)) {
msg("^WYou feel woozy..."); msg("^WYou feel woozy...");
} else { } else {
msg("^%c%s looks woozy...", lfname, getlfcol(lf, CC_BAD)); msg("^%c%s looks woozy...", getlfcol(lf, CC_BAD), lfname);
} }
donesomething = B_TRUE; donesomething = B_TRUE;
break; break;
@ -8432,7 +8432,7 @@ void showlfstats(lifeform_t *lf, int showall) {
f = hasflag(lf->flags, F_HUNGER); f = hasflag(lf->flags, F_HUNGER);
if (f) { if (f) {
int i; int i;
char hungerbar[10]; char hungerbar[11];
float pct; float pct;
enum COLOUR col; enum COLOUR col;
doheadingsmall(mainwin, y2, x2, ftext, "Hunger"); doheadingsmall(mainwin, y2, x2, ftext, "Hunger");
@ -8451,6 +8451,7 @@ void showlfstats(lifeform_t *lf, int showall) {
hungerbar[i] = '.'; hungerbar[i] = '.';
} }
} }
hungerbar[10] = '\0';
//gethungername(lf, gethungerlevel(f->val[0]), buf); //gethungername(lf, gethungerlevel(f->val[0]), buf);
capitalise(buf); capitalise(buf);

34
lf.c
View File

@ -4496,8 +4496,12 @@ int real_getattr(lifeform_t *lf, enum ATTRIB attr, int ignoreattrset) {
val -= f->val[0]; val -= f->val[0];
} }
} }
if ((f->id == F_INJURY) && (f->val[0] == IJ_WINDPIPECRUSHED) && (attr == A_CON)) { if (f->id == F_INJURY) {
val -= 6; if ((f->val[0] == IJ_NOSEBROKEN) && (attr == A_CHA)) {
val -= 4;
} else if ((f->val[0] == IJ_WINDPIPECRUSHED) && (attr == A_CON)) {
val -= 6;
}
} }
} }
@ -7669,7 +7673,7 @@ int injure(lifeform_t *lf, enum BODYPART where, enum DAMTYPE damtype) {
} }
break; break;
case BP_HEAD: case BP_HEAD:
switch (rnd(1,3)) { switch (rnd(1,4)) {
case 1: case 1:
if (!eyesshaded(lf)) { if (!eyesshaded(lf)) {
inj = IJ_BLACKEYE; inj = IJ_BLACKEYE;
@ -7684,6 +7688,10 @@ int injure(lifeform_t *lf, enum BODYPART where, enum DAMTYPE damtype) {
inj = IJ_WINDPIPECRUSHED; inj = IJ_WINDPIPECRUSHED;
desc = strdup("windpipe is crushed^fitness penalty, cannot sprint"); desc = strdup("windpipe is crushed^fitness penalty, cannot sprint");
break; break;
case 4:
inj = IJ_NOSEBROKEN;
desc = strdup("nose is broken^charisma penalty");
break;
} }
break; break;
case BP_LEGS: case BP_LEGS:
@ -8685,6 +8693,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTSKILL, SK_STEALTH, PR_NOVICE, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_STEALTH, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_UNARMED, PR_NOVICE, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_UNARMED, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_MENTAL, PR_NOVICE, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_SS_MENTAL, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_STAVES, PR_NOVICE, NA, NULL);
// learnable skills // learnable skills
addflag(lastjob->flags, F_CANLEARN, SK_CLIMBING, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_CLIMBING, NA, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_COOKING, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_COOKING, NA, NA, NULL);
@ -14194,14 +14203,16 @@ int noise(cell_t *c, lifeform_t *noisemaker, enum NOISECLASS nt, int volume, cha
int dir; int dir;
real_getlfnamea(noisemaker, lfname, B_FALSE); real_getlfnamea(noisemaker, lfname, B_FALSE);
if (dist >= 20) { if (dist >= 20) { // 20+
strcpy(distbuf, " far away"); strcpy(distbuf, " far away");
} else if (dist >= 10) { } else if (dist >= 10) { // 10 - 19
strcpy(distbuf, ""); strcpy(distbuf, "");
} else if (dist >= 5) { } else if (dist >= 5) { // 5 - 9
strcpy(distbuf, " nearby"); strcpy(distbuf, " nearby");
} else { } else if (dist >= 2) { // 2 - 4
strcpy(distbuf, " very nearby"); strcpy(distbuf, " very nearby");
} else { // 1
strcpy(distbuf, " right beside you");
} }
dir = getdirtowards(l->cell, c, NULL, B_FALSE, DT_COMPASS); dir = getdirtowards(l->cell, c, NULL, B_FALSE, DT_COMPASS);
@ -14301,8 +14312,8 @@ int noise(cell_t *c, lifeform_t *noisemaker, enum NOISECLASS nt, int volume, cha
flag_t *f; flag_t *f;
int willrespond = B_FALSE; int willrespond = B_FALSE;
f = aihastarget(l); f = aihastarget(l);
if (f && (f->id == F_TARGETLF)) { if (f) {
// might ignore the sound... // will probably ignore the sound...
if ((volume >= 5) && onein(2)) { if ((volume >= 5) && onein(2)) {
willrespond = B_TRUE; willrespond = B_TRUE;
} }
@ -18619,7 +18630,10 @@ int rest(lifeform_t *lf, int onpurpose) {
msg("%s finishes resting.",lfname); msg("%s finishes resting.",lfname);
} }
if (isplayer(lf)) statdirty = B_TRUE; if (isplayer(lf)) statdirty = B_TRUE;
killflag(rf);
killflagsofid(lf->flags, F_TRAINING);
rf = isresting(lf);
if (rf) killflag(rf);
wantclearmsg = B_FALSE; wantclearmsg = B_FALSE;
} }
} }

View File

@ -458,7 +458,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int wantlinkholes
nadded = 0; nadded = 0;
nretobs = 0; nretobs = 0;
if (where->where) { if ((gamemode == GM_GAMESTARTED) && where->where) {
assert(!where->where->type->solid); assert(!where->where->type->solid);
} }