From c8a42323d22577815510fba6eee3a101164360d5 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Mon, 12 Sep 2011 01:42:31 +0000 Subject: [PATCH] * [+] bug: Hunger: [********..ve] - [+] debugging assertion broke loading a game (loading obs into dummycell with no "->where"). fixed. --- data/hiscores.db | Bin 5120 -> 5120 bytes defs.h | 1 + io.c | 5 +++-- lf.c | 34 ++++++++++++++++++++++++---------- objects.c | 2 +- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/data/hiscores.db b/data/hiscores.db index fb72b609fa5d7e9608ff1c8260d60de8c0bb01e1..ecacf0b93216db3f8a381ba3d6c1f755bc1f42e2 100644 GIT binary patch delta 142 zcmZqBXwaA-&FH;R<^?;mJag(~b`DE6=6vQX=G4uO9P-TkEX)jy@*qMEM95Aq;hrGI z$+Vb(`3CbQ=0@g7W>aQCrngKdm=K(S&of? hNmy2wVJ1k7w<57bPe~T6N|y;F!U7W6EXet6B`sJmvB!IV`CO%V7|e;iMf$ElG&75 zkg1aSJoD1cQaqhZc^qsEOv38M3flags, F_HUNGER); if (f) { int i; - char hungerbar[10]; + char hungerbar[11]; float pct; enum COLOUR col; doheadingsmall(mainwin, y2, x2, ftext, "Hunger"); @@ -8451,6 +8451,7 @@ void showlfstats(lifeform_t *lf, int showall) { hungerbar[i] = '.'; } } + hungerbar[10] = '\0'; //gethungername(lf, gethungerlevel(f->val[0]), buf); capitalise(buf); diff --git a/lf.c b/lf.c index 046ad46..bdb8772 100644 --- a/lf.c +++ b/lf.c @@ -4496,8 +4496,12 @@ int real_getattr(lifeform_t *lf, enum ATTRIB attr, int ignoreattrset) { val -= f->val[0]; } } - if ((f->id == F_INJURY) && (f->val[0] == IJ_WINDPIPECRUSHED) && (attr == A_CON)) { - val -= 6; + if (f->id == F_INJURY) { + 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; case BP_HEAD: - switch (rnd(1,3)) { + switch (rnd(1,4)) { case 1: if (!eyesshaded(lf)) { inj = IJ_BLACKEYE; @@ -7684,6 +7688,10 @@ int injure(lifeform_t *lf, enum BODYPART where, enum DAMTYPE damtype) { inj = IJ_WINDPIPECRUSHED; desc = strdup("windpipe is crushed^fitness penalty, cannot sprint"); break; + case 4: + inj = IJ_NOSEBROKEN; + desc = strdup("nose is broken^charisma penalty"); + break; } break; 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_UNARMED, 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 addflag(lastjob->flags, F_CANLEARN, SK_CLIMBING, 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; real_getlfnamea(noisemaker, lfname, B_FALSE); - if (dist >= 20) { + if (dist >= 20) { // 20+ strcpy(distbuf, " far away"); - } else if (dist >= 10) { + } else if (dist >= 10) { // 10 - 19 strcpy(distbuf, ""); - } else if (dist >= 5) { + } else if (dist >= 5) { // 5 - 9 strcpy(distbuf, " nearby"); - } else { + } else if (dist >= 2) { // 2 - 4 strcpy(distbuf, " very nearby"); + } else { // 1 + strcpy(distbuf, " right beside you"); } 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; int willrespond = B_FALSE; f = aihastarget(l); - if (f && (f->id == F_TARGETLF)) { - // might ignore the sound... + if (f) { + // will probably ignore the sound... if ((volume >= 5) && onein(2)) { willrespond = B_TRUE; } @@ -18619,7 +18630,10 @@ int rest(lifeform_t *lf, int onpurpose) { msg("%s finishes resting.",lfname); } if (isplayer(lf)) statdirty = B_TRUE; - killflag(rf); + + killflagsofid(lf->flags, F_TRAINING); + rf = isresting(lf); + if (rf) killflag(rf); wantclearmsg = B_FALSE; } } diff --git a/objects.c b/objects.c index 1f3121b..a1be911 100644 --- a/objects.c +++ b/objects.c @@ -458,7 +458,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int wantlinkholes nadded = 0; nretobs = 0; - if (where->where) { + if ((gamemode == GM_GAMESTARTED) && where->where) { assert(!where->where->type->solid); }