Index: trunk/src/list-mon-flags.h =================================================================== --- trunk/src/list-mon-flags.h (revision 2040) +++ trunk/src/list-mon-flags.h (working copy) @@ -104,4 +104,4 @@ RF(NO_STUN, "") RF(NO_CONF, "") RF(NO_SLEEP, "") -/* end flags */ \ No newline at end of file +/* end flags */ Index: trunk/src/option.c =================================================================== --- trunk/src/option.c (revision 2040) +++ trunk/src/option.c (working copy) @@ -100,7 +100,7 @@ OPT_birth_no_preserve, OPT_birth_no_stairs, OPT_birth_feelings, - OPT_NONE + OPT_birth_extra_homes }, /* Cheat */ @@ -272,7 +272,7 @@ { "birth_no_preserve", "Lose artifacts when leaving level", FALSE }, /* 135 */ { "birth_no_stairs", "Don't generate connected stairs", FALSE }, /* 136 */ { "birth_feelings", "Don't show level feelings", FALSE }, /* 137 */ -{ NULL, NULL, FALSE }, /* 138 */ +{ "birth_extra_homes", "Stores act as home extensions", FALSE }, /* 138 */ { NULL, NULL, FALSE }, /* 139 */ { NULL, NULL, FALSE }, /* 140 */ { "birth_ai_sound", "Monsters chase current location", TRUE }, /* 141 */ @@ -336,7 +336,7 @@ { "adult_no_preserve", "Lose artifacts when leaving level", FALSE }, /* 199 */ { "adult_no_stairs", "Don't generate connected stairs", FALSE }, /* 200 */ { NULL, NULL, FALSE }, /* 201 */ -{ NULL, NULL, FALSE }, /* 202 */ +{ "adult_extra_homes", "Stores act as home extensions", FALSE }, /* 202 */ { NULL, NULL, FALSE }, /* 203 */ { NULL, NULL, FALSE }, /* 204 */ { "adult_ai_sound", "Adult: Monsters chase current location", TRUE }, /* 205 */ Index: trunk/src/option.h =================================================================== --- trunk/src/option.h (revision 2040) +++ trunk/src/option.h (working copy) @@ -95,7 +95,8 @@ #define OPT_birth_no_preserve (OPT_BIRTH+7) #define OPT_birth_no_stairs (OPT_BIRTH+8) #define OPT_birth_feelings (OPT_BIRTH+9) -/* leave four spaces for future */ +#define OPT_birth_extra_homes (OPT_BIRTH+10) +/* leave spaces for future */ #define OPT_birth_ai_sound (OPT_BIRTH+13) #define OPT_birth_ai_smell (OPT_BIRTH+14) #define OPT_birth_ai_packs (OPT_BIRTH+15) @@ -120,7 +121,8 @@ #define OPT_adult_no_preserve (OPT_ADULT+7) #define OPT_adult_no_stairs (OPT_ADULT+8) #define OPT_adult_feelings (OPT_ADULT+9) -/* leave four spaces for future */ +#define OPT_adult_extra_homes (OPT_ADULT+10) +/* leave spaces for future */ #define OPT_adult_ai_sound (OPT_ADULT+13) #define OPT_adult_ai_smell (OPT_ADULT+14) #define OPT_adult_ai_packs (OPT_ADULT+15) Index: trunk/src/store.c =================================================================== --- trunk/src/store.c (revision 2040) +++ trunk/src/store.c (working copy) @@ -298,7 +298,8 @@ accept = TRUE; } - if (!accept) return FALSE; + /* Extra home option precludes selling */ + if (!accept || OPT(adult_extra_homes)) return FALSE; break; } @@ -909,8 +910,8 @@ /* Cursed/Worthless items "disappear" when sold */ if (value <= 0) return (-1); - /* Erase the inscription & pseudo-ID bit */ - o_ptr->note = 0; + /* Erase the inscription & pseudo-ID bit, unless extra_homes */ + if (!OPT(adult_extra_homes)) o_ptr->note = 0; /* Some item types require maintenance */ switch (o_ptr->tval) @@ -1487,7 +1488,7 @@ /* Ignore home */ if (which == STORE_HOME) return; - + /* General Store gets special treatment */ if (which == STORE_GENERAL) { @@ -1500,6 +1501,8 @@ return; } + /* Ignore other stores if extra_homes set */ + if (OPT(adult_extra_homes)) return; /* Activate that store */ st_ptr = &store[which]; @@ -1666,7 +1669,7 @@ scr_places_x[LOC_WEIGHT] = wid - 14; /* Add space for for prices */ - if (current_store() != STORE_HOME) + if (current_store() != STORE_HOME || (OPT(adult_extra_homes) && current_store() != STORE_GENERAL)) scr_places_x[LOC_WEIGHT] -= 10; /* Then Y */ @@ -1719,7 +1722,7 @@ o_ptr = &st_ptr->stock[oid]; /* Describe the object - preserving insriptions in the home */ - if (this_store == STORE_HOME) desc = ODESC_FULL; + if (this_store == STORE_HOME || OPT(adult_extra_homes)) desc = ODESC_FULL; else desc = ODESC_FULL | ODESC_STORE; object_desc(o_name, sizeof(o_name), o_ptr, ODESC_PREFIX | desc); @@ -1734,25 +1737,27 @@ /* Describe an object (fully) in a store */ if (this_store != STORE_HOME) { - /* Extract the "minimum" price */ - x = price_item(o_ptr, FALSE, 1); + if (!OPT(adult_extra_homes) || this_store == STORE_GENERAL) + { + /* Extract the "minimum" price */ + x = price_item(o_ptr, FALSE, 1); - /* Make sure the player can afford it */ - if ((int) p_ptr->au < (int) x) - colour = curs_attrs[CURS_UNKNOWN][(int)cursor]; + /* Make sure the player can afford it */ + if ((int) p_ptr->au < (int) x) + colour = curs_attrs[CURS_UNKNOWN][(int)cursor]; - /* Actually draw the price */ - if (((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF)) && - (o_ptr->number > 1)) - strnfmt(out_val, sizeof out_val, "%9ld avg", (long)x); - else + /* Actually draw the price */ + if (((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF)) && + (o_ptr->number > 1)) + strnfmt(out_val, sizeof out_val, "%9ld avg", (long)x); + else strnfmt(out_val, sizeof out_val, "%9ld ", (long)x); - c_put_str(colour, out_val, row, scr_places_x[LOC_PRICE]); + c_put_str(colour, out_val, row, scr_places_x[LOC_PRICE]); + } } } - /* * Display store (after clearing screen) */ @@ -1788,10 +1793,13 @@ /* Put the owner name */ put_str(owner_name, scr_places_y[LOC_OWNER], 1); - /* Show the max price in the store (above prices) */ - strnfmt(buf, sizeof(buf), "%s (%ld)", store_name, (long)(ot_ptr->max_cost)); - prt(buf, scr_places_y[LOC_OWNER], scr_places_x[LOC_OWNER] - strlen(buf)); - + /* Show the max price in the store (above prices), unless extra_homes */ + if (!OPT(adult_extra_homes)) + { + strnfmt(buf, sizeof(buf), "%s (%ld)", store_name, (long)(ot_ptr->max_cost)); + prt(buf, scr_places_y[LOC_OWNER], scr_places_x[LOC_OWNER] - strlen(buf)); + } + /* Label the object descriptions */ put_str("Store Inventory", scr_places_y[LOC_HEADER], 1); @@ -1799,7 +1807,8 @@ put_str("Weight", scr_places_y[LOC_HEADER], scr_places_x[LOC_WEIGHT] + 2); /* Label the asking price (in stores) */ - put_str("Price", scr_places_y[LOC_HEADER], scr_places_x[LOC_PRICE] + 4); + if (!OPT(adult_extra_homes) || this_store == STORE_GENERAL) + put_str("Price", scr_places_y[LOC_HEADER], scr_places_x[LOC_PRICE] + 4); } } @@ -1836,7 +1845,8 @@ text_out(" and '"); text_out_c(TERM_L_GREEN, "p"); - if (current_store() == STORE_HOME) text_out("' picks up"); + if (current_store() == STORE_HOME || (OPT(adult_extra_homes) && current_store() != STORE_GENERAL)) + text_out("' picks up"); else text_out("' purchases"); } text_out(" the selected item. '"); @@ -1845,6 +1855,7 @@ { text_out_c(TERM_L_GREEN, "d"); if (current_store() == STORE_HOME) text_out("' drops"); + else if (OPT(adult_extra_homes) && current_store() != STORE_GENERAL) text_out("' deposits"); else text_out("' sells"); } else @@ -1877,7 +1888,7 @@ { store_display_frame(); - if (store_flags & STORE_SHOW_HELP) + if (store_flags & STORE_SHOW_HELP) store_display_help(); else prt("Press '?' for help.", scr_places_y[LOC_HELP_PROMPT], 1); @@ -2105,6 +2116,9 @@ /* Extract the price for the entire stack */ price = price_item(i_ptr, FALSE, i_ptr->number); + /* If extra_homes option is set, withdraw for free */ + if (OPT(adult_extra_homes) && !this_store == STORE_GENERAL) price = 0; + if (price > p_ptr->au) { msg_print("You cannot afford that purchase."); @@ -2127,11 +2141,15 @@ i_ptr->ident &= ~(IDENT_STORE); /* Message */ - if (one_in_(3)) message(MSG_STORE5, 0, ONE_OF(comment_accept)); - msg_format("You bought %s for %ld gold.", o_name, (long)price); + if (!OPT(adult_extra_homes) || this_store == STORE_GENERAL) + { + if (one_in_(3)) message(MSG_STORE5, 0, ONE_OF(comment_accept)); + msg_format("You bought %s for %ld gold.", o_name, (long)price); + } + else msg_format("You withdraw %s from storage.", o_name); /* Erase the inscription */ - i_ptr->note = 0; + if (!OPT(adult_extra_homes)) i_ptr->note = 0; /* Give it to the player */ item_new = inven_carry(i_ptr); @@ -2154,8 +2172,8 @@ store_item_increase(this_store, item, -amt); store_item_optimize(this_store, item); - /* Store is empty */ - if (st_ptr->stock_num == 0) + /* Store is empty and not a storage area */ + if (st_ptr->stock_num == 0 && (this_store == STORE_GENERAL || !OPT(adult_extra_homes))) { int i; @@ -2265,6 +2283,8 @@ s32b price; + bool response; + int this_store = current_store(); store_type *st_ptr; @@ -2285,7 +2305,7 @@ msg_flag = FALSE; prt("", 0, 0); - if (this_store == STORE_HOME) + if (this_store == STORE_HOME || (OPT(adult_extra_homes) && this_store != STORE_GENERAL)) { amt = o_ptr->number; } @@ -2322,7 +2342,7 @@ num = find_inven(o_ptr); strnfmt(o_name, sizeof o_name, "%s how many%s? (max %d) ", - (this_store == STORE_HOME) ? "Take" : "Buy", + (this_store == STORE_HOME || (OPT(adult_extra_homes) && this_store != STORE_GENERAL)) ? "Take" : "Buy", num ? format(" (you have %d)", num) : "", amt); /* Get a quantity */ @@ -2345,12 +2365,25 @@ /* Describe the object (fully) */ object_desc(o_name, sizeof(o_name), i_ptr, ODESC_PREFIX | ODESC_FULL); - /* Attempt to buy it */ + /* Attempt to buy / withdraw it */ if (this_store != STORE_HOME) { - u32b price; - bool response; + if (OPT(adult_extra_homes) && this_store != STORE_GENERAL) + { + screen_save(); + /* Confirm withdrawal */ + response = store_get_check(format("Withdraw %s? [ESC, any other key to accept]", o_name)); + screen_load(); + + /* Negative response, so give up */ + if (!response) return FALSE; + + cmd_insert(CMD_BUY, item, amt); + store_flags |= STORE_KEEP_PROMPT; + return TRUE; + } + /* Extract the price for the entire stack */ price = price_item(i_ptr, FALSE, i_ptr->number); @@ -2369,7 +2402,7 @@ cmd_insert(CMD_BUY, item, amt); store_flags |= STORE_KEEP_PROMPT; } - + /* Home is much easier */ else { @@ -2426,7 +2459,11 @@ /* Check the store wants the items being sold */ if (!store_will_buy(current_store(), o_ptr)) { - msg_print("I do not wish to purchase this item."); + if (!OPT(adult_extra_homes)) + { + msg_print("I do not wish to purchase this item."); + } + else msg_print("I do not wish to display this item."); return; } @@ -2442,8 +2479,17 @@ price = price_item(&sold_item, TRUE, amt); - /* Get some money */ - p_ptr->au += price; + /* Handle cost to store for adult_extra_homes, ID/recharge */ + if (OPT(adult_extra_homes) && current_store() != STORE_GENERAL) + { + price = 100; + if (!object_is_known(o_ptr)) price += 200; + if (o_ptr->tval == TV_WAND || o_ptr->tval == TV_STAFF) price += 500; + + p_ptr->au -= price; + } + /* Get some money */ + else p_ptr->au += price; /* Update the display */ store_flags |= STORE_GOLD_CHANGE; @@ -2485,11 +2531,11 @@ object_desc(o_name, sizeof(o_name), &sold_item, ODESC_PREFIX | ODESC_FULL); /* Describe the result (in message buffer) */ - msg_format("You sold %s (%c) for %ld gold.", - o_name, index_to_label(item), (long)price); + msg_format("You %s %s (%c) for %ld gold.", + OPT(adult_extra_homes) ? "stored" : "sold", o_name, index_to_label(item), (long)price); /* Analyze the prices (and comment verbally) */ - purchase_analyze(price, value, dummy); + if (!OPT(adult_extra_homes)) purchase_analyze(price, value, dummy); /* Set squelch flag */ p_ptr->notice |= PN_SQUELCH; @@ -2586,6 +2632,9 @@ int this_store = current_store(); + s32b price; + bool response; + if (this_store == STORE_NONE) { msg_print("You cannot sell items when not in a store."); @@ -2603,7 +2652,7 @@ item_tester_hook = store_will_buy_tester; get_mode |= SHOW_PRICES; } - + /* Get an item */ p_ptr->command_wrk = USE_INVEN; p_ptr->command_cmd = 'd'; @@ -2652,8 +2701,34 @@ /* Get a full description */ object_desc(o_name, sizeof(o_name), i_ptr, ODESC_PREFIX | ODESC_FULL); + + /* Extra_homes procedure */ + /* Check if the player can afford to store at all */ + if (OPT(adult_extra_homes) && (current_store() != STORE_GENERAL && current_store() != STORE_HOME)) + { + price = 100; + if (!object_is_known(o_ptr)) price += 200; + if (o_ptr->tval == TV_WAND || o_ptr->tval == TV_STAFF) price += 500; + + screen_save(); + + msg_format("It would cost %ld gold for storage services for %s.", + (long)price, o_name ); + if (p_ptr->au > price) + { + /* Confirm */ + response = store_get_check(format("Store %s? [ESC, any other key to accept]", o_name)); + screen_load(); + + /* If negative response, so give up */ + if (!response) return; + + cmd_insert(CMD_SELL, item, amt); + store_flags |= STORE_KEEP_PROMPT; + } + } /* Real store */ - if (this_store != STORE_HOME) + else if (this_store != STORE_HOME) { /* Extract the value of the items */ u32b price = price_item(i_ptr, TRUE, amt); Index: trunk/lib/help/option.txt =================================================================== --- trunk/lib/help/option.txt (revision 2040) +++ trunk/lib/help/option.txt (working copy) @@ -313,6 +313,14 @@ Never generate a staircase back to the level you came from, if you used a staircase to get to the level. +***** +Stores act as home extensions [birth_extra_homes] + The stores are open, but all but General Store sell only mundane items + not worthy of the attention of adventurers such as yourself. However, + they will store items for you and identify them, and the Magic Shop + can recharge some wands or staves. + + --- Monster Intelligence --- *****