From 0a66e1537dc7bb5500d7bf2203144ea44b167f45 Mon Sep 17 00:00:00 2001 From: miramor Date: Sun, 22 Mar 2015 14:18:10 -0400 Subject: Add a no-selling birth option --- lib/help/option.txt | 4 ++++ lib/mods/theme/help/option.txt | 4 ++++ src/object2.cc | 5 +++++ src/options.cc | 1 + src/options.hpp | 1 + src/store.cc | 9 ++++++--- src/tables.cc | 3 +++ 7 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/help/option.txt b/lib/help/option.txt index c34f7c22..7563f83b 100644 --- a/lib/help/option.txt +++ b/lib/help/option.txt @@ -66,6 +66,10 @@ can also be viewed from the option menu while playing, but not changed then. #####GYou can receive fates, good or bad [fate_option] Allows the player to turn off ToME's *****fatespoi.txt*0[fates] for that character. +#####GItems always sell for 0 gold [no_selling] + Disables selling items back to shops for money. The value of gold found in the + dungeon is increased to compensate. + ~~~~~07|Options|Ingame #####RIN GAME OPTIONS #####R=============== diff --git a/lib/mods/theme/help/option.txt b/lib/mods/theme/help/option.txt index e046aded..00ee15a4 100644 --- a/lib/mods/theme/help/option.txt +++ b/lib/mods/theme/help/option.txt @@ -66,6 +66,10 @@ can also be viewed from the option menu while playing, but not changed then. #####GYou can receive fates, good or bad [fate_option] Allows the player to turn off ToME's *****fatespoi.txt*0[fates] for that character. +#####GItems always sell for 0 gold [no_selling] + Disables selling items back to shops for money. The value of gold found in the + dungeon is increased to compensate. + ~~~~~07|Options|Ingame #####RIN GAME OPTIONS #####R=============== diff --git a/src/object2.cc b/src/object2.cc index a3abdbba..7093b94e 100644 --- a/src/object2.cc +++ b/src/object2.cc @@ -16,6 +16,7 @@ #include "mimic.hpp" #include "monster2.hpp" #include "object1.hpp" +#include "options.hpp" #include "randart.hpp" #include "skills.hpp" #include "spells2.hpp" @@ -5070,6 +5071,10 @@ bool_ make_gold(object_type *j_ptr) /* Determine how much the treasure is "worth" */ j_ptr->pval = (base + (8L * randint(base)) + randint(8)); + + /* Multiply value by 5 if selling is disabled */ + if (no_selling) + j_ptr->pval *= 5; /* Success */ return (TRUE); diff --git a/src/options.cc b/src/options.cc index 490b0245..0e3df5d0 100644 --- a/src/options.cc +++ b/src/options.cc @@ -89,3 +89,4 @@ bool_ ironman_rooms; bool_ joke_monsters; bool_ point_based; bool_ preserve; +bool_ no_selling; diff --git a/src/options.hpp b/src/options.hpp index a8a0c9f8..2035d4d8 100644 --- a/src/options.hpp +++ b/src/options.hpp @@ -89,3 +89,4 @@ extern bool_ ironman_rooms; extern bool_ joke_monsters; extern bool_ point_based; extern bool_ preserve; +extern bool_ no_selling; diff --git a/src/store.cc b/src/store.cc index 1a26f536..195598f1 100644 --- a/src/store.cc +++ b/src/store.cc @@ -297,6 +297,9 @@ static s32b price_item(object_type *o_ptr, int greed, bool_ flip) /* Mega-Hack -- Black market sucks */ if (st_info[st_ptr->st_idx].flags1 & SF1_ALL_ITEM) price = price / 2; + + /* No selling means you get no money */ + if (no_selling) price = 0; } /* Shop is selling */ @@ -310,14 +313,14 @@ static s32b price_item(object_type *o_ptr, int greed, bool_ flip) /* Mega-Hack -- Black market sucks */ if (st_info[st_ptr->st_idx].flags1 & SF1_ALL_ITEM) price = price * 2; + + /* Never give items away for free */ + if (price <= 0L) price = 1L; } /* Compute the final price (with rounding) */ price = (price * adjust + 50L) / 100L; - /* Note -- Never become "free" */ - if (price <= 0L) return (1L); - /* Return the price */ return (price); } diff --git a/src/tables.cc b/src/tables.cc index adb4ecf7..6796df31 100644 --- a/src/tables.cc +++ b/src/tables.cc @@ -1479,6 +1479,9 @@ option_type option_info[] = { &fate_option, TRUE, 6, 18, "fate_option", "You can receive fates, good or bad" }, + + { &no_selling, FALSE, 6, 20, + "no_selling", "Items always sell for 0 gold" }, /*** End of Table ***/ -- cgit v1.2.3