fixed bug with engineering detecting hollow walls. when going diagnonally i can asee through them!

This commit is contained in:
Rob Pearce 2012-10-16 07:27:49 +00:00
parent 68e5435fdf
commit 9387a67755
5 changed files with 31 additions and 16 deletions

1
data.c
View File

@ -7809,6 +7809,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL); addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL);
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, 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_CRITPROTECTION, 100, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
killflagsofid(lastot->flags, F_ENCHANTABLE); 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); 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); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);

11
io.c
View File

@ -707,9 +707,6 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t
updateviewfor(c); updateviewfor(c);
drawlevelfor(player); drawlevelfor(player);
strcpy(groundbuf, c->type->name);
addengineeringinfo(player, groundbuf, c);
if (moved) { if (moved) {
flag_t *f; flag_t *f;
int inlof = B_TRUE, inrange = B_TRUE; 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? // can we see the cell?
if (haslos(player, c)) { if (haslos(player, c)) {
int i; int i;
strcpy(groundbuf, c->type->name);
addengineeringinfo(player, groundbuf, c);
if (c->lf) { if (c->lf) {
if (cansee(player, c->lf)) { if (cansee(player, c->lf)) {
flag_t *f; flag_t *f;
@ -1020,6 +1020,9 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t
// can't see this cell // can't see this cell
void *thing; void *thing;
char desc[BUFLEN]; char desc[BUFLEN];
strcpy(groundbuf, "(unseen)");
switch (isinscanrange(c, &thing, desc, NULL)) { switch (isinscanrange(c, &thing, desc, NULL)) {
case TT_MONSTER: case TT_MONSTER:
case TT_OBJECT: case TT_OBJECT:
@ -1033,7 +1036,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t
if (streq(groundbuf, buf)) { if (streq(groundbuf, buf)) {
strcpy(fullbuf, buf); strcpy(fullbuf, buf);
} else { } else {
sprintf(fullbuf, "%s, %s", groundbuf, buf); sprintf(fullbuf, "%s%s%s", groundbuf, strlen(buf) ? ", " : "", buf);
} }
capitalise(fullbuf); capitalise(fullbuf);
if (srclf && (maxrange != UNLIMITED)) { if (srclf && (maxrange != UNLIMITED)) {

29
lf.c
View File

@ -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; object_t *o;
flag_t *f; 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. // high engineering lets you detect hollow walls. ie.
// if a wall has another wall behind it, you 'see' it. // if a wall has another wall behind it, you 'see' it.
if (c->type->solid && nextcell && nextcell->type->solid) { //if (c->type->solid && nextcell && nextcell->type->solid) {
if (isadjacent(c, lf->cell) && !isadjacent(nextcell, lf->cell) && // if (isadjacent(c, lf->cell) && !isadjacent(nextcell, lf->cell) &&
(getskill(lf, SK_ENGINEERING) >= PR_BEGINNER)) { // (getskill(lf, SK_ENGINEERING) >= PR_BEGINNER)) {
ok = B_TRUE; // ok = B_TRUE;
} // }
} //}
if (!ok) { if (!ok) {
if (xray && *xray) { if (xray && *xray) {
@ -17758,6 +17758,7 @@ void precalclos(lifeform_t *lf) {
int numpixels; int numpixels;
//int db = B_FALSE; //int db = B_FALSE;
enum SKILLLEVEL plev = PR_INEPT; enum SKILLLEVEL plev = PR_INEPT;
enum SKILLLEVEL elev = PR_INEPT;
flag_t *missingeye; flag_t *missingeye;
//long visdiameter; //long visdiameter;
long allocamt; long allocamt;
@ -17807,6 +17808,7 @@ void precalclos(lifeform_t *lf) {
maxvisrange = getvisrange(lf, B_TRUE); maxvisrange = getvisrange(lf, B_TRUE);
nightvisrange = getnightvisrange(lf); nightvisrange = getnightvisrange(lf);
plev = getskill(lf, SK_PERCEPTION); plev = getskill(lf, SK_PERCEPTION);
elev = getskill(lf, SK_ENGINEERING);
// find all cells at max fov // find all cells at max fov
nendcells = 0; nendcells = 0;
@ -17899,7 +17901,7 @@ void precalclos(lifeform_t *lf) {
litforus = celllitfor(lf, c, maxvisrange, nightvisrange); litforus = celllitfor(lf, c, maxvisrange, nightvisrange);
*/ */
if (!celltransparentfor(lf, c, &xray, &rangemod, nextc)) { if (!celltransparentfor(lf, c, &xray, &rangemod)) {
keepgoing = B_FALSE; keepgoing = B_FALSE;
} }
currange += rangemod; 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 } else { // ie. if !c
keepgoing = B_FALSE; keepgoing = B_FALSE;
} }

2
lf.h
View File

@ -72,7 +72,7 @@ int cantakeoff(lifeform_t *lf, object_t *o);
int cantalk(lifeform_t *lf); 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 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 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 charmedaction(lifeform_t *lf, flag_t *charmflag);
int checkburdened(lifeform_t *lf, int preburdened); int checkburdened(lifeform_t *lf, int preburdened);
int checkfordrowning(lifeform_t *lf, object_t *o); int checkfordrowning(lifeform_t *lf, object_t *o);

View File

@ -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); addflag(o->flags, F_LINKGOD, god->race->id, NA, NA, NULL);
switch (god->race->id) { switch (god->race->id) {
case R_GODDEATH: case R_GODDEATH:
case R_GODTHIEVES case R_GODTHIEVES:
oooooo
// open at night only // open at night only
addflag(lastot->flags, F_OPENHOURS, 9, 17, SP_CLOSEDTILNIGHT, NULL); addflag(lastot->flags, F_OPENHOURS, 9, 17, SP_CLOSEDTILNIGHT, NULL);
break; break;