When describing an object fmor a shop, show its real (identified) name.

This commit is contained in:
Rob Pearce 2016-06-13 08:44:14 +10:00
parent 4994faa11b
commit 3dd52fa511
3 changed files with 20 additions and 2 deletions

6
io.c
View File

@ -4344,7 +4344,11 @@ void describeob(object_t *o) {
cls(); cls();
// title // title
getobname(o, buf,o->amt); if (pileisinshop(o->pile)) {
getobnametrue(o, buf,o->amt);
} else {
getobname(o, buf,o->amt);
}
wattron(mainwin, A_BOLD); wattron(mainwin, A_BOLD);
mvwprintw(mainwin, 0, 0, buf); mvwprintw(mainwin, 0, 0, buf);
wattroff(mainwin, A_BOLD); wattroff(mainwin, A_BOLD);

View File

@ -1418,7 +1418,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
canstack = B_FALSE; canstack = B_FALSE;
} }
if (where->parentob && hasflag(where->parentob->flags, F_SHOP)) { if (pileisinshop(where)) {
if (db) dblog("DB: setting canstack = false, object is going into a shop"); if (db) dblog("DB: setting canstack = false, object is going into a shop");
canstack = B_FALSE; canstack = B_FALSE;
wantblessknown = B_TRUE; wantblessknown = B_TRUE;
@ -8303,6 +8303,11 @@ int isheatable(object_t *o) {
} }
int isknown(object_t *o) { int isknown(object_t *o) {
// objects in shops are always fully known.
if (pileisinshop(o->pile)) {
return B_TRUE;
}
// if id'd, return the full name // if id'd, return the full name
if (hasflag(o->flags, F_IDENTIFIED)) { if (hasflag(o->flags, F_IDENTIFIED)) {
return B_TRUE; return B_TRUE;
@ -10185,6 +10190,7 @@ int obhpknown(object_t *o) {
return showfullhp; return showfullhp;
} }
enum DAMTYPE oblastdamtype(object_t *o) { enum DAMTYPE oblastdamtype(object_t *o) {
flag_t *f; flag_t *f;
f = hasflag(o->flags, F_LASTDAMTYPE); f = hasflag(o->flags, F_LASTDAMTYPE);
@ -12613,6 +12619,13 @@ int pilehasletter(obpile_t *op, char let) {
return found; return found;
} }
int pileisinshop(obpile_t *op) {
if (op && op->parentob && hasflag(op->parentob->flags, F_SHOP)) {
return B_TRUE;
}
return B_FALSE;
}
int pour(lifeform_t *lf, object_t *o) { int pour(lifeform_t *lf, object_t *o) {
char buf[BUFLEN],obname[BUFLEN],lfname[BUFLEN],dstname[BUFLEN]; char buf[BUFLEN],obname[BUFLEN],lfname[BUFLEN],dstname[BUFLEN];
int playercansee; int playercansee;

View File

@ -301,6 +301,7 @@ void obtodancing(lifeform_t *newlf, object_t *o);
int operate(lifeform_t *lf, object_t *o, cell_t *where); int operate(lifeform_t *lf, object_t *o, cell_t *where);
enum RARITY pickrr(int whatfor); enum RARITY pickrr(int whatfor);
int pilehasletter(obpile_t *op, char let); int pilehasletter(obpile_t *op, char let);
int pileisinshop(obpile_t *op);
void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE potlessed, int *seen); void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE potlessed, int *seen);
int pour(lifeform_t *lf, object_t *o); int pour(lifeform_t *lf, object_t *o);
void quaff(lifeform_t *lf, object_t *o); void quaff(lifeform_t *lf, object_t *o);