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_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);

11
io.c
View File

@ -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)) {

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;
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;
}

2
lf.h
View File

@ -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);

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);
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;