From 3dd52fa5112cefffba139a4f66dd05626c24fa85 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Mon, 13 Jun 2016 08:44:14 +1000 Subject: [PATCH] When describing an object fmor a shop, show its real (identified) name. --- io.c | 6 +++++- objects.c | 15 ++++++++++++++- objects.h | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/io.c b/io.c index be65bfb..6ea9a79 100644 --- a/io.c +++ b/io.c @@ -4344,7 +4344,11 @@ void describeob(object_t *o) { cls(); // 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); mvwprintw(mainwin, 0, 0, buf); wattroff(mainwin, A_BOLD); diff --git a/objects.c b/objects.c index 287e530..8c6489e 100644 --- a/objects.c +++ b/objects.c @@ -1418,7 +1418,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum 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"); canstack = B_FALSE; wantblessknown = B_TRUE; @@ -8303,6 +8303,11 @@ int isheatable(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 (hasflag(o->flags, F_IDENTIFIED)) { return B_TRUE; @@ -10185,6 +10190,7 @@ int obhpknown(object_t *o) { return showfullhp; } + enum DAMTYPE oblastdamtype(object_t *o) { flag_t *f; f = hasflag(o->flags, F_LASTDAMTYPE); @@ -12613,6 +12619,13 @@ int pilehasletter(obpile_t *op, char let) { 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) { char buf[BUFLEN],obname[BUFLEN],lfname[BUFLEN],dstname[BUFLEN]; int playercansee; diff --git a/objects.h b/objects.h index 7593f97..519445f 100644 --- a/objects.h +++ b/objects.h @@ -301,6 +301,7 @@ void obtodancing(lifeform_t *newlf, object_t *o); int operate(lifeform_t *lf, object_t *o, cell_t *where); enum RARITY pickrr(int whatfor); 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); int pour(lifeform_t *lf, object_t *o); void quaff(lifeform_t *lf, object_t *o);