summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-21 19:19:01 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-21 19:19:01 +0000
commit0fdc8a1b6c767621ecd18567d62ab24f9a104510 (patch)
tree9af4f04217f1c291536ddcd87c26a05e1e9205d3
parent1be8dfb3f21190bd60d27a8fc37259d9ada9304b (diff)
downloadcrawl-ref-0fdc8a1b6c767621ecd18567d62ab24f9a104510.tar.gz
crawl-ref-0fdc8a1b6c767621ecd18567d62ab24f9a104510.zip
Xom doesn't even attempt to do the teleportation journey if the player
is wearing a randart that prevents teleportation. Spells don't face any such restriction seeing as the direct call of your_spells() bypasses the randart check. Also, a few more spacing cleanups. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9673 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/output.cc2
-rw-r--r--crawl-ref/source/stuff.cc6
-rw-r--r--crawl-ref/source/xom.cc8
3 files changed, 11 insertions, 5 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 7838ce124d..a46f9daebf 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -2072,7 +2072,7 @@ static std::vector<formatted_string> _get_overview_resistances(
_determine_colour_string(rclar, 1), itosym1(rclar));
cols.add_formatted(1, buf, false);
- if ( scan_randarts(RAP_PREVENT_TELEPORTATION, calc_unid) )
+ if (scan_randarts(RAP_PREVENT_TELEPORTATION, calc_unid))
{
snprintf(buf, sizeof buf, "\n%sPrev.Telep.: %s",
_determine_colour_string(-1, 1), itosym1(1));
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 9413dd1460..903c73d6f3 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -149,7 +149,7 @@ rectangle_iterator::rectangle_iterator( int x_border_dist, int y_border_dist )
rectangle_iterator::operator bool() const
{
- return !(current.y > bottomright.y);
+ return (current.y <= bottomright.y);
}
coord_def rectangle_iterator::operator *() const
@@ -164,7 +164,7 @@ const coord_def* rectangle_iterator::operator->() const
rectangle_iterator& rectangle_iterator::operator ++()
{
- if ( current.x == bottomright.x )
+ if (current.x == bottomright.x)
{
current.x = topleft.x;
current.y++;
@@ -681,10 +681,8 @@ int random2limit(int max, int limit)
return (0);
for (i = 0; i < max; i++)
- {
if (random2(limit) >= i)
sum++;
- }
return (sum);
}
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index bf0ff04478..47f5ef2293 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -1667,6 +1667,10 @@ static bool _xom_is_good(int sever, int tension)
}
else if (x_chance_in_y(11, sever) && you.level_type != LEVEL_ABYSS)
{
+ // Try something else if teleportation is impossible.
+ if (scan_randarts(RAP_PREVENT_TELEPORTATION))
+ return (false);
+
// This is not very interesting if the level is already fully
// explored (presumably cleared). Even then, it may occasionally
// happen.
@@ -2662,6 +2666,10 @@ static bool _xom_is_bad(int sever, int tension)
}
else if (x_chance_in_y(7, sever) && you.level_type != LEVEL_ABYSS)
{
+ // Try something else if teleportation is impossible.
+ if (scan_randarts(RAP_PREVENT_TELEPORTATION))
+ return (false);
+
// This is not particularly exciting if the level is already fully
// explored (presumably cleared). If Xom is feeling nasty this
// is likelier to happen if the level is unexplored.