|
From: <gi...@cr...> - 2017-06-17 17:15:16
|
via 3fa40af13f904aec611813e7339343ceead2ae76 (commit)
via 37f92568e5f95bbe160e2f6110db568a0a6ad41b (commit)
from 3f13d09f4ca693a04192cb1566c1d52256c19d68 (commit)
-----------------------------------------------------------------------
commit 3fa40af13f904aec611813e7339343ceead2ae76
Author: Kyle Rawlins <ra...@gm...>
Date: Sat Jun 17 13:08:15 2017 -0400
checkwhite + unbrace
commit 37f92568e5f95bbe160e2f6110db568a0a6ad41b
Author: Kyle Rawlins <ra...@gm...>
Date: Sat Jun 17 13:01:42 2017 -0400
Fix behavior of translevel autotravel when called on walls (10802)
Previously this would do really weird things when called on walls or
other non-traversable positions, depending on various factors like
whether you were standing on stairs; typically it would try to send you
off-level (see Yermak's bug report for the exact conditions). This is
triggered when traveling from the `X` display, which always calls
translevel travel (even if you're looking at the curent level). The
problem was that some of the translevel pathfinding code doesn't
differentiate between inaccessible without translevel travel vs plain
inaccessible. I left this code as is & added a note about this
assumption, and added a check earlier, so X. into a non-traversable
feature on the current level fails immediately.
If you try to autotravel to a solid (or non-traversable) feature on a
different level, this will still send you to that level, but stop when
you get there. I'm not sure if this is the ideal behavior.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/god-wrath.cc | 2 ++
crawl-ref/source/l-wiz.cc | 6 +++---
crawl-ref/source/test/fsim.lua | 34 +++++++++++++++++-----------------
crawl-ref/source/test/mutation.lua | 2 +-
crawl-ref/source/travel.cc | 25 +++++++++++++++++++++----
5 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/crawl-ref/source/god-wrath.cc b/crawl-ref/source/god-wrath.cc
index 7bf3353..42bbd94 100644
--- a/crawl-ref/source/god-wrath.cc
+++ b/crawl-ref/source/god-wrath.cc
@@ -645,9 +645,11 @@ static bool _kikubaaqudgha_retribution()
// necromancy miscast, 25% chance of additional miscast
const int num_miscasts = one_chance_in(4) ? 2 : 1;
for (int i = 0; i < num_miscasts; i++)
+ {
MiscastEffect(&you, nullptr, GOD_MISCAST + god, SPTYP_NECROMANCY,
2 + div_rand_round(you.experience_level, 9),
random2avg(88, 3), _god_wrath_name(god));
+ }
}
// Every act of retribution causes corpses in view to rise against
diff --git a/crawl-ref/source/l-wiz.cc b/crawl-ref/source/l-wiz.cc
index 8662254..14ee92b 100644
--- a/crawl-ref/source/l-wiz.cc
+++ b/crawl-ref/source/l-wiz.cc
@@ -30,7 +30,7 @@ module "crawl"
LUAFN(wiz_quick_fsim)
{
- // quick and dirty, get av effective damage. Will crash if
+ // quick and dirty, get av effective damage. Will crash if
// monster can't be placed.
string mon_name = luaL_checkstring(ls, 1);
monster_type mtype = get_monster_by_name(mon_name, true);
@@ -43,7 +43,7 @@ LUAFN(wiz_quick_fsim)
Options.fsim_mons = mon_name;
Options.fsim_rounds = fsim_rounds;
-
+
fight_data fdata = wizard_quick_fsim_raw(false);
PLUARET(number, fdata.av_eff_dam);
}
@@ -60,4 +60,4 @@ void dluaopen_wiz(lua_State *ls)
luaL_openlib(ls, "wiz", wiz_dlib, 0);
}
-#endif
\ No newline at end of file
+#endif
diff --git a/crawl-ref/source/test/fsim.lua b/crawl-ref/source/test/fsim.lua
index da6ef49..a915fc9 100644
--- a/crawl-ref/source/test/fsim.lua
+++ b/crawl-ref/source/test/fsim.lua
@@ -2,29 +2,29 @@
local eol = string.char(13)
local function fsim_test()
- return wiz.quick_fsim("stone giant", 5000)
+ return wiz.quick_fsim("stone giant", 5000)
end
local function fsim_setup()
- you.init("mifi", "morningstar")
- you.set_xl(20)
- debug.flush_map_memory()
- debug.goto_place("D:1")
- debug.generate_level()
- dgn.grid(2, 2, "floor")
- dgn.grid(2, 3, "floor")
- you.moveto(2, 2)
+ you.init("mifi", "morningstar")
+ you.set_xl(20)
+ debug.flush_map_memory()
+ debug.goto_place("D:1")
+ debug.generate_level()
+ dgn.grid(2, 2, "floor")
+ dgn.grid(2, 3, "floor")
+ you.moveto(2, 2)
end
local function fsim_cleanup()
- you.set_xl(1)
+ you.set_xl(1)
end
if you.wizard then
- fsim_setup()
- for i = 1,10 do
- result = fsim_test()
- crawl.stderr("AvEffDam is " .. result .. eol)
- end
- fsim_cleanup()
-end
\ No newline at end of file
+ fsim_setup()
+ for i = 1,10 do
+ result = fsim_test()
+ crawl.stderr("AvEffDam is " .. result .. eol)
+ end
+ fsim_cleanup()
+end
diff --git a/crawl-ref/source/test/mutation.lua b/crawl-ref/source/test/mutation.lua
index 954a6b4..b065443 100644
--- a/crawl-ref/source/test/mutation.lua
+++ b/crawl-ref/source/test/mutation.lua
@@ -124,7 +124,7 @@ local function test_potion(tries, iterations, premutate)
"Clearing mutations failed, currently: " .. you.mutation_overview())
for i=1, premutate do
-- note: won't guarantee `premutate` mutations, because some will
- -- cancel each other out. This tops out at around 10 mutation
+ -- cancel each other out. This tops out at around 10 mutation
-- levels by this method.
give_random_mutation(0.0)
end
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index e027425..bf7370b 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -2554,6 +2554,9 @@ static int _target_distance_from(const coord_def &pos)
* This function relies on the travel_point_distance array being correctly
* populated with a floodout call to find_travel_pos starting from the player's
* location.
+ *
+ * This function has undefined behavior when the target position is not
+ * traversable.
*/
static int _find_transtravel_stair(const level_id &cur,
const level_pos &target,
@@ -2785,9 +2788,20 @@ static bool _find_transtravel_square(const level_pos &target, bool verbose)
find_travel_pos(you.pos(), nullptr, nullptr, nullptr);
- _find_transtravel_stair(current, target,
- 0, cur_stair, closest_level,
- best_level_distance, best_stair);
+ // either off-level, or traversable and on-level
+ // TODO: actually check this when the square is off-level? The current
+ // behavior is that it will go to the level and then fail.
+ const bool maybe_traversable = (target.id != current
+ || feat_is_traversable_now(env.map_knowledge(target.pos).feat()));
+
+ if (maybe_traversable)
+ {
+ _find_transtravel_stair(current, target,
+ 0, cur_stair, closest_level,
+ best_level_distance, best_stair);
+ }
+ // even without _find_transtravel_stair called, the values are initalized
+ // enough for the rest of this to go forward.
if (best_stair.x != -1 && best_stair.y != -1)
{
@@ -2840,7 +2854,10 @@ static bool _find_transtravel_square(const level_pos &target, bool verbose)
if (target.id != current
|| target.pos.x != -1 && target.pos != you.pos())
{
- mpr("Sorry, I don't know how to get there.");
+ if (!maybe_traversable)
+ mpr("Sorry, I don't know how to traverse that place.");
+ else
+ mpr("Sorry, I don't know how to get there.");
}
}
--
Dungeon Crawl Stone Soup
|