summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-17 17:38:36 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-17 17:38:36 +0000
commit23c5277317de657f8376d1b5f33144948a811a42 (patch)
treede39ce9e4c369e1f42ddf291695d25b1c5c44c55
parenta9a5ce7479fc6358f96aadad9654d35f2a573782 (diff)
downloadcrawl-ref-23c5277317de657f8376d1b5f33144948a811a42.tar.gz
crawl-ref-23c5277317de657f8376d1b5f33144948a811a42.zip
[1738010] Stash-tracker now also tracks traps and other dungeon features.
Changed env.grid to dungeon_feature_type. (The special-level builder still stores map characters directly into env.grid and then translates them to features.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1592 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/abyss.cc6
-rw-r--r--crawl-ref/source/acr.cc22
-rw-r--r--crawl-ref/source/debug.cc3
-rw-r--r--crawl-ref/source/decks.cc6
-rw-r--r--crawl-ref/source/delay.cc1
-rw-r--r--crawl-ref/source/direct.cc84
-rw-r--r--crawl-ref/source/direct.h3
-rw-r--r--crawl-ref/source/dungeon.cc240
-rw-r--r--crawl-ref/source/dungeon.h2
-rw-r--r--crawl-ref/source/externs.h4
-rw-r--r--crawl-ref/source/item_use.cc6
-rw-r--r--crawl-ref/source/items.cc6
-rw-r--r--crawl-ref/source/maps.cc2
-rw-r--r--crawl-ref/source/misc.cc36
-rw-r--r--crawl-ref/source/misc.h27
-rw-r--r--crawl-ref/source/mon-util.cc4
-rw-r--r--crawl-ref/source/monstuff.cc2
-rw-r--r--crawl-ref/source/monstuff.h2
-rw-r--r--crawl-ref/source/mstuff2.cc3
-rw-r--r--crawl-ref/source/overmap.cc52
-rw-r--r--crawl-ref/source/overmap.h4
-rw-r--r--crawl-ref/source/player.cc8
-rw-r--r--crawl-ref/source/spells4.cc2
-rw-r--r--crawl-ref/source/stash.cc105
-rw-r--r--crawl-ref/source/stash.h7
-rw-r--r--crawl-ref/source/stuff.cc17
-rw-r--r--crawl-ref/source/stuff.h1
-rw-r--r--crawl-ref/source/tags.cc10
-rw-r--r--crawl-ref/source/travel.cc25
-rw-r--r--crawl-ref/source/travel.h4
-rw-r--r--crawl-ref/source/view.cc9
-rw-r--r--crawl-ref/source/view.h4
32 files changed, 386 insertions, 321 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 2b881855ba..47d05a4a8f 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -68,7 +68,7 @@ static void generate_area(unsigned char gx1, unsigned char gy1,
int temp_rand; // probability determination {dlb}
- FixedVector < unsigned char, 5 > replaced;
+ FixedVector<dungeon_feature_type, 5> replaced;
// nuke map
env.map.init(map_cell());
@@ -171,7 +171,9 @@ static void generate_area(unsigned char gx1, unsigned char gy1,
{
do
{
- grd[i][j] = DNGN_ALTAR_ZIN + random2(12);
+ grd[i][j] =
+ static_cast<dungeon_feature_type>(
+ DNGN_ALTAR_ZIN + random2(12) );
}
while (grd[i][j] == DNGN_ALTAR_ZIN
|| grd[i][j] == DNGN_ALTAR_SHINING_ONE
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 940954b816..d121b1cef0 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -165,7 +165,6 @@ static void close_door(int move_x, int move_y);
static void prep_input();
static void input();
-static void middle_input();
static void world_reacts();
static command_type get_next_cmd();
static keycode_type get_next_keycode();
@@ -678,7 +677,8 @@ static void handle_wizard_command( void )
get_input_line( specs, sizeof( specs ) );
if (specs[0] != '\0')
- grd[you.x_pos][you.y_pos] = atoi(specs);
+ grd[you.x_pos][you.y_pos] =
+ static_cast<dungeon_feature_type>( atoi(specs) );
break;
case ']':
@@ -890,8 +890,6 @@ static void input()
return;
}
- middle_input();
-
if (need_to_autopickup())
autopickup();
@@ -2180,6 +2178,11 @@ static void check_banished()
static void world_reacts()
{
+ if (Options.stash_tracking)
+ stashes.update_visible_stashes(
+ Options.stash_tracking == STM_ALL?
+ StashTracker::ST_AGGRESSIVE :
+ StashTracker::ST_PASSIVE);
bool its_quiet; //jmf: for silence messages
@@ -2668,15 +2671,6 @@ keycode_type get_next_keycode()
return (keyin);
}
-static void middle_input()
-{
- if (Options.stash_tracking)
- stashes.update_visible_stashes(
- Options.stash_tracking == STM_ALL?
- StashTracker::ST_AGGRESSIVE :
- StashTracker::ST_PASSIVE);
-}
-
/*
Opens doors and handles some aspects of untrapping. If either move_x or
move_y are non-zero, the pair carries a specific direction for the door
@@ -3070,7 +3064,7 @@ static void move_player(int move_x, int move_y)
const int targ_x = you.x_pos + move_x;
const int targ_y = you.y_pos + move_y;
- const unsigned char targ_grid = grd[ targ_x ][ targ_y ];
+ const dungeon_feature_type targ_grid = grd[ targ_x ][ targ_y ];
const unsigned char targ_monst = mgrd[ targ_x ][ targ_y ];
const bool targ_solid = grid_is_solid(targ_grid);
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 98a0a85542..0bf048d311 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1404,7 +1404,8 @@ void debug_get_religion(void)
mpr( "That god doesn't seem to be taking followers today." );
else
{
- grd[you.x_pos][you.y_pos] = 179 + god;
+ grd[you.x_pos][you.y_pos] =
+ static_cast<dungeon_feature_type>( DNGN_ALTAR_ZIN + god - 1 );
god_pitch(god);
}
} // end debug_add_skills()
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 1015ae6594..62042cfb2b 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -972,12 +972,14 @@ void card_effect(card_type which_card)
}
else
{
- dvar1 = 179 + you.religion;
+ const dungeon_feature_type altar =
+ static_cast<dungeon_feature_type>(
+ DNGN_ALTAR_ZIN + you.religion - 1 );
mprf("An altar grows from the floor %s!",
(you.species == SP_NAGA || you.species == SP_CENTAUR)
? "before you" : "at your feet");
- grd[you.x_pos][you.y_pos] = dvar1;
+ grd[you.x_pos][you.y_pos] = altar;
}
break;
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index b0698284b5..a993b30b71 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -40,6 +40,7 @@
#include "stuff.h"
#include "travel.h"
#include "tutorial.h"
+#include "view.h"
extern std::vector<SelItem> items_for_multidrop;
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc
index 62a445b2fa..5b2ebf3f55 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/direct.cc
@@ -1196,7 +1196,8 @@ std::vector<dungeon_feature_type> features_by_desc(const text_pattern &pattern)
{
for (int i = 0; i < NUM_FEATURES; ++i)
{
- std::string fdesc = feature_description(i);
+ std::string fdesc =
+ feature_description(static_cast<dungeon_feature_type>(i));
if (fdesc.empty())
continue;
@@ -1240,8 +1241,39 @@ void describe_floor()
mpr("Beware, for starvation awaits!");
}
-std::string feature_description(int grid)
+std::string feature_description(dungeon_feature_type grid,
+ trap_type trap)
{
+ if (grid_is_trap(grid) && trap != NUM_TRAPS)
+ {
+ switch (trap)
+ {
+ case TRAP_DART:
+ return ("A dart trap.");
+ case TRAP_ARROW:
+ return ("An arrow trap.");
+ case TRAP_SPEAR:
+ return ("A spear trap.");
+ case TRAP_AXE:
+ return ("An axe trap.");
+ case TRAP_TELEPORT:
+ return ("A teleportation trap.");
+ case TRAP_AMNESIA:
+ return ("An amnesia trap.");
+ case TRAP_BLADE:
+ return ("A blade trap.");
+ case TRAP_BOLT:
+ return ("A bolt trap.");
+ case TRAP_ZOT:
+ return ("A Zot trap.");
+ case TRAP_NEEDLE:
+ return ("A needle trap.");
+ default:
+ error_message_to_player();
+ return ("An undefined trap.");
+ }
+ }
+
switch (grid)
{
case DNGN_STONE_WALL:
@@ -1423,57 +1455,13 @@ std::string feature_description(int grid)
std::string feature_description(int mx, int my)
{
- const int grid = grd[mx][my];
+ const dungeon_feature_type grid = grd[mx][my];
switch (grid)
{
case DNGN_TRAP_MECHANICAL:
case DNGN_TRAP_MAGICAL:
case DNGN_TRAP_III:
- {
- int trf;
- for (trf = 0; trf < MAX_TRAPS; trf++)
- {
- if (env.trap[trf].x == mx
- && env.trap[trf].y == my)
- {
- break;
- }
-
- if (trf == MAX_TRAPS - 1)
- {
- mpr("Error - couldn't find that trap.");
- error_message_to_player();
- break;
- }
- }
-
- switch (env.trap[trf].type)
- {
- case TRAP_DART:
- return ("A dart trap.");
- case TRAP_ARROW:
- return ("An arrow trap.");
- case TRAP_SPEAR:
- return ("A spear trap.");
- case TRAP_AXE:
- return ("An axe trap.");
- case TRAP_TELEPORT:
- return ("A teleportation trap.");
- case TRAP_AMNESIA:
- return ("An amnesia trap.");
- case TRAP_BLADE:
- return ("A blade trap.");
- case TRAP_BOLT:
- return ("A bolt trap.");
- case TRAP_ZOT:
- return ("A Zot trap.");
- case TRAP_NEEDLE:
- return ("A needle trap.");
- default:
- error_message_to_player();
- return ("An undefined trap.");
- }
- }
+ return feature_description(grid, trap_type_at_xy(mx, my));
case DNGN_ENTER_SHOP:
return (shop_name(mx, my));
default:
diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h
index c2f808d3a8..8f2c243955 100644
--- a/crawl-ref/source/direct.h
+++ b/crawl-ref/source/direct.h
@@ -38,7 +38,8 @@ void describe_floor();
int dos_direction_unmunge(int doskey);
std::string feature_description(int mx, int my);
-std::string feature_description(int grid);
+std::string feature_description(dungeon_feature_type grid,
+ trap_type tr = NUM_TRAPS);
std::vector<dungeon_feature_type> features_by_desc(const text_pattern &pattern);
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 748048a9aa..2c9a31b02e 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -82,11 +82,15 @@ struct spec_room
static void build_dungeon_level(int level_number, int level_type);
static bool valid_dungeon_level(int level_number, int level_type);
-static bool find_in_area(int sx, int sy, int ex, int ey, unsigned char feature);
+static bool find_in_area(int sx, int sy, int ex, int ey,
+ dungeon_feature_type feature);
static bool make_box(int room_x1, int room_y1, int room_x2, int room_y2,
- unsigned char floor=0, unsigned char wall=0, unsigned char avoid=0);
-static void replace_area(int sx, int sy, int ex, int ey, unsigned char replace,
- unsigned char feature);
+ dungeon_feature_type floor=DNGN_UNSEEN,
+ dungeon_feature_type wall=DNGN_UNSEEN,
+ dungeon_feature_type avoid=DNGN_UNSEEN);
+static void replace_area(int sx, int sy, int ex, int ey,
+ dungeon_feature_type replace,
+ dungeon_feature_type feature);
static builder_rc_type builder_by_type(int level_number, char level_type);
static builder_rc_type builder_by_branch(int level_number);
static builder_rc_type builder_normal(int level_number, char level_type, spec_room &s);
@@ -94,7 +98,9 @@ static builder_rc_type builder_basic(int level_number);
static void builder_extras(int level_number, int level_type);
static void builder_items(int level_number, char level_type, int items_wanted);
static void builder_monsters(int level_number, char level_type, int mon_wanted);
-static void place_specific_stair(int stair, const std::string &tag = "", int dl = 0);
+static void place_specific_stair(dungeon_feature_type stair,
+ const std::string &tag = "",
+ int dl = 0);
static void place_branch_entrances(int dlevel, char level_type);
static void place_special_minivaults(int level_number, int level_type);
static void place_traps( int level_number );
@@ -103,21 +109,23 @@ static void prepare_shoals();
static void prepare_water( int level_number );
static void check_doors();
static void hide_doors();
-static void make_trail(int xs, int xr, int ys, int yr,int corrlength, int intersect_chance,
- int no_corr, unsigned char begin, unsigned char end=0);
+static void make_trail(int xs, int xr, int ys, int yr,int corrlength,
+ int intersect_chance,
+ int no_corr, dungeon_feature_type begin,
+ dungeon_feature_type end=DNGN_UNSEEN);
static bool make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel);
-static void place_pool(unsigned char pool_type, unsigned char pool_x1,
+static void place_pool(dungeon_feature_type pool_type, unsigned char pool_x1,
unsigned char pool_y1, unsigned char pool_x2,
unsigned char pool_y2);
-static void many_pools(unsigned char pool_type);
+static void many_pools(dungeon_feature_type pool_type);
static bool join_the_dots(
const coord_def &from,
const coord_def &to,
const dgn_region_list &forbidden,
bool early_exit = false);
-static void build_river(unsigned char river_type); //mv
-static void build_lake(unsigned char lake_type); //mv
+static void build_river(dungeon_feature_type river_type); //mv
+static void build_lake(dungeon_feature_type lake_type); //mv
static void spotty_level(bool seeded, int iterations, bool boxy);
static void bigger_room();
@@ -126,12 +134,14 @@ static char plan_1();
static char plan_2();
static char plan_3();
static char plan_4(char forbid_x1, char forbid_y1, char forbid_x2,
- char forbid_y2, unsigned char force_wall);
+ char forbid_y2, dungeon_feature_type force_wall);
static char plan_5();
static char plan_6(int level_number);
-static bool octa_room(spec_room &sr, int oblique_max, unsigned char type_floor);
+static bool octa_room(spec_room &sr, int oblique_max,
+ dungeon_feature_type type_floor);
static void labyrinth_level(int level_number);
-static void box_room(int bx1, int bx2, int by1, int by2, int wall_type);
+static void box_room(int bx1, int bx2, int by1, int by2,
+ dungeon_feature_type wall_type);
static int box_room_doors( int bx1, int bx2, int by1, int by2, int new_doors);
static void city_level(int level_number);
static void diamond_rooms(int level_number);
@@ -143,8 +153,9 @@ static bool treasure_area(int level_number, unsigned char ta1_x,
unsigned char ta2_x, unsigned char ta1_y,
unsigned char ta2_y);
static void big_room(int level_number);
-static void chequerboard(spec_room &sr, unsigned char target,
- unsigned char floor1, unsigned char floor2);
+static void chequerboard(spec_room &sr, dungeon_feature_type target,
+ dungeon_feature_type floor1,
+ dungeon_feature_type floor2);
static void roguey_level(int level_number, spec_room &sr);
static void morgue(spec_room &sr);
@@ -283,7 +294,7 @@ bool feature_find::path_flood(const coord_def &c, const coord_def &dc)
if (!in_bounds(dc))
return (false);
- const int grid = grd(dc);
+ const dungeon_feature_type grid = grd(dc);
if (needed_features[ grid ])
{
unexplored_place = dc;
@@ -445,7 +456,7 @@ static void fixup_walls()
|| player_in_branch( BRANCH_CRYPT ))
{
// always the case with Dis {dlb}
- unsigned char vault_wall = DNGN_METAL_WALL;
+ dungeon_feature_type vault_wall = DNGN_METAL_WALL;
if (player_in_branch( BRANCH_VAULTS ))
{
@@ -644,7 +655,8 @@ static void hide_doors()
} // end hide_doors()
// Places a randomized ellipse with centre (x,y) and half axes a and b
-static void place_ellipse(int x, int y, int a, int b, int feat, int margin)
+static void place_ellipse(int x, int y, int a, int b,
+ dungeon_feature_type feat, int margin)
{
for (int i = std::max(x-a,margin); i < std::min(x+a,GXM-margin); ++i)
for (int j = std::max(y-b,margin); j < std::min(y+b, GYM-margin); ++j)
@@ -665,7 +677,8 @@ static int count_neighbours(int x, int y, int feat)
}
static void replace_in_grid(int x1, int y1, int x2, int y2,
- int oldfeat, int newfeat)
+ dungeon_feature_type oldfeat,
+ dungeon_feature_type newfeat)
{
for ( int x = x1; x < x2; ++x )
for ( int y = y1; y < y2; ++y )
@@ -885,13 +898,17 @@ static void prepare_shoals()
x = random2(GXM);
y = random2(GYM);
} while ( grd[x][y] != DNGN_FLOOR );
- grd[x][y] = DNGN_STONE_STAIRS_DOWN_I + i;
+ grd[x][y] =
+ static_cast<dungeon_feature_type>(
+ DNGN_STONE_STAIRS_DOWN_I + i );
do {
x = random2(GXM);
y = random2(GYM);
} while ( grd[x][y] != DNGN_FLOOR );
- grd[x][y] = DNGN_STONE_STAIRS_UP_I + i;
+ grd[x][y] =
+ static_cast<dungeon_feature_type>(
+ DNGN_STONE_STAIRS_UP_I + i);
}
}
}
@@ -970,7 +987,8 @@ static void prepare_water( int level_number )
}
} // end prepare_water()
-static bool find_in_area(int sx, int sy, int ex, int ey, unsigned char feature)
+static bool find_in_area(int sx, int sy, int ex, int ey,
+ dungeon_feature_type feature)
{
int x,y;
@@ -993,7 +1011,9 @@ static bool find_in_area(int sx, int sy, int ex, int ey, unsigned char feature)
// be different (or not stamped at all)
// Note that the box boundaries are INclusive.
static bool make_box(int room_x1, int room_y1, int room_x2, int room_y2,
- unsigned char floor, unsigned char wall, unsigned char avoid)
+ dungeon_feature_type floor,
+ dungeon_feature_type wall,
+ dungeon_feature_type avoid)
{
int bx,by;
@@ -1416,8 +1436,9 @@ static void builder_extras( int level_number, int level_type )
//mv: it's better to be here so other dungeon features
// are not overriden by water
- int river_type = one_chance_in( 5 + level_number ) ? DNGN_SHALLOW_WATER
- : DNGN_DEEP_WATER;
+ dungeon_feature_type river_type =
+ one_chance_in( 5 + level_number ) ? DNGN_SHALLOW_WATER
+ : DNGN_DEEP_WATER;
if (level_number > 11
&& (one_chance_in(5) || (level_number > 15 && !one_chance_in(5))))
@@ -1454,41 +1475,41 @@ static void builder_extras( int level_number, int level_type )
}
// Also checks you.where_are_you!
-static int random_trap_for_level(int level_number)
+static trap_type random_trap_for_level(int level_number)
{
- int trap_type = TRAP_DART;
+ trap_type type = TRAP_DART;
if ((random2(1 + level_number) > 1) && one_chance_in(4))
- trap_type = TRAP_NEEDLE;
+ type = TRAP_NEEDLE;
if (random2(1 + level_number) > 3)
- trap_type = TRAP_SPEAR;
+ type = TRAP_SPEAR;
if (random2(1 + level_number) > 5)
- trap_type = TRAP_AXE;
+ type = TRAP_AXE;
// Note we're boosting arrow trap numbers by moving it
// down the list, and making spear and axe traps rarer.
- if (trap_type == TRAP_DART?
+ if (type == TRAP_DART?
random2(1 + level_number) > 2
: one_chance_in(7))
- trap_type = TRAP_ARROW;
+ type = TRAP_ARROW;
if (random2(1 + level_number) > 7)
- trap_type = TRAP_BOLT;
+ type = TRAP_BOLT;
if (random2(1 + level_number) > 11)
- trap_type = TRAP_BLADE;
+ type = TRAP_BLADE;
if ((random2(1 + level_number) > 14 && one_chance_in(3))
|| (player_in_branch( BRANCH_HALL_OF_ZOT ) && coinflip()))
{
- trap_type = TRAP_ZOT;
+ type = TRAP_ZOT;
}
if (one_chance_in(20))
- trap_type = TRAP_TELEPORT;
+ type = TRAP_TELEPORT;
if (one_chance_in(40))
- trap_type = TRAP_AMNESIA;
+ type = TRAP_AMNESIA;
- return (trap_type);
+ return (type);
}
static void place_traps(int level_number)
@@ -1509,14 +1530,14 @@ static void place_traps(int level_number)
}
while (grd[env.trap[i].x][env.trap[i].y] != DNGN_FLOOR);
- unsigned char &trap_type = env.trap[i].type;
+ trap_type &trap_type = env.trap[i].type;
trap_type = random_trap_for_level(level_number);
grd[env.trap[i].x][env.trap[i].y] = DNGN_UNDISCOVERED_TRAP;
} // end "for i"
} // end place_traps()
-static void place_specific_feature(int feat)
+static void place_specific_feature(dungeon_feature_type feat)
{
int sx, sy;
@@ -1530,7 +1551,9 @@ static void place_specific_feature(int feat)
grd[sx][sy] = feat;
}
-static void place_specific_stair(int stair, const std::string &tag, int dlevel)
+static void place_specific_stair(dungeon_feature_type stair,
+ const std::string &tag,
+ int dlevel)
{
if (tag.empty() || !place_portal_vault(stair, tag, dlevel))
place_specific_feature(stair);
@@ -1600,8 +1623,9 @@ static void place_branch_entrances(int dlevel, char level_type)
}
static void make_trail(int xs, int xr, int ys, int yr, int corrlength,
- int intersect_chance, int no_corr, unsigned char begin,
- unsigned char end)
+ int intersect_chance, int no_corr,
+ dungeon_feature_type begin,
+ dungeon_feature_type end)
{
int x_start, y_start; // begin point
int x_ps, y_ps; // end point
@@ -1623,7 +1647,7 @@ static void make_trail(int xs, int xr, int ys, int yr, int corrlength,
&& grd[x_start][y_start] != DNGN_FLOOR);
// assign begin feature
- if (begin != 0)
+ if (begin != DNGN_UNSEEN)
grd[x_start][y_start] = begin;
x_ps = x_start;
y_ps = y_start;
@@ -1750,7 +1774,7 @@ static void make_trail(int xs, int xr, int ys, int yr, int corrlength,
while (finish < no_corr);
// assign end feature
- if (end != 0)
+ if (end != DNGN_UNSEEN)
grd[x_ps][y_ps] = end;
}
@@ -2604,7 +2628,9 @@ static void build_minivaults(int level_number, int force_vault)
{
// [dshaligram] vault_main always populates vgrid[y][x] instead of
// vgrid[x][y] now.
- grd[vx][vy] = vgrid[vy - v1y][vx - v1x];
+ grd[vx][vy] =
+ static_cast<dungeon_feature_type>(
+ vgrid[vy - v1y][vx - v1x] );
}
}
@@ -3098,8 +3124,10 @@ static bool build_vaults(int level_number, int force_vault, int rune_subst,
{
for (int i = 0; i < 2; i++)
{
- const int stair = j + ((i == 0) ? DNGN_STONE_STAIRS_DOWN_I
- : DNGN_STONE_STAIRS_UP_I);
+ const dungeon_feature_type stair =
+ static_cast<dungeon_feature_type>(
+ j + ((i == 0) ? DNGN_STONE_STAIRS_DOWN_I
+ : DNGN_STONE_STAIRS_UP_I));
if (stair_exist[stair - DNGN_STONE_STAIRS_DOWN_I] == 1)
continue;
@@ -3208,7 +3236,7 @@ static bool dngn_place_monster(
if (mons_is_unique(mid) && you.unique_creatures[mid])
return (false);
- const int habitat = monster_habitat(mid);
+ const dungeon_feature_type habitat = monster_habitat(mid);
if (habitat != DNGN_FLOOR)
grd[vx][vy] = habitat;
}
@@ -3272,7 +3300,7 @@ static int vault_grid( vault_placement &place,
const feature_spec f = mapsp->get_feat();
if (f.feat >= 0)
{
- grd[vx][vy] = f.feat;
+ grd[vx][vy] = static_cast<dungeon_feature_type>( f.feat );
vgrid = -1;
}
else if (f.glyph >= 0)
@@ -3286,9 +3314,9 @@ static int vault_grid( vault_placement &place,
place_spec_shop(level_number, vx, vy, f.shop);
else if (f.trap >= 0)
{
- const int trap =
+ const trap_type trap =
f.trap == TRAP_INDEPTH? random_trap_for_level(level_number)
- : f.trap;
+ : static_cast<trap_type>(f.trap);
place_specific_trap(vx, vy, trap);
}
@@ -3312,7 +3340,7 @@ static int vault_grid( vault_placement &place,
}
// first, set base tile for grids {dlb}:
- const int grid =
+ const dungeon_feature_type grid =
grd[vx][vy] =
((vgrid == -1) ? grd[vx][vy] :
(vgrid == 'x') ? DNGN_ROCK_WALL :
@@ -3335,7 +3363,9 @@ static int vault_grid( vault_placement &place,
(vgrid == ']') ? DNGN_STONE_STAIRS_DOWN_III :
(vgrid == '[') ? DNGN_STONE_STAIRS_UP_III :
(vgrid == 'A') ? DNGN_STONE_ARCH :
- (vgrid == 'B') ? (DNGN_ALTAR_ZIN + altar_count) :// see below
+ (vgrid == 'B') ?
+ static_cast<dungeon_feature_type>(
+ DNGN_ALTAR_ZIN + altar_count) :// see below
(vgrid == 'C') ? pick_an_altar() : // f(x) elsewhere {dlb}
(vgrid == 'F') ? DNGN_GRANITE_STATUE :
(vgrid == 'I') ? DNGN_ORCISH_IDOL :
@@ -3423,7 +3453,7 @@ static int vault_grid( vault_placement &place,
{
if (rune_subst != -1)
{
- grd[vx][vy] = rune_subst;
+ grd[vx][vy] = static_cast<dungeon_feature_type>(rune_subst);
break;
}
@@ -3511,8 +3541,9 @@ static int vault_grid( vault_placement &place,
return (altar_count);
} // end vault_grid()
-static void replace_area(int sx, int sy, int ex, int ey, unsigned char replace,
- unsigned char feature)
+static void replace_area(
+ int sx, int sy, int ex, int ey, dungeon_feature_type replace,
+ dungeon_feature_type feature)
{
int x,y;
for(x=sx; x<=ex; x++)
@@ -3598,7 +3629,7 @@ static bool join_the_dots(
return (at == to);
} // end join_the_dots()
-static void place_pool(unsigned char pool_type, unsigned char pool_x1,
+static void place_pool(dungeon_feature_type pool_type, unsigned char pool_x1,
unsigned char pool_y1, unsigned char pool_x2,
unsigned char pool_y2)
{
@@ -3651,7 +3682,7 @@ static void place_pool(unsigned char pool_type, unsigned char pool_x1,
}
} // end place_pool()
-static void many_pools(unsigned char pool_type)
+static void many_pools(dungeon_feature_type pool_type)
{
int pools = 0;
int i = 0, j = 0, k = 0, l = 0;
@@ -4063,7 +4094,7 @@ static void spotty_level(bool seeded, int iterations, bool boxy)
while (grd[j][k] != DNGN_ROCK_WALL
&& grd[j + 1][k] != DNGN_ROCK_WALL);
- grd[j][k] = i;
+ grd[j][k] = static_cast<dungeon_feature_type>(i);
// creating elevators
if (i == DNGN_STONE_STAIRS_DOWN_I
@@ -4160,8 +4191,10 @@ static void bigger_room()
{
for (i = 0; i < 2; i++)
{
- place_specific_stair( j + ((i==0) ? DNGN_STONE_STAIRS_DOWN_I
- : DNGN_STONE_STAIRS_UP_I) );
+ place_specific_stair(
+ static_cast<dungeon_feature_type>(
+ j + ((i==0) ? DNGN_STONE_STAIRS_DOWN_I
+ : DNGN_STONE_STAIRS_UP_I) ) );
}
}
} // end bigger_room()
@@ -4175,8 +4208,8 @@ static void plan_main(int level_number, char force_plan)
// 2 - no stairs
// 3 - no stairs, do spotty
char do_stairs = 0;
- unsigned char special_grid = (one_chance_in(3) ? DNGN_METAL_WALL
- : DNGN_STONE_WALL);
+ dungeon_feature_type special_grid = (one_chance_in(3) ? DNGN_METAL_WALL
+ : DNGN_STONE_WALL);
int i,j;
if (!force_plan)
@@ -4185,7 +4218,7 @@ static void plan_main(int level_number, char force_plan)
do_stairs = ((force_plan == 1) ? plan_1() :
(force_plan == 2) ? plan_2() :
(force_plan == 3) ? plan_3() :
- (force_plan == 4) ? plan_4(0, 0, 0, 0, 99) :
+ (force_plan == 4) ? plan_4(0, 0, 0, 0, NUM_FEATURES) :
(force_plan == 5) ? (one_chance_in(9) ? plan_5()
: plan_3()) :
(force_plan == 6) ? plan_6(level_number)
@@ -4202,8 +4235,10 @@ static void plan_main(int level_number, char force_plan)
{
for (i = 0; i < 2; i++)
{
- place_specific_stair( j + ((i==0) ? DNGN_STONE_STAIRS_DOWN_I
- : DNGN_STONE_STAIRS_UP_I) );
+ place_specific_stair(
+ static_cast<dungeon_feature_type>(
+ j + ((i==0) ? DNGN_STONE_STAIRS_DOWN_I
+ : DNGN_STONE_STAIRS_UP_I) ) );
}
}
}
@@ -4267,9 +4302,10 @@ static char plan_1()
temp_rand = random2(7);
- unsigned char floor_type = ((temp_rand > 1) ? DNGN_FLOOR : // 5/7
- (temp_rand > 0) ? DNGN_DEEP_WATER// 1/7
- : DNGN_LAVA); // 1/7
+ dungeon_feature_type floor_type =
+ ((temp_rand > 1) ? DNGN_FLOOR : // 5/7
+ (temp_rand > 0) ? DNGN_DEEP_WATER// 1/7
+ : DNGN_LAVA); // 1/7
octa_room(sr, oblique_max, floor_type);
}
}
@@ -4390,13 +4426,13 @@ static char plan_3()
} // end plan_3()
static char plan_4(char forbid_x1, char forbid_y1, char forbid_x2,
- char forbid_y2, unsigned char force_wall)
+ char forbid_y2, dungeon_feature_type force_wall)
{
// a more chaotic version of city level
int temp_rand; // req'd for probability checking
int number_boxes = 5000;
- unsigned char drawing = DNGN_ROCK_WALL;
+ dungeon_feature_type drawing = DNGN_ROCK_WALL;
char b1x, b1y, b2x, b2y;
char cnx, cny;
int i;
@@ -4409,7 +4445,7 @@ static char plan_4(char forbid_x1, char forbid_y1, char forbid_x2,
(temp_rand > 0) ? 2000 // odds: 8 in 81 {dlb}
: 1000); // odds: 1 in 81 {dlb}
- if (force_wall != 99)
+ if (force_wall != NUM_FEATURES)
drawing = force_wall;
else
{
@@ -4455,7 +4491,7 @@ static char plan_4(char forbid_x1, char forbid_y1, char forbid_x2,
}
}
- if (force_wall == 99)
+ if (force_wall == NUM_FEATURES)
{
// NB: comparison reversal here - combined
temp_rand = random2(1200);
@@ -4492,7 +4528,7 @@ static char plan_4(char forbid_x1, char forbid_y1, char forbid_x2,
if (!one_chance_in(4))
oblique_max = 5 + random2(20); // used elsewhere {dlb}
- unsigned char feature = DNGN_FLOOR;
+ dungeon_feature_type feature = DNGN_FLOOR;
if (one_chance_in(10))
feature = coinflip()? DNGN_DEEP_WATER : DNGN_LAVA;
@@ -4573,7 +4609,8 @@ static char plan_6(int level_number)
return 0;
} // end plan_6()
-static bool octa_room(spec_room &sr, int oblique_max, unsigned char type_floor)
+static bool octa_room(spec_room &sr, int oblique_max,
+ dungeon_feature_type type_floor)
{
int x,y;
@@ -4795,8 +4832,9 @@ static void labyrinth_level(int level_number)
link_items();
// turn rock walls into undiggable stone or metal:
- unsigned char wall_xform = ((random2(50) > 10) ? DNGN_STONE_WALL // 78.0%
- : DNGN_METAL_WALL); // 22.0%
+ dungeon_feature_type wall_xform =
+ ((random2(50) > 10) ? DNGN_STONE_WALL // 78.0%
+ : DNGN_METAL_WALL); // 22.0%
replace_area(0,0,GXM-1,GYM-1,DNGN_ROCK_WALL,wall_xform);
@@ -4935,7 +4973,8 @@ static int box_room_doors( int bx1, int bx2, int by1, int by2, int new_doors)
}
-static void box_room(int bx1, int bx2, int by1, int by2, int wall_type)
+static void box_room(int bx1, int bx2, int by1, int by2,
+ dungeon_feature_type wall_type)
{
// hack -- avoid lava in the crypt. {gdl}
if ((player_in_branch( BRANCH_CRYPT ) || player_in_branch( BRANCH_TOMB ))
@@ -4973,8 +5012,10 @@ static void box_room(int bx1, int bx2, int by1, int by2, int wall_type)
static void city_level(int level_number)
{
int temp_rand; // probability determination {dlb}
- int wall_type; // remember, can have many wall types in one level
- int wall_type_room; // simplifies logic of innermost loop {dlb}
+ // remember, can have many wall types in one level
+ dungeon_feature_type wall_type;
+ // simplifies logic of innermost loop {dlb}
+ dungeon_feature_type wall_type_room;
int xs = 0, ys = 0;
int x1 = 0, x2 = 0;
@@ -5036,8 +5077,10 @@ static void city_level(int level_number)
{
for (i = 0; i < 2; i++)
{
- place_specific_stair( j + ((i==0) ? DNGN_STONE_STAIRS_DOWN_I
- : DNGN_STONE_STAIRS_UP_I) );
+ place_specific_stair(
+ static_cast<dungeon_feature_type>(
+ j + ((i==0) ? DNGN_STONE_STAIRS_DOWN_I
+ : DNGN_STONE_STAIRS_UP_I) ) );
}
}
@@ -5084,7 +5127,7 @@ static bool treasure_area(int level_number, unsigned char ta1_x,
static void diamond_rooms(int level_number)
{
char numb_diam = 1 + random2(10);
- char type_floor = DNGN_DEEP_WATER;
+ dungeon_feature_type type_floor = DNGN_DEEP_WATER;
int runthru = 0;
int i, oblique_max;
@@ -5141,8 +5184,8 @@ static void diamond_rooms(int level_number)
static void big_room(int level_number)
{
- unsigned char type_floor = DNGN_FLOOR;
- unsigned char type_2 = DNGN_FLOOR;
+ dungeon_feature_type type_floor = DNGN_FLOOR;
+ dungeon_feature_type type_2 = DNGN_FLOOR;
int i, j, k, l;
spec_room sr;
@@ -5197,7 +5240,7 @@ static void big_room(int level_number)
replace_area(sr.x1, sr.y1, sr.x2, sr.y2, DNGN_CLOSED_DOOR, type_floor);
if (type_floor == DNGN_FLOOR)
- type_2 = DNGN_ROCK_WALL + random2(4);
+ type_2 = static_cast<dungeon_feature_type>(DNGN_ROCK_WALL + random2(4));
// no lava in the Crypt or Tomb, thanks!
if (player_in_branch( BRANCH_CRYPT ) || player_in_branch( BRANCH_TOMB ))
@@ -5243,8 +5286,9 @@ static void big_room(int level_number)
// helper function for chequerboard rooms
// note that box boundaries are INclusive
-static void chequerboard( spec_room &sr, unsigned char target,
- unsigned char floor1, unsigned char floor2 )
+static void chequerboard( spec_room &sr, dungeon_feature_type target,
+ dungeon_feature_type floor1,
+ dungeon_feature_type floor2 )
{
int i, j;
@@ -5384,7 +5428,7 @@ static void roguey_level(int level_number, spec_room &sr)
|| (grd[pos[0]][pos[1] + 1] == DNGN_ROCK_WALL
&& grd[pos[0]][pos[1] - 1] == DNGN_ROCK_WALL))
{
- grd[pos[0]][pos[1]] = 103;
+ grd[pos[0]][pos[1]] = DNGN_GRANITE_STATUE;
}
}
} // end "for bp, for i"
@@ -5433,8 +5477,10 @@ static void roguey_level(int level_number, spec_room &sr)
{
for (i = 0; i < 2; i++)
{
- place_specific_stair(j + ((i==0) ? DNGN_STONE_STAIRS_DOWN_I
- : DNGN_STONE_STAIRS_UP_I));
+ place_specific_stair(
+ static_cast<dungeon_feature_type>(
+ j + ((i==0) ? DNGN_STONE_STAIRS_DOWN_I
+ : DNGN_STONE_STAIRS_UP_I)));
}
}
} // end roguey_level()
@@ -5508,10 +5554,10 @@ static void jelly_pit(int level_number, spec_room &sr)
}
bool place_specific_trap(unsigned char spec_x, unsigned char spec_y,
- unsigned char spec_type)
+ trap_type spec_type)
{
if (spec_type == TRAP_RANDOM)
- spec_type = random2(NUM_TRAPS);
+ spec_type = static_cast<trap_type>( random2(NUM_TRAPS) );
for (int tcount = 0; tcount < MAX_TRAPS; tcount++)
{
@@ -5729,7 +5775,7 @@ void define_zombie( int mid, int ztype, int cs, int power )
menv[mid].colour = mons_class_colour(cs);
} // end define_zombie()
-static void build_river( unsigned char river_type ) //mv
+static void build_river( dungeon_feature_type river_type ) //mv
{
int i,j;
int y, width;
@@ -5779,7 +5825,7 @@ static void build_river( unsigned char river_type ) //mv
}
} // end build_river()
-static void build_lake(unsigned char lake_type) //mv
+static void build_lake(dungeon_feature_type lake_type) //mv
{
int i, j;
int x1, y1, x2, y2;
diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h
index 172cea7061..1cd926125b 100644
--- a/crawl-ref/source/dungeon.h
+++ b/crawl-ref/source/dungeon.h
@@ -94,7 +94,7 @@ void define_zombie(int mid, int ztype, int cs, int power);
bool is_wall(int feature);
bool place_specific_trap(unsigned char spec_x, unsigned char spec_y,
- unsigned char spec_type);
+ trap_type spec_type);
void place_spec_shop(int level_number, unsigned char shop_x,
unsigned char shop_y, unsigned char force_s_type,
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index dfcafa683d..b8571bf5dc 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1129,7 +1129,7 @@ struct trap_struct
{
unsigned char x;
unsigned char y;
- unsigned char type;
+ trap_type type;
};
struct map_cell
@@ -1154,7 +1154,7 @@ struct crawl_environment
FixedVector< item_def, MAX_ITEMS > item; // item list
FixedVector< monsters, MAX_MONSTERS > mons; // monster list
- FixedArray< unsigned char, GXM, GYM > grid; // terrain grid
+ FixedArray<dungeon_feature_type, GXM, GYM> grid; // terrain grid
FixedArray< unsigned char, GXM, GYM > mgrid; // monster grid
FixedArray< int, GXM, GYM > igrid; // item grid
FixedArray< unsigned char, GXM, GYM > cgrid; // cloud grid
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 0d46b33945..ea48262cd1 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2803,6 +2803,9 @@ bool drink_fountain(void)
mpr("You drink the sparkling water.");
break;
+
+ default:
+ break;
}
if (grd[you.x_pos][you.y_pos] == DNGN_SPARKLING_FOUNTAIN)
@@ -2859,6 +2862,9 @@ bool drink_fountain(void)
grd[you.x_pos][you.y_pos] = DNGN_BLUE_FOUNTAIN;
}
break;
+
+ default:
+ break;
}
if (gone_dry)
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 00df6398ee..b493c5c367 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1561,7 +1561,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
canned_msg( MSG_EMPTY_HANDED );
}
- const unsigned char my_grid = grd[you.x_pos][you.y_pos];
+ const dungeon_feature_type my_grid = grd[you.x_pos][you.y_pos];
if ( !grid_destroys_items(my_grid)
&& !copy_item_to_grid( you.inv[item_dropped],
@@ -1841,7 +1841,9 @@ void update_corpses(double elapsedTime)
if (one_chance_in(100))
{
if (grd[cx][cy] > DNGN_SPARKLING_FOUNTAIN)
- grd[cx][cy]--;
+ grd[cx][cy] =
+ static_cast<dungeon_feature_type>(
+ grd[cx][cy] - 1);
}
}
}
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index bc9c9acf27..8d9342175c 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -123,7 +123,7 @@ static bool is_grid_clobbered(int sx, int sy, int width, int height)
{
for (int x = sx; x < sx + width; ++x)
{
- int grid = grd[x][y];
+ const dungeon_feature_type grid = grd[x][y];
if (!grid_is_opaque(grid)
&& grid != DNGN_FLOOR
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 17892065d1..0d611e1d58 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -149,7 +149,7 @@ void turn_corpse_into_chunks( item_def &item )
}
} // end place_chunks()
-bool grid_is_wall( int grid )
+bool grid_is_wall( dungeon_feature_type grid )
{
return (grid == DNGN_ROCK_WALL
|| grid == DNGN_STONE_WALL
@@ -159,12 +159,12 @@ bool grid_is_wall( int grid )
|| grid == DNGN_PERMAROCK_WALL);
}
-bool grid_is_opaque( int grid )
+bool grid_is_opaque( dungeon_feature_type grid )
{
return (grid < MINSEE && grid != DNGN_ORCISH_IDOL);
}
-bool grid_is_solid( int grid )
+bool grid_is_solid( dungeon_feature_type grid )
{
return (grid < MINMOVE);
}
@@ -179,29 +179,29 @@ bool grid_is_solid(const coord_def &c)
return (grid_is_solid(grd(c)));
}
-bool grid_is_trap(int grid)
+bool grid_is_trap(dungeon_feature_type grid)
{
return (grid == DNGN_TRAP_MECHANICAL || grid == DNGN_TRAP_MAGICAL
|| grid == DNGN_TRAP_III);
}
-bool grid_is_water( int grid )
+bool grid_is_water( dungeon_feature_type grid )
{
return (grid == DNGN_SHALLOW_WATER || grid == DNGN_DEEP_WATER);
}
-bool grid_is_watery( int grid )
+bool grid_is_watery( dungeon_feature_type grid )
{
return (grid_is_water(grid) || grid == DNGN_BLUE_FOUNTAIN);
}
-bool grid_destroys_items( int grid )
+bool grid_destroys_items( dungeon_feature_type grid )
{
return (grid == DNGN_LAVA || grid == DNGN_DEEP_WATER);
}
// returns 0 if grid is not an altar, else it returns the GOD_* type
-god_type grid_altar_god( unsigned char grid )
+god_type grid_altar_god( dungeon_feature_type grid )
{
if (grid >= DNGN_ALTAR_ZIN && grid <= DNGN_ALTAR_BEOGH)
return (static_cast<god_type>( grid - DNGN_ALTAR_ZIN + 1 ));
@@ -211,15 +211,15 @@ god_type grid_altar_god( unsigned char grid )
// returns DNGN_FLOOR for non-gods, otherwise returns the altar for
// the god.
-int altar_for_god( god_type god )
+dungeon_feature_type altar_for_god( god_type god )
{
if (god == GOD_NO_GOD || god >= NUM_GODS)
return (DNGN_FLOOR); // Yeah, lame. Tell me about it.
- return (DNGN_ALTAR_ZIN + god - 1);
+ return static_cast<dungeon_feature_type>(DNGN_ALTAR_ZIN + god - 1);
}
-bool grid_is_branch_stairs( unsigned char grid )
+bool grid_is_branch_stairs( dungeon_feature_type grid )
{
return ((grid >= DNGN_ENTER_ORCISH_MINES && grid <= DNGN_ENTER_RESERVED_4)
|| (grid >= DNGN_ENTER_DIS && grid <= DNGN_ENTER_TARTARUS));
@@ -237,7 +237,7 @@ int grid_secret_door_appearance( int gx, int gy )
if ((abs(dx) + abs(dy)) % 2 == 0)
continue;
- const int targ = grd[gx + dx][gy + dy];
+ const dungeon_feature_type targ = grd[gx + dx][gy + dy];
if (!grid_is_wall( targ ))
continue;
@@ -253,7 +253,7 @@ int grid_secret_door_appearance( int gx, int gy )
: ret);
}
-const char *grid_item_destruction_message( unsigned char grid )
+const char *grid_item_destruction_message( dungeon_feature_type grid )
{
return grid == DNGN_DEEP_WATER? "You hear a splash."
: grid == DNGN_LAVA ? "You hear a sizzling splash."
@@ -1757,9 +1757,9 @@ bool trap_item(object_class_type base_type, char sub_type,
} // end trap_item()
// returns appropriate trap symbol for a given trap type {dlb}
-unsigned char trap_category(unsigned char trap_type)
+dungeon_feature_type trap_category(trap_type type)
{
- switch (trap_type)
+ switch (type)
{
case TRAP_TELEPORT:
case TRAP_AMNESIA:
@@ -1796,6 +1796,12 @@ int trap_at_xy(int which_x, int which_y)
return (-1);
} // end trap_at_xy()
+trap_type trap_type_at_xy(int x, int y)
+{
+ const int idx = trap_at_xy(x, y);
+ return (idx == -1? NUM_TRAPS : env.trap[idx].type);
+}
+
bool is_damaging_cloud(cloud_type type)
{
switch (type)
diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h
index 207ea1b6f3..e945411e0d 100644
--- a/crawl-ref/source/misc.h
+++ b/crawl-ref/source/misc.h
@@ -129,27 +129,30 @@ void weird_writing(char stringy[40]);
/* ***********************************************************************
* called from: acr - misc - mstuff2 - spells2 - spells3
* *********************************************************************** */
-unsigned char trap_category(unsigned char trap_type);
+dungeon_feature_type trap_category(trap_type type);
-bool grid_is_wall(int grid);
-bool grid_is_opaque(int grid);
-bool grid_is_solid(int grid);
+int trap_at_xy(int x, int y);
+trap_type trap_type_at_xy(int x, int y);
+
+bool grid_is_wall(dungeon_feature_type grid);
+bool grid_is_opaque(dungeon_feature_type grid);
+bool grid_is_solid(dungeon_feature_type grid);
bool grid_is_solid(int x, int y);
bool grid_is_solid(const coord_def &c);
-bool grid_is_trap(int grid);
+bool grid_is_trap(dungeon_feature_type grid);
-bool grid_is_water(int grid);
-bool grid_is_watery( int grid );
-god_type grid_altar_god( unsigned char grid );
-int altar_for_god( god_type god );
-bool grid_is_branch_stairs( unsigned char grid );
+bool grid_is_water(dungeon_feature_type grid);
+bool grid_is_watery(dungeon_feature_type grid);
+god_type grid_altar_god( dungeon_feature_type grid );
+dungeon_feature_type altar_for_god( god_type god );
+bool grid_is_branch_stairs( dungeon_feature_type grid );
int grid_secret_door_appearance( int gx, int gy );
-bool grid_destroys_items( int grid );
+bool grid_destroys_items( dungeon_feature_type grid );
std::string cloud_name(cloud_type type);
bool is_damaging_cloud(cloud_type type);
-const char *grid_item_destruction_message( unsigned char grid );
+const char *grid_item_destruction_message( dungeon_feature_type grid );
void curare_hits_player(int agent, int degree);
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 6fcf93bbcf..86e72d9d6c 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2220,7 +2220,7 @@ coord_def monsters::pos() const
bool monsters::swimming() const
{
- const int grid = grd[x][y];
+ const dungeon_feature_type grid = grd[x][y];
return (grid_is_watery(grid) && monster_habitat(type) == DNGN_DEEP_WATER);
}
@@ -2231,7 +2231,7 @@ bool monsters::submerged() const
bool monsters::floundering() const
{
- const int grid = grd[x][y];
+ const dungeon_feature_type grid = grd[x][y];
return (grid_is_water(grid)
// Can't use monster_habitable_grid because that'll return true
// for non-water monsters in shallow water.
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 15691a0fcd..f51cbc4ba4 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5046,7 +5046,7 @@ static void mons_in_cloud(monsters *monster)
}
} // end mons_in_cloud()
-int monster_habitat(int which_class)
+dungeon_feature_type monster_habitat(int which_class)
{
switch (which_class)
{
diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h
index ec98dbb277..ddda00c94b 100644
--- a/crawl-ref/source/monstuff.h
+++ b/crawl-ref/source/monstuff.h
@@ -121,7 +121,7 @@ void handle_monsters(void);
* called from: acr - bang - beam - direct - dungeon - fight - files -
* monplace - mstuff2 - spells3 - view
* *********************************************************************** */
-int monster_habitat(int which_class);
+dungeon_feature_type monster_habitat(int which_class);
/* ***********************************************************************
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 056217d095..474dd88ab7 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -250,6 +250,9 @@ void mons_trap(struct monsters *monster)
mons_ench_f2(monster, beem);
damage_taken = 0; // just to be certain {dlb}
break;
+
+ default:
+ break;
}
diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc
index 117e8d96d6..1fa8d5ddee 100644
--- a/crawl-ref/source/overmap.cc
+++ b/crawl-ref/source/overmap.cc
@@ -49,7 +49,7 @@ static void seen_altar( god_type god, const coord_def& pos );
static void seen_staircase(unsigned char which_staircase,const coord_def& pos);
static void seen_other_thing(unsigned char which_thing, const coord_def& pos);
-void seen_notable_thing( int which_thing, int x, int y )
+void seen_notable_thing( dungeon_feature_type which_thing, int x, int y )
{
// Don't record in temporary terrain
if (you.level_type != LEVEL_DUNGEON)
@@ -65,7 +65,7 @@ void seen_notable_thing( int which_thing, int x, int y )
seen_other_thing( which_thing, pos );
}
-static int portal_to_feature(portal_type p)
+static dungeon_feature_type portal_to_feature(portal_type p)
{
switch ( p )
{
@@ -159,44 +159,6 @@ inline static std::string portal_description(portal_type portal)
return feature_description( portal_to_feature(portal) );
}
-static void get_matching_altars(
- const base_pattern &pattern, std::vector<stash_search_result> &results)
-{
- for ( altar_map_type::const_iterator na_iter = altars_present.begin();
- na_iter != altars_present.end(); ++na_iter )
- {
- const std::string adesc =
- altar_description(na_iter->second);
-
- if (pattern.matches(place_desc(na_iter->first) + adesc))
- {
- stash_search_result sr;
- sr.pos = na_iter->first;
- sr.match = adesc;
- results.push_back(sr);
- }
- }
-}
-
-static void get_matching_portals(
- const base_pattern &pattern, std::vector<stash_search_result> &results)
-{
- for ( portal_map_type::const_iterator pl_iter = portals_present.begin();
- pl_iter != portals_present.end(); ++pl_iter )
- {
- const std::string desc =
- portal_description(pl_iter->second);
-
- if (pattern.matches(place_desc(pl_iter->first) + desc + " [portal]"))
- {
- stash_search_result sr;
- sr.pos = pl_iter->first;
- sr.match = desc;
- results.push_back(sr);
- }
- }
-}
-
bool overmap_knows_portal(dungeon_feature_type portal)
{
for ( portal_map_type::const_iterator pl_iter = portals_present.begin();
@@ -208,16 +170,6 @@ bool overmap_knows_portal(dungeon_feature_type portal)
return (false);
}
-void get_matching_features(
- const base_pattern &pattern, std::vector<stash_search_result> &results)
-{
- if (!pattern.valid())
- return;
-
- get_matching_altars(pattern, results);
- get_matching_portals(pattern, results);
-}
-
std::string overview_description_string()
{
char buffer[100];
diff --git a/crawl-ref/source/overmap.h b/crawl-ref/source/overmap.h
index 4703d37395..214073cecf 100644
--- a/crawl-ref/source/overmap.h
+++ b/crawl-ref/source/overmap.h
@@ -15,13 +15,11 @@
#include "stash.h"
#include <vector>
-void seen_notable_thing( int which_thing, int x, int y );
+void seen_notable_thing( dungeon_feature_type which_thing, int x, int y );
bool overmap_knows_portal(dungeon_feature_type portal);
void display_overmap();
void unnotice_labyrinth_portal();
void unnotice_altar();
std::string overview_description_string();
-void get_matching_features(
- const base_pattern &pattern, std::vector<stash_search_result> &results);
#endif
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e266d6d620..a41cd41521 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -151,9 +151,9 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
int id;
// assuming that entering the same square means coming from above (levitate)
const bool from_above = (you.x_pos == x && you.y_pos == y);
- const int old_grid = (from_above) ? static_cast<int>(DNGN_FLOOR)
+ const dungeon_feature_type old_grid = (from_above) ? DNGN_FLOOR
: grd[you.x_pos][you.y_pos];
- const int new_grid = grd[x][y];
+ const dungeon_feature_type new_grid = grd[x][y];
// really must be clear
ASSERT( !grid_is_solid( new_grid ) );
@@ -296,8 +296,8 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
{
trap_known = false;
- const int type = trap_category( env.trap[id].type );
-
+ const dungeon_feature_type type =
+ trap_category( env.trap[id].type );
grd[you.x_pos][you.y_pos] = type;
set_envmap_obj(you.x_pos, you.y_pos, type);
}
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 2d19836752..986ab3d180 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -2861,7 +2861,7 @@ int cast_apportation(int pow)
}
// Protect the player from destroying the item
- const int grid = grd[ you.x_pos ][ you.y_pos ];
+ const dungeon_feature_type grid = grd[ you.x_pos ][ you.y_pos ];
if (grid_destroys_items(grid))
{
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index e62a6dbc46..5b12514b84 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -10,6 +10,7 @@
#include "chardump.h"
#include "clua.h"
#include "describe.h"
+#include "direct.h"
#include "itemname.h"
#include "itemprop.h"
#include "files.h"
@@ -27,6 +28,7 @@
#include "tags.h"
#include "travel.h"
#include "tutorial.h"
+#include "view.h"
#include <cctype>
#include <cstdio>
@@ -35,7 +37,7 @@
#include <algorithm>
#define ST_MAJOR_VER ((unsigned char) 4)
-#define ST_MINOR_VER ((unsigned char) 6)
+#define ST_MINOR_VER ((unsigned char) 7)
#define LUA_SEARCH_ANNOTATE "ch_stash_search_annotate_item"
#define LUA_DUMP_ANNOTATE "ch_stash_dump_annotate_item"
@@ -253,8 +255,35 @@ bool Stash::pickup_eligible() const
return (false);
}
+bool Stash::is_boring_feature(dungeon_feature_type feat)
+{
+ switch (feat)
+ {
+ // Discard spammy dungeon features.
+ case DNGN_SHALLOW_WATER: case DNGN_DEEP_WATER:
+ case DNGN_LAVA: case DNGN_OPEN_DOOR: case DNGN_STONE_STAIRS_DOWN_I:
+ case DNGN_STONE_STAIRS_DOWN_II: case DNGN_STONE_STAIRS_DOWN_III:
+ case DNGN_STONE_STAIRS_UP_I: case DNGN_STONE_STAIRS_UP_II:
+ case DNGN_STONE_STAIRS_UP_III: case DNGN_ROCK_STAIRS_DOWN:
+ case DNGN_ROCK_STAIRS_UP: case DNGN_ENTER_SHOP:
+ case DNGN_UNDISCOVERED_TRAP:
+ return (true);
+ default:
+ return (grid_is_solid(feat));
+ }
+}
+
void Stash::update()
{
+ feat = grd[x][y];
+ trap = NUM_TRAPS;
+
+ if (is_boring_feature(feat))
+ feat = DNGN_FLOOR;
+
+ if (grid_is_trap(feat))
+ trap = trap_type_at_xy(x, y);
+
int objl = igrd[x][y];
// If this is your position, you know what's on this square
if (x == you.x_pos && y == you.y_pos)
@@ -286,11 +315,7 @@ void Stash::update()
// There's something on this square. Take a squint at it.
const item_def &item = mitm[objl];
- // note item when first entering field of vision
- // (only works with stashes enabled)
-// learned_something_new(TUT_SEEN_FIRST_OBJECT, x, y);
-// learned_something_new(TUT_SEEN_FIRST_OBJECT, item);
- tutorial_first_item(item);
+ tutorial_first_item(item);
if (item.link == NON_ITEM)
items.clear();
@@ -464,11 +489,20 @@ std::string Stash::description() const
return (desc);
}
+std::string Stash::feature_description() const
+{
+ if (feat == DNGN_FLOOR)
+ return ("");
+
+ return (::feature_description(feat, trap));
+}
+
bool Stash::matches_search(const std::string &prefix,
const base_pattern &search,
stash_search_result &res) const
{
- if (!enabled || items.empty()) return false;
+ if (!enabled || (items.empty() && feat == DNGN_FLOOR))
+ return false;
for (unsigned i = 0; i < items.size(); ++i)
{
@@ -497,6 +531,17 @@ bool Stash::matches_search(const std::string &prefix,
}
}
}
+
+ if (!res.matches && feat != DNGN_FLOOR)
+ {
+ const std::string fdesc = feature_description();
+ if (!fdesc.empty() && search.matches(fdesc))
+ {
+ res.match = fdesc;
+ res.matches = 1;
+ }
+ }
+
if (res.matches)
{
res.stash = this;
@@ -577,6 +622,9 @@ void Stash::save(FILE *file) const
writeByte(file, x);
writeByte(file, y);
+ writeByte(file, feat);
+ writeByte(file, trap);
+
// Note: Enabled save value is inverted logic, so that it defaults to true
writeByte(file,
(unsigned char) ((verified? 1 : 0) | (!enabled? 2 : 0)) );
@@ -595,6 +643,14 @@ void Stash::load(FILE *file)
x = readByte(file);
y = readByte(file);
+ feat =
+ static_cast<dungeon_feature_type>(
+ static_cast<unsigned char>( readByte(file) ));
+ trap =
+ static_cast<trap_type>(
+ static_cast<unsigned char>( readByte(file) ));
+
+
unsigned char flags = readByte(file);
verified = (flags & 1) != 0;
@@ -757,7 +813,8 @@ bool ShopInfo::matches_search(const std::string &prefix,
const base_pattern &search,
stash_search_result &res) const
{
- if (items.empty() && visited) return false;
+ if (items.empty() && visited)
+ return false;
bool match = false;
@@ -1000,9 +1057,9 @@ void LevelStashes::add_stash(int x, int y)
}
else
{
- Stash newStash(x, y);
- if (!newStash.empty())
- stashes[ newStash.abs_pos() ] = newStash;
+ Stash new_stash(x, y);
+ if (!new_stash.empty())
+ stashes[ new_stash.abs_pos() ] = new_stash;
}
}
@@ -1272,28 +1329,26 @@ void StashTracker::update_visible_stashes(
return ;
LevelStashes *lev = find_current_level();
- for (int cy = 1; cy <= 17; ++cy)
+ for (int cy = crawl_view.glos1.y; cy <= crawl_view.glos2.y; ++cy)
{
- for (int cx = 9; cx <= 25; ++cx)
+ for (int cx = crawl_view.glos1.x; cx <= crawl_view.glos2.x; ++cx)
{
- int x = you.x_pos + cx - 17, y = you.y_pos + cy - 9;
- if (x < 0 || x >= GXM || y < 0 || y >= GYM)
+ if (!in_bounds(cx, cy) || !see_grid(cx, cy))
continue;
- if (!env.show[cx - 8][cy] && !(cx == 17 && cy == 9))
- continue;
-
- if ((!lev || !lev->update_stash(x, y))
- && mode == ST_AGGRESSIVE
- && igrd[x][y] != NON_ITEM)
+ const dungeon_feature_type grid = grd[cx][cy];
+ if ((!lev || !lev->update_stash(cx, cy))
+ && mode == ST_AGGRESSIVE
+ && (igrd[cx][cy] != NON_ITEM
+ || !Stash::is_boring_feature(grid)))
{
if (!lev)
lev = &get_current_level();
- lev->add_stash(x, y);
+ lev->add_stash(cx, cy);
}
- if (grd[x][y] == DNGN_ENTER_SHOP)
- get_shop(x, y);
+ if (grid == DNGN_ENTER_SHOP)
+ get_shop(cx, cy);
}
}
@@ -1378,8 +1433,6 @@ void StashTracker::get_matching_stashes(
return;
}
- get_matching_features(search, results);
-
level_id curr = level_id::current();
for (unsigned i = 0; i < results.size(); ++i)
{
diff --git a/crawl-ref/source/stash.h b/crawl-ref/source/stash.h
index a6bc8746da..fd6ac6ddba 100644
--- a/crawl-ref/source/stash.h
+++ b/crawl-ref/source/stash.h
@@ -36,6 +36,7 @@ class Stash
public:
Stash(int xp = -1, int yp = -1);
+ static bool is_boring_feature(dungeon_feature_type feat);
static void filter(object_class_type base_type, unsigned char sub_type);
static void filter(const std::string &filt);
@@ -45,6 +46,7 @@ public:
void load(FILE*);
std::string description() const;
+ std::string feature_description() const;
bool show_menu(const std::string &place, bool can_travel) const;
@@ -67,7 +69,7 @@ public:
bool empty() const
{
- return items.empty() && enabled;
+ return enabled && items.empty() && feat == DNGN_FLOOR;
}
bool isAt(int xp, int yp) const { return x == xp && y == yp; }
@@ -85,6 +87,9 @@ private:
bool verified; // Is this correct to the best of our knowledge?
unsigned char x, y;
int abspos;
+ dungeon_feature_type feat;
+ trap_type trap;
+
std::vector<item_def> items;
/*
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 887d321b33..0d42444864 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -302,23 +302,6 @@ int random2limit(int max, int limit)
return sum;
} // end random2limit()
-// answers the question: "Is a grid within character's line of sight?"
-bool see_grid(unsigned char grx, unsigned char gry)
-{
- if (grx > you.x_pos - 9 && grx < you.x_pos + 9
- && gry > you.y_pos - 9 && gry < you.y_pos + 9)
- {
- if (env.show[grx - you.x_pos + 9][gry - you.y_pos + 9] != 0)
- return true;
-
- // rare case: can player see self? (of course!)
- if (grx == you.x_pos && gry == you.y_pos)
- return true;
- }
-
- return false;
-} // end see_grid()
-
static bool io_inited = false;
void cio_init()
{
diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h
index c3c043af8d..b1866ee069 100644
--- a/crawl-ref/source/stuff.h
+++ b/crawl-ref/source/stuff.h
@@ -44,7 +44,6 @@ void scale_dice( dice_def &dice, int threshold = 24 );
int random2limit(int max, int limit);
-bool see_grid(unsigned char grx, unsigned char gry);
int stepdown_value(int base_value, int stepping, int first_step, int last_step, int ceiling_value);
int stat_mult( int stat_level, int value, int div = 20, int shift = 3 );
int stat_div( int stat_level, int value, int div = 20, int shift = 3 );
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index e492b338aa..dd192cb77e 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1520,8 +1520,10 @@ static void tag_read_level( struct tagHeader &th, char minorVersion )
{
for (j = 0; j < gy; j++)
{
- grd[i][j] = unmarshallByte(th);
-
+ grd[i][j] =
+ static_cast<dungeon_feature_type>(
+ static_cast<unsigned char>(unmarshallByte(th)) );
+
env.map[i][j].object = unmarshallShort(th);
env.map[i][j].colour = unmarshallShort(th);
env.map[i][j].flags = unmarshallShort(th);
@@ -1568,7 +1570,9 @@ static void tag_read_level_items(struct tagHeader &th, char minorVersion)
count = unmarshallShort(th);
for (i = 0; i < count; ++i)
{
- env.trap[i].type = unmarshallByte(th);
+ env.trap[i].type =
+ static_cast<trap_type>(
+ static_cast<unsigned char>(unmarshallByte(th)) );
env.trap[i].x = unmarshallByte(th);
env.trap[i].y = unmarshallByte(th);
}
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 3b5e5ac569..20f6d49160 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -123,14 +123,14 @@ inline bool is_trap(int x, int y)
}
// Returns true if this feature takes extra time to cross.
-inline int feature_traverse_cost(unsigned char feature)
+inline int feature_traverse_cost(dungeon_feature_type feature)
{
return (feature == DNGN_SHALLOW_WATER || feature == DNGN_CLOSED_DOOR? 2 :
grid_is_trap(feature) ? 3 : 1);
}
// Returns true if the dungeon feature supplied is an altar.
-bool is_altar(unsigned char grid)
+bool is_altar(dungeon_feature_type grid)
{
return grid_altar_god(grid) != GOD_NO_GOD;
}
@@ -140,7 +140,7 @@ bool is_altar(const coord_def &c)
return is_altar(grd[c.x][c.y]);
}
-inline bool is_player_altar(unsigned char grid)
+inline bool is_player_altar(dungeon_feature_type grid)
{
// An ugly hack, but that's what religion.cc does.
return you.religion != GOD_NO_GOD
@@ -409,6 +409,8 @@ bool is_travelsafe_square(int x, int y, bool ignore_hostile,
}
// Returns true if the location at (x,y) is monster-free and contains no clouds.
+// Travel uses this to check if the square the player is about to move to is
+// safe.
static bool is_safe_move(int x, int y)
{
int mon = mgrd[x][y];
@@ -426,6 +428,15 @@ static bool is_safe_move(int x, int y)
// b) Unfriendly, in which case we're in deep trouble, since travel
// should have been aborted already by the checks in view.cc.
}
+
+ if (is_trap(x, y)
+#ifdef CLUA_BINDINGS
+ && !clua.callbooleanfn(false, "ch_cross_trap",
+ "s", trap_name(x, y))
+#endif
+ )
+ return (false);
+
const int cloud = env.cgrid[x][y];
if (cloud == EMPTY_CLOUD)
return (true);
@@ -1352,7 +1363,7 @@ bool travel_pathfind::square_slows_movement(const coord_def &c)
// c is a known (explored) location - we never put unknown points in the
// circumference vector, so we don't need to examine the map array, just the
// grid array.
- const int feature = grd(c);
+ const dungeon_feature_type feature = grd(c);
// If this is a feature that'll take time to travel past, we simulate that
// extra turn by taking this feature next turn, thereby artificially
@@ -3490,7 +3501,8 @@ explore_discoveries::explore_discoveries()
{
}
-std::string explore_discoveries::cleaned_feature_description(int grid) const
+std::string explore_discoveries::cleaned_feature_description(
+ dungeon_feature_type grid) const
{
std::string s = lowercase_first(feature_description(grid));
if (s.length() && s[s.length() - 1] == '.')
@@ -3500,7 +3512,8 @@ std::string explore_discoveries::cleaned_feature_description(int grid) const
return (s);
}
-void explore_discoveries::found_feature(const coord_def &pos, int grid)
+void explore_discoveries::found_feature(const coord_def &pos,
+ dungeon_feature_type grid)
{
if (grid == DNGN_ENTER_SHOP && ES_shop)
{
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 8fad985664..3ed894ecee 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -269,7 +269,7 @@ class explore_discoveries
public:
explore_discoveries();
- void found_feature(const coord_def &pos, int grid);
+ void found_feature(const coord_def &pos, dungeon_feature_type grid);
void found_item(const coord_def &pos, const item_def &item);
// Reports discoveries and prompts the player to stop (if necessary).
@@ -277,7 +277,7 @@ public:
private:
template <class C> void say_any(const C &coll, const char *stub) const;
- std::string cleaned_feature_description(int feature) const;
+ std::string cleaned_feature_description(dungeon_feature_type feature) const;
void add_item(const item_def &item);
private:
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 9a0044dfea..1b34462ffb 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -325,7 +325,8 @@ static void get_symbol( int x, int y,
// Note anything we see that's notable
if ((x || y) && Feature[object].notable)
- seen_notable_thing( object, x, y );
+ seen_notable_thing( static_cast<dungeon_feature_type>(object),
+ x, y );
}
else
{
@@ -467,7 +468,7 @@ screen_buffer_t colour_code_map( int x, int y, bool item_colour,
if (!(map_flags & MAP_GRID_KNOWN))
return (BLACK);
- const int grid_value = grd[x][y];
+ const dungeon_feature_type grid_value = grd[x][y];
unsigned tc = travel_colour?
get_travel_colour(x, y)
@@ -493,7 +494,7 @@ screen_buffer_t colour_code_map( int x, int y, bool item_colour,
int feature_colour = DARKGREY;
feature_colour =
is_terrain_seen(x, y)? Feature[grid_value].seen_colour
- : Feature[grid_value].map_colour;
+ : Feature[grid_value].map_colour;
if (feature_colour != DARKGREY)
tc = feature_colour;
@@ -2003,7 +2004,7 @@ bool find_ray( int sourcex, int sourcey, int targetx, int targety,
// Smoke will now only block LOS after two cells of smoke. This is
// done by updating with a second array.
void losight(FixedArray < unsigned int, 19, 19 > &sh,
- FixedArray < unsigned char, 80, 70 > &gr, int x_p, int y_p)
+ FixedArray < dungeon_feature_type, 80, 70 > &gr, int x_p, int y_p)
{
raycast();
// go quadrant by quadrant
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index 3a47f8adac..b562359b7b 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -56,7 +56,9 @@ void find_features(const std::vector<coord_def>& features,
/* ***********************************************************************
* called from: direct - monstufff - view
* *********************************************************************** */
-void losight(FixedArray<unsigned int, 19, 19>& sh, FixedArray<unsigned char, 80, 70>& gr, int x_p, int y_p);
+void losight(FixedArray<unsigned int, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER>& sh,
+ FixedArray<dungeon_feature_type, GXM, GYM>& gr,
+ int x_p, int y_p);
// last updated 12may2000 {dlb}