From 9387a677553968d45618dd6beebba7434d200080 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Tue, 16 Oct 2012 07:27:49 +0000 Subject: [PATCH] fixed bug with engineering detecting hollow walls. when going diagnonally i can asee through them! --- data.c | 1 + io.c | 11 +++++++---- lf.c | 29 +++++++++++++++++++++-------- lf.h | 2 +- objects.c | 4 +--- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/data.c b/data.c index 1bd2f07..741670f 100644 --- a/data.c +++ b/data.c @@ -7809,6 +7809,7 @@ void initobjects(void) { addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL); addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 100, NA, NA, NULL); + addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); killflagsofid(lastot->flags, F_ENCHANTABLE); addot(OT_SPECTACLES, "pair of spectacles", "Eyewear with special lenses to enhance your vision.", MT_GLASS, 0.01, OC_ARMOUR, SZ_TINY); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); diff --git a/io.c b/io.c index cfcda26..17fe586 100644 --- a/io.c +++ b/io.c @@ -707,9 +707,6 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t updateviewfor(c); drawlevelfor(player); - strcpy(groundbuf, c->type->name); - addengineeringinfo(player, groundbuf, c); - if (moved) { flag_t *f; int inlof = B_TRUE, inrange = B_TRUE; @@ -719,6 +716,9 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t // can we see the cell? if (haslos(player, c)) { int i; + + strcpy(groundbuf, c->type->name); + addengineeringinfo(player, groundbuf, c); if (c->lf) { if (cansee(player, c->lf)) { flag_t *f; @@ -1020,6 +1020,9 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t // can't see this cell void *thing; char desc[BUFLEN]; + + strcpy(groundbuf, "(unseen)"); + switch (isinscanrange(c, &thing, desc, NULL)) { case TT_MONSTER: case TT_OBJECT: @@ -1033,7 +1036,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t if (streq(groundbuf, buf)) { strcpy(fullbuf, buf); } else { - sprintf(fullbuf, "%s, %s", groundbuf, buf); + sprintf(fullbuf, "%s%s%s", groundbuf, strlen(buf) ? ", " : "", buf); } capitalise(fullbuf); if (srclf && (maxrange != UNLIMITED)) { diff --git a/lf.c b/lf.c index 42d3f8f..e01205d 100644 --- a/lf.c +++ b/lf.c @@ -2283,7 +2283,7 @@ int celllitfor(lifeform_t *lf, cell_t *c, int maxvisrange, int nightvisrange) { } */ -int celltransparentfor(lifeform_t *lf, cell_t *c, int *xray, int *rangemod, cell_t *nextcell) { +int celltransparentfor(lifeform_t *lf, cell_t *c, int *xray, int *rangemod) { object_t *o; flag_t *f; @@ -2295,12 +2295,12 @@ int celltransparentfor(lifeform_t *lf, cell_t *c, int *xray, int *rangemod, cell // high engineering lets you detect hollow walls. ie. // if a wall has another wall behind it, you 'see' it. - if (c->type->solid && nextcell && nextcell->type->solid) { - if (isadjacent(c, lf->cell) && !isadjacent(nextcell, lf->cell) && - (getskill(lf, SK_ENGINEERING) >= PR_BEGINNER)) { - ok = B_TRUE; - } - } + //if (c->type->solid && nextcell && nextcell->type->solid) { + // if (isadjacent(c, lf->cell) && !isadjacent(nextcell, lf->cell) && + // (getskill(lf, SK_ENGINEERING) >= PR_BEGINNER)) { + // ok = B_TRUE; + // } + //} if (!ok) { if (xray && *xray) { @@ -17758,6 +17758,7 @@ void precalclos(lifeform_t *lf) { int numpixels; //int db = B_FALSE; enum SKILLLEVEL plev = PR_INEPT; + enum SKILLLEVEL elev = PR_INEPT; flag_t *missingeye; //long visdiameter; long allocamt; @@ -17807,6 +17808,7 @@ void precalclos(lifeform_t *lf) { maxvisrange = getvisrange(lf, B_TRUE); nightvisrange = getnightvisrange(lf); plev = getskill(lf, SK_PERCEPTION); + elev = getskill(lf, SK_ENGINEERING); // find all cells at max fov nendcells = 0; @@ -17899,7 +17901,7 @@ void precalclos(lifeform_t *lf) { litforus = celllitfor(lf, c, maxvisrange, nightvisrange); */ - if (!celltransparentfor(lf, c, &xray, &rangemod, nextc)) { + if (!celltransparentfor(lf, c, &xray, &rangemod)) { keepgoing = B_FALSE; } currange += rangemod; @@ -17935,6 +17937,17 @@ void precalclos(lifeform_t *lf) { } */ } + + // high engineering lets you detect hollow walls. ie. + // if a wall has another wall behind it, you 'see' it. + if (!keepgoing) { + if (nextc && (elev >= PR_BEGINNER) && nextc->type->solid && + (c != lf->cell) && (!c->type->transparent) && + isadjacent(c, lf->cell) && !isadjacent(nextc, lf->cell)) { + // we can see through. + keepgoing = B_TRUE; + } + } } else { // ie. if !c keepgoing = B_FALSE; } diff --git a/lf.h b/lf.h index 1f91ad8..75133b2 100644 --- a/lf.h +++ b/lf.h @@ -72,7 +72,7 @@ int cantakeoff(lifeform_t *lf, object_t *o); int cantalk(lifeform_t *lf); int castspell(lifeform_t *lf, enum OBTYPE sid, lifeform_t *targlf, object_t *targob, cell_t *targcell, object_t *fromob, int *seen); int celllitfor(lifeform_t *lf, cell_t *c, int maxvisrange, int nightvisrange); -int celltransparentfor(lifeform_t *lf, cell_t *c, int *xray, int *rangemod, cell_t *nextcell); +int celltransparentfor(lifeform_t *lf, cell_t *c, int *xray, int *rangemod); int charmedaction(lifeform_t *lf, flag_t *charmflag); int checkburdened(lifeform_t *lf, int preburdened); int checkfordrowning(lifeform_t *lf, object_t *o); diff --git a/objects.c b/objects.c index 4c1c612..e78ece9 100644 --- a/objects.c +++ b/objects.c @@ -1472,9 +1472,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum addflag(o->flags, F_LINKGOD, god->race->id, NA, NA, NULL); switch (god->race->id) { case R_GODDEATH: - case R_GODTHIEVES - -oooooo + case R_GODTHIEVES: // open at night only addflag(lastot->flags, F_OPENHOURS, 9, 17, SP_CLOSEDTILNIGHT, NULL); break;