From 4cac38979dea03c2323e33c854ac1092621edec0 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 17 May 2009 11:00:04 +0000 Subject: Fix 2792807: Autoexplore attempting to open doors in bat form. Fix 2792782: vaults not initialising blood potions properly git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9790 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 2 +- crawl-ref/source/dat/entry.des | 216 ++++++++++++++++++++--------------------- crawl-ref/source/directn.cc | 2 +- crawl-ref/source/dungeon.cc | 4 + crawl-ref/source/misc.cc | 33 +++++-- crawl-ref/source/player.cc | 6 ++ crawl-ref/source/player.h | 4 + crawl-ref/source/travel.cc | 3 + 8 files changed, 150 insertions(+), 120 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index faf758e55a..497c462761 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2924,7 +2924,7 @@ static void _open_door(coord_def move, bool check_confused) { ASSERT(!crawl_state.arena && !crawl_state.arena_suspended); - if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT) + if (!player_can_open_doors()) { mpr("You can't open doors in your present form."); return; diff --git a/crawl-ref/source/dat/entry.des b/crawl-ref/source/dat/entry.des index cde15db144..2cf86d8149 100644 --- a/crawl-ref/source/dat/entry.des +++ b/crawl-ref/source/dat/entry.des @@ -58,13 +58,13 @@ KFEAT: Q = shallow_water SHUFFLE: M/N/O/P/Q SUBST: P = MNO # -# Player monsters (no vampire or ogre-mages because they can get out of their -# cells or create threats outside; no merfolk, alive or undead, because they -# insist on having deep water in their cells, which annoys me; other player +# Player monsters (no vampire or ogre-mages because they can get out of their +# cells or create threats outside; no merfolk, alive or undead, because they +# insist on having deep water in their cells, which annoys me; other player # species don't exist as monsters): KMONS: M = human / elf / orc; nothing / naga; nothing / centaur; nothing / \ draconian; nothing / ogre; nothing / minotaur / troll / kobold / \ - mummy / ghoul + mummy / ghoul # Player monsters, zombie versions (ghouls drop out because they need sustenance # and can't be reanimated once starved): KMONS: N = human zombie / elf zombie / orc zombie / naga zombie / ogre zombie / \ @@ -74,7 +74,7 @@ KMONS: N = human zombie / elf zombie / orc zombie / naga zombie / ogre zombie / KMONS: O = human skeleton / elf skeleton / orc skeleton / naga skeleton / \ centaur skeleton / draconian skeleton / ogre skeleton / \ minotaur skeleton /troll skeleton / kobold skeleton / mummy -# And now for something completely different (if any of these turn out to be +# And now for something completely different (if any of these turn out to be # able to escape or project spells out of their cells, they should be removed): KMONS: Q = orb of fire / ice dragon / shadow dragon / iron dragon / \ w:1 golden dragon / large abomination / tentacled monstrosity / \ @@ -180,7 +180,7 @@ ENDMAP # Players can safely watch at the clouds. Autoexplore will not run into # the chambers, players have to search for the secret door. Likewise, # all exits are secret except for the safe one. -# This vault is great. If need be, we may delegate it to another branch, +# This vault is great. If need be, we may delegate it to another branch, # where we less caution measures are demanded (dp). NAME: elemental_entry TAGS: entry no_monster_gen @@ -281,7 +281,7 @@ ENDMAP # Matthew's entry vaults ############################################################################## -############################################################################ +############################################################################ # A spiral sometimes made entirely of glass NAME: zelgadis_glass_entry_001 TAGS: entry @@ -301,7 +301,7 @@ MAP ...mmmmmmm.... ENDMAP -############################################################################ +############################################################################ # A spiral made of rock, with lots of "windows". NAME: zelgadis_glass_entry_002 TAGS: entry @@ -392,7 +392,7 @@ MAP ..!!!??????...??????!!!.. ...!!!???..?..???!!!... ..!!!!???.???!!!!.. - ...!!!!!+!!!!!... + ...!!!!!+!!!!!... ......@...... ENDMAP @@ -543,26 +543,26 @@ SHUFFLE: {}, XYZ SUBST: X=W, Y=w, Z=w MAP xxxxxxxxxxxxxxxxxxx -xxxxx{.......}xxxxx -xxxxx.........xxxxx -xwxxx.........xxxxx -xwwxx.........xxxxx -xwwwx.........xxxxx -xxwwx.........xxxxx -xxwwXw........xxxxx -xxxXwwwwwww...xxxxx -xxxxXwwwwYYwwZxxxxx -xxxxxXwwYwwwwwZwxxx -xxxxx...wwwwwZwwwxx +xxxxx{.......}xxxxx +xxxxx.........xxxxx +xwxxx.........xxxxx +xwwxx.........xxxxx +xwwwx.........xxxxx +xxwwx.........xxxxx +xxwwXw........xxxxx +xxxXwwwwwww...xxxxx +xxxxXwwwwYYwwZxxxxx +xxxxxXwwYwwwwwZwxxx +xxxxx...wwwwwZwwwxx xxxxx........wwwwxx -xxxxx.........xwwwx -xxxxx.........xxwwx -xxxxx.........xxxwx -xxxxx.........xxxxx -xxxxx....@....xxxxx +xxxxx.........xwwwx +xxxxx.........xxwwx +xxxxx.........xxxwx +xxxxx.........xxxxx +xxxxx....@....xxxxx ENDMAP -# Notes: chances are high that there is a shallow water path. Even if +# Notes: chances are high that there is a shallow water path. Even if # there is none, you can always see the door on the other side. NAME: lemuel_005_c TAGS: entry no_monster_gen @@ -570,25 +570,25 @@ ORIENT: float SHUFFLE: {}, ABC SUBST: A:=, B:x, C:x WEIGHT: 1 -MAP -xxxxxxxxxxxxxxxxxxx -xxxWA{.......}xxxxx -xxwWx.........xxxxx -xwwWB.........xxxxx -xwwWx.........xxxxx -xwwWC.........xxxxx -xxWwx.........xxxxx +MAP +xxxxxxxxxxxxxxxxxxx +xxxWA{.......}xxxxx +xxwWx.........xxxxx +xwwWB.........xxxxx +xwwWx.........xxxxx +xwwWC.........xxxxx +xxWwx.........xxxxx xxWwww........xxxxx -xWxwwwwwwww...xxxxx -xWxxwwwwwwwwwwxxxxx -xxWxxwwwwwwwwwwwxxx -xxWxx...wwwwwwwwwxx -xxwWx........wwwwxx -xwxw+.........xwwwx -xwxxx.........xxwwx -xxxxx.........xxxwx -xxxxx.........xxxxx -xxxxx.........xxxxx +xWxwwwwwwww...xxxxx +xWxxwwwwwwwwwwxxxxx +xxWxxwwwwwwwwwwwxxx +xxWxx...wwwwwwwwwxx +xxwWx........wwwwxx +xwxw+.........xwwwx +xwxxx.........xxwwx +xxxxx.........xxxwx +xxxxx.........xxxxx +xxxxx.........xxxxx ENDMAP ############################################################################## @@ -2906,9 +2906,9 @@ WEIGHT: 3 ITEM: nothing, nothing, nothing SHUFFLE: cccbvxxx, def} MAP - ........................ - ............cc.......... - d......cc....cc....cc....e + ........................ + ............cc.......... + d......cc....cc....cc....e .........cc..........cc....... ....cc........................ ....cc...................cc... @@ -2922,9 +2922,9 @@ MAP ...cc...................cc.... ........................cc.... .......cc..........cc......... - f....cc....cc....cc......} - ..........cc............ - ........................ + f....cc....cc....cc......} + ..........cc............ + ........................ ENDMAP NAME: david_entry_056_b @@ -2933,9 +2933,9 @@ ORIENT: float WEIGHT: 7 SHUFFLE: cccbvxxx MAP - .................... - .........cc......... - .........cc......... + .................... + .........cc......... + .........cc......... .....cc............cc..... .....cc............cc..... .......................... @@ -2946,9 +2946,9 @@ MAP .......................... .....cc............cc..... .....cc............cc..... - .........cc......... - .........cc......... - .................... + .........cc......... + .........cc......... + .................... ENDMAP ############################################################################## @@ -3127,18 +3127,18 @@ xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx -xxxxxx>lllllllllll.. -xxxxxxlClllllllll?.. -xxxxxxlllllllll??... -xxxxxxllllllllll.... -xxxxxxllllllllll.... -xxxxxxllllllllll.... -xxxxxxlllllllll?.... -xxxxxxlllllllll..... -xxxxxxllllllll?..... -xxxxxxl?ll?ll?.....{ -xxxxxxll.??.... -xxxxxxl......... +xxxxxx>lllllllllll.. +xxxxxxlClllllllll?.. +xxxxxxlllllllll??... +xxxxxxllllllllll.... +xxxxxxllllllllll.... +xxxxxxllllllllll.... +xxxxxxlllllllll?.... +xxxxxxlllllllll..... +xxxxxxllllllll?..... +xxxxxxl?ll?ll?.....{ +xxxxxxll.??.... +xxxxxxl......... ENDMAP NAME: david_entry_061_b_altar @@ -3156,16 +3156,16 @@ xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxx>wwwwwwwwwwwwww. xxxxxxwCwwwwwwwwwww... -xxxxxxwwwwwwwwwwww.. -xxxxxxwwwwwwwwwwww.. -xxxxxxwwwwwwwwwww... -xxxxxxwwwwwwwwwww... -xxxxxxwwwwwwwwww.... -xxxxxxwwwwwwwwww.... -xxxxxxwwwwwwwww..... -xxxxxxwwwwwwww.....{ -xxxxxxwwwwww..... -xxxxxxw.......... +xxxxxxwwwwwwwwwwww.. +xxxxxxwwwwwwwwwwww.. +xxxxxxwwwwwwwwwww... +xxxxxxwwwwwwwwwww... +xxxxxxwwwwwwwwww.... +xxxxxxwwwwwwwwww.... +xxxxxxwwwwwwwww..... +xxxxxxwwwwwwww.....{ +xxxxxxwwwwww..... +xxxxxxw.......... ENDMAP ############################################################################## @@ -3458,7 +3458,7 @@ MAP .wwwwww......llllll. .wwwwww......llllll. ..wwww..bbbb..llll.. - ......bbbbbb..... + ......bbbbbb..... .bbbbbb. .bbbbbb. ..bbbb.. @@ -3470,11 +3470,11 @@ ENDMAP NAME: david_entry_070 TAGS: entry no_rotate MONS: w:30 nothing / giant cockroach / w:2 worm -MONS: w:30 nothing / ooze +MONS: w:30 nothing / ooze MONS: w:20 nothing / jackal / rat MONS: w:30 nothing / ooze / w:2 jelly / giant cockroach / w:2 worm / \ w:5 jackal / w:5 rat -# There is a very slight chance that a jelly or an intelligent monster +# There is a very slight chance that a jelly or an intelligent monster # (hobgoblin) might spawn inside near the door. This is okay; added an exit. ORIENT: float FTILE: 1=floor_dirt, 2=floor_dirt, 3=floor_dirt, 4=floor_dirt, +=floor_dirt @@ -3503,9 +3503,9 @@ ENDMAP ############################################################################## # Morbid curiosity -# Monsters are easier. Made it harder for them to get out. The single orc -# can pack a punch, though. His window is secret, so autoexploring won't -# notice, except for characters with starting Traps and Doors skill, who +# Monsters are easier. Made it harder for them to get out. The single orc +# can pack a punch, though. His window is secret, so autoexploring won't +# notice, except for characters with starting Traps and Doors skill, who # will then bring Stealth and Evasion as well. # NAME: david_entry_071 @@ -3519,11 +3519,11 @@ NSUBST: X = 1:= / *:x NSUBST: Y = 1:+ / *:x SUBST: A=@, B=@xx, C=@xxxx, D=x MAP - xxxxxxxxxBxxxxxxxxx - xxxxx...........xxxxx - xxx...xxxxx=xxxxx...xxx - xx..xxxxxlllllllxxxxx..xx - xx.xxxxxlll.....lllxxxxx.xx + xxxxxxxxxBxxxxxxxxx + xxxxx...........xxxxx + xxx...xxxxx=xxxxx...xxx + xx..xxxxxlllllllxxxxx..xx + xx.xxxxxlll.....lllxxxxx.xx xx.xxxxxx3..........xxxxxx.xx xx.xxxxxxxxxxx=xxxxxxxxxxx.xx xx.xxxxxxxxxGXGXGxxxxxxxxx.xx @@ -3537,11 +3537,11 @@ x.xx...xxx.........xxx..lxx.x xx.xxxxxxxxxxG=Gxxxxxxxxxxx.x xx.xxxxxxxxxxx=xxxxxxxxxxx.xx xx.xxxxxx...........xxxxxx.xx -xxx.xxxxxlll2..2.lllxxxxx.xx - xxx..xxxxxlllllllxxxxx..xx - xxx...xxxxx+xxxxx...xxx - xxxxx...........xxxxx - xxxxxxxxxDxxxxxxxxx +xxx.xxxxxlll2..2.lllxxxxx.xx + xxx..xxxxxlllllllxxxxx..xx + xxx...xxxxx+xxxxx...xxx + xxxxx...........xxxxx + xxxxxxxxxDxxxxxxxxx ENDMAP ############################################################################## @@ -3744,8 +3744,8 @@ ITEM: q:1 stone MONS: rat SHUFFLE: {[(> MAP - ........@........ - ........>........ + ........@........ + ........>........ ...xcXXXXXXXXXXXcx... ...xXXX...1...XXXx... ...xXX..1...1..XXx... @@ -3755,8 +3755,8 @@ MAP ...xXX..1...1..XXx... ...xXXX...1...XXXx... ...xcXXXXXXXXXXXcx... - ........{........ - ........@........ + ........{........ + ........@........ ENDMAP ############################################################################## @@ -4100,9 +4100,9 @@ xxxxx+xx.......xxxxx.......xxxx xxxxx.xxx.....xxx.xxx.....xxx.xx xxxx...xxx...xxx...xxx...xxx...xx xxx.....xxx.xxx.....xxxexxx.....xx -xx.......xx+xx..1.1..xx+xx.......xx +xx.......xx+xx..1.1..xx+xx.......xx x....[....+.+...1d....+.+~...3....+@ -xx.......xx+xx...1...xx+xx.......xx +xx.......xx+xx...1...xx+xx.......xx xxx.....xxx.xxx.....xxxfxxx.....xx xxxx...xxx...xxx...xxx...xxx...xx xxxxx.xxx.....xxx.xxx.....xxx.xx @@ -4235,12 +4235,12 @@ SHUFFLE: {[(, XY/AB KFEAT: X = teleport trap SUBST: Y=x, A=., B==, (=(., [=[. MAP - xxxx@xxxxxxx.@.x - xxxx.xxxxxx...xx - xxxx.xxxxx...xxx - xx....xxx...xxxx - xx{....x...xxxxx -xxxxx........xxxxxx + xxxx@xxxxxxx.@.x + xxxx.xxxxxx...xx + xxxx.xxxxx...xxx + xx....xxx...xxxx + xx{....x...xxxxx +xxxxx........xxxxxx x].XY........xxxxxxxxx xxxxx.[..............@ xxxxx.......(.xxxxxxxx @@ -4282,7 +4282,7 @@ NAME: onia_ninara_001_pentagram TAGS: entry no_monster_gen no_pool_fixup no_rotate ORIENT: float SHUFFLE: ({[, x+/x+/x+/x+/cC/vV/lL/wW -SUBST: C=+, V=+ +SUBST: C=+, V=+ NSUBST: L = 1:. / *:l MAP ............. @@ -4380,7 +4380,7 @@ ORIENT: float ITEM: apple / sausage / nothing / stone / potion of water / w:30 nothing SHUFFLE: ({[ , AB SUBST: A : x , B = +., X = x= -MONS: w:30 nothing / w:10 plant / w:3 fungus / w:1 worm +MONS: w:30 nothing / w:10 plant / w:3 fungus / w:1 worm MAP xxxxxxxxx@xxxxxxx x.......A.B.....x diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index b815fa9804..756b9a5e3b 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -564,7 +564,7 @@ void full_describe_view() desc_menu.allow_toggle = true; // Don't make a menu so tall that we recycle hotkeys on the same page. - if (list_mons.size() + list_items.size() > 52 + if (list_mons.size() + list_items.size() + list_features.size() > 52 && (desc_menu.maxpagesize() > 52 || desc_menu.maxpagesize() == 0)) { desc_menu.set_maxpagesize(52); diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 2a3f54e0c4..4f8c2e0385 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4418,7 +4418,11 @@ static void _dgn_place_item_explicit(const item_spec &spec, item_def &item(mitm[item_made]); item.pos = where; if (is_stackable_item(item) && spec.qty > 0) + { item.quantity = spec.qty; + if (is_blood_potion(item)) + init_stack_blood_potions(item); + } if (spec.plus >= 0 && item.base_type == OBJ_BOOKS && item.sub_type == BOOK_MANUAL) diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 9f1f8276ab..2c181471ca 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -238,6 +238,19 @@ static void _long_sort(CrawlVector &vec) } } +static void _compare_blood_quantity(item_def &stack, int timer_size) +{ + if (timer_size != stack.quantity) + { + mprf(MSGCH_WARN, + "ERROR: blood potion quantity (%d) doesn't match timer (%d)", + stack.quantity, timer_size); + + // sanity measure + stack.quantity = timer_size; + } +} + void maybe_coagulate_blood_potions_floor(int obj) { item_def &blood = mitm[obj]; @@ -251,7 +264,7 @@ void maybe_coagulate_blood_potions_floor(int obj) ASSERT(props.exists("timer")); CrawlVector &timer = props["timer"].get_vector(); ASSERT(!timer.empty()); - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); // blood.sub_type could be POT_BLOOD or POT_BLOOD_COAGULATED // -> need different handling @@ -364,7 +377,7 @@ void maybe_coagulate_blood_potions_floor(int obj) timer.push_back(val); } dec_mitm_item_quantity(obj, rot_count); - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); return; } @@ -404,7 +417,7 @@ void maybe_coagulate_blood_potions_floor(int obj) move_item_to_grid(&o, blood.pos); dec_mitm_item_quantity(obj, rot_count + coag_count); - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); } // Prints messages for blood potions coagulating in inventory (coagulate = true) @@ -455,7 +468,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) ASSERT(props.exists("timer")); CrawlVector &timer = props["timer"].get_vector(); - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); ASSERT(!timer.empty()); // blood.sub_type could be POT_BLOOD or POT_BLOOD_COAGULATED @@ -516,7 +529,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) destroy_item(blood); } else - ASSERT(blood.quantity == timer.size()); + _compare_blood_quantity(blood, timer.size()); return (true); } @@ -563,7 +576,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) } else { - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); if (!knew_blood) mpr(blood.name(DESC_INVENTORY).c_str()); } @@ -607,7 +620,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) } blood.quantity -= rot_count; // Stack still exists because of coag_count. - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); if (!knew_coag) mpr(blood.name(DESC_INVENTORY).c_str()); @@ -651,7 +664,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) props_new.assert_validity(); blood.quantity -= coag_count + rot_count; - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); if (!knew_blood) mpr(blood.name(DESC_INVENTORY).c_str()); @@ -690,7 +703,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) inc_mitm_item_quantity(o, coag_count); ASSERT(timer2.size() == mitm[o].quantity); dec_inv_item_quantity(blood.link, rot_count + coag_count); - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); if (!knew_blood) mpr(blood.name(DESC_INVENTORY).c_str()); @@ -742,7 +755,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) } else { - ASSERT(timer.size() == blood.quantity); + _compare_blood_quantity(blood, timer.size()); if (!knew_blood) mpr(blood.name(DESC_INVENTORY).c_str()); } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 8dca1e0083..dbb5fc47e7 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -427,6 +427,12 @@ bool player_is_swimming() return (you.swimming()); } +bool player_can_open_doors() +{ + // Bats can't close/open doors. + return (you.attribute[ATTR_TRANSFORMATION] != TRAN_BAT); +} + bool player_under_penance(void) { if (you.religion != GOD_NO_GOD) diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 3c9f2f5673..ffb5542825 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -326,6 +326,10 @@ void modify_stat(stat_type which_stat, char amount, bool suppress_msg, void modify_stat(stat_type which_stat, char amount, bool suppress_msg, const item_def &cause, bool removed = false); +/* *********************************************************************** + * called from: acr - travel + * *********************************************************************** */ +bool player_can_open_doors(); // last updated 19may2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 7636330f22..cdf5a42b89 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -652,6 +652,9 @@ void init_travel_terrain_check(bool check_race_equip) _set_pass_feature(DNGN_TRAP_MECHANICAL, trav); // Shafts can also be levitated over. _set_pass_feature(DNGN_TRAP_NATURAL, trav); + + if (!player_can_open_doors()) + _set_pass_feature(DNGN_CLOSED_DOOR, IMPASSABLE); } else { -- cgit v1.2.3-54-g00ecf