summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/cio.h2
-rw-r--r--crawl-ref/source/command.cc2
-rw-r--r--crawl-ref/source/database.cc4
-rw-r--r--crawl-ref/source/debug.cc2
-rw-r--r--crawl-ref/source/decks.cc6
-rw-r--r--crawl-ref/source/defines.h4
-rw-r--r--crawl-ref/source/describe.cc6
-rw-r--r--crawl-ref/source/directn.cc (renamed from crawl-ref/source/direct.cc)2
-rw-r--r--crawl-ref/source/directn.h (renamed from crawl-ref/source/direct.h)2
-rw-r--r--crawl-ref/source/dungeon.cc2
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/files.cc42
-rw-r--r--crawl-ref/source/initfile.cc11
-rw-r--r--crawl-ref/source/invent.cc2
-rw-r--r--crawl-ref/source/it_use3.cc2
-rw-r--r--crawl-ref/source/item_use.cc6
-rw-r--r--crawl-ref/source/itemname.cc4
-rw-r--r--crawl-ref/source/items.cc2
-rw-r--r--crawl-ref/source/libgui.cc2
-rw-r--r--crawl-ref/source/libutil.cc4
-rw-r--r--crawl-ref/source/libw32c.cc2
-rw-r--r--crawl-ref/source/luadgn.cc16
-rw-r--r--crawl-ref/source/makefile.obj2
-rw-r--r--crawl-ref/source/mapdef.cc6
-rw-r--r--crawl-ref/source/mapmark.cc2
-rw-r--r--crawl-ref/source/mgrow.cc2
-rw-r--r--crawl-ref/source/misc.cc4
-rw-r--r--crawl-ref/source/mon-util.cc12
-rw-r--r--crawl-ref/source/mutation.cc4
-rw-r--r--crawl-ref/source/newgame.cc32
-rw-r--r--crawl-ref/source/output.cc2
-rw-r--r--crawl-ref/source/overmap.cc2
-rw-r--r--crawl-ref/source/quiver.cc20
-rw-r--r--crawl-ref/source/religion.cc4
-rw-r--r--crawl-ref/source/spells1.cc4
-rw-r--r--crawl-ref/source/spells1.h2
-rw-r--r--crawl-ref/source/spells2.cc2
-rw-r--r--crawl-ref/source/spells3.cc4
-rw-r--r--crawl-ref/source/spells4.cc4
-rw-r--r--crawl-ref/source/spl-cast.cc2
-rw-r--r--crawl-ref/source/spl-util.cc2
-rw-r--r--crawl-ref/source/spl-util.h2
-rw-r--r--crawl-ref/source/stash.cc2
-rw-r--r--crawl-ref/source/state.cc2
-rw-r--r--crawl-ref/source/stuff.cc2
-rw-r--r--crawl-ref/source/terrain.cc4
-rw-r--r--crawl-ref/source/tile1.cc2
-rw-r--r--crawl-ref/source/tile2.cc2
-rw-r--r--crawl-ref/source/transfor.cc2
-rw-r--r--crawl-ref/source/traps.cc2
-rw-r--r--crawl-ref/source/travel.cc2
-rw-r--r--crawl-ref/source/view.cc4
-rw-r--r--crawl-ref/source/xom.cc2
54 files changed, 149 insertions, 120 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 4fbcfe8081..6ef42b9a85 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -83,7 +83,7 @@
#include "debug.h"
#include "delay.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "effects.h"
#include "fight.h"
diff --git a/crawl-ref/source/cio.h b/crawl-ref/source/cio.h
index 805ed2396d..26caa23be2 100644
--- a/crawl-ref/source/cio.h
+++ b/crawl-ref/source/cio.h
@@ -12,7 +12,7 @@
#include "AppHdr.h"
#include "externs.h"
#include "defines.h"
-#include "direct.h"
+#include "directn.h"
#include <cctype>
#include <string>
#include <vector>
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 025ae033e4..163f9403fe 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -97,7 +97,7 @@ void version(void)
{
mpr( "This is " CRAWL " " VERSION " (" VERSION_DETAIL ")." );
mprf("Features: %s",
- comma_separated_line(features, features + ARRAYSIZE(features))
+ comma_separated_line(features, features + ARRAYSZ(features))
.c_str());
} // end version()
diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc
index 8417b6e689..af43a29c76 100644
--- a/crawl-ref/source/database.cc
+++ b/crawl-ref/source/database.cc
@@ -182,13 +182,13 @@ void TextDB::_regenerate_db()
void databaseSystemInit()
{
- for (unsigned int i = 0; i < ARRAYSIZE(AllDBs); i++)
+ for (unsigned int i = 0; i < ARRAYSZ(AllDBs); i++)
AllDBs[i].init();
}
void databaseSystemShutdown()
{
- for (unsigned int i = 0; i < ARRAYSIZE(AllDBs); i++)
+ for (unsigned int i = 0; i < ARRAYSZ(AllDBs); i++)
AllDBs[i].shutdown();
}
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 6b65e9bce1..ee2d8053ba 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -43,7 +43,7 @@
#include "decks.h"
#include "delay.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "effects.h"
#include "fight.h"
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index a22534197a..3d7740277e 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -819,7 +819,7 @@ bool deck_peek()
already_seen++;
// always increase if seen 2, 50% increase if seen 1
- if ( coinflip() < already_seen)
+ if ( already_seen && random2(2) < already_seen )
deck.props["non_brownie_draws"]++;
mprf("You draw two cards from the deck. They are: %s and %s.",
@@ -2004,7 +2004,7 @@ const mutation_type bad_mutations[] = {
bool _has_bad_mutation()
{
- for ( unsigned int i = 0; i < ARRAYSIZE(bad_mutations); ++i )
+ for ( unsigned int i = 0; i < ARRAYSZ(bad_mutations); ++i )
if (you.mutation[bad_mutations[i]] > you.demon_pow[bad_mutations[i]])
return true;
@@ -2015,7 +2015,7 @@ static void _remove_bad_mutation()
{
mutation_type which_mut = NUM_MUTATIONS;
int numfound = 0;
- for ( unsigned int i = 0; i < ARRAYSIZE(bad_mutations); ++i )
+ for ( unsigned int i = 0; i < ARRAYSZ(bad_mutations); ++i )
if (you.mutation[bad_mutations[i]] > you.demon_pow[bad_mutations[i]])
{
if ( one_chance_in(++numfound) )
diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h
index a028036591..d899dda451 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -299,8 +299,8 @@ const int LABYRINTH_BORDER = 4;
// it wants to be used in case labels.
#define CONTROL( xxx ) ((xxx) - 'A' + 1)
-#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0]))
-#define RANDOM_ELEMENT(x) (x[random2(ARRAYSIZE(x))])
+#define ARRAYSZ(x) (sizeof(x) / sizeof(x[0]))
+#define RANDOM_ELEMENT(x) (x[random2(ARRAYSZ(x))])
#define MIN(x, y) MINIMUM(x, y)
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 7a1bde8feb..caa1e8e3cf 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -260,7 +260,7 @@ static std::vector<std::string> _randart_propnames( const item_def& item )
ego = ego.substr(2, ego.length()-3);
// and another one for adding a comma if needed
- for ( unsigned i = 0; i < ARRAYSIZE(propanns); ++i )
+ for ( unsigned i = 0; i < ARRAYSZ(propanns); ++i )
if (known_proprt(propanns[i].prop))
{
ego += ",";
@@ -271,7 +271,7 @@ static std::vector<std::string> _randart_propnames( const item_def& item )
}
}
- for ( unsigned i = 0; i < ARRAYSIZE(propanns); ++i )
+ for ( unsigned i = 0; i < ARRAYSZ(propanns); ++i )
{
if (known_proprt(propanns[i].prop))
{
@@ -401,7 +401,7 @@ static std::string _randart_descrip( const item_def &item )
{ RAP_ANGRY, "It makes you angry.", false}
};
- for ( unsigned i = 0; i < ARRAYSIZE(propdescs); ++i )
+ for ( unsigned i = 0; i < ARRAYSZ(propdescs); ++i )
{
if ( known_proprt(propdescs[i].property))
{
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/directn.cc
index afe73c0522..f18e22e0f5 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/directn.cc
@@ -17,7 +17,7 @@
*/
#include "AppHdr.h"
-#include "direct.h"
+#include "directn.h"
#include "format.h"
#include <cstdarg>
diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/directn.h
index bf060d1d61..e968d82926 100644
--- a/crawl-ref/source/direct.h
+++ b/crawl-ref/source/directn.h
@@ -1,5 +1,5 @@
/*
- * File: direct.h
+ * File: directn.h
* Summary: Functions used when picking squares.
* Written by: Linley Henzell
*
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 7ba2ce11c2..1c55e88d6c 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -39,7 +39,7 @@
#include "defines.h"
#include "enum.h"
#include "externs.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "files.h"
#include "food.h"
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index a245da13a2..7d8a0a62ca 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -25,7 +25,7 @@
#include "decks.h"
#include "delay.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "dgnevent.h"
#include "food.h"
#include "hiscores.h"
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 7b7211adce..7d04269590 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -52,20 +52,13 @@
#include <sys/types.h>
#include <sys/stat.h>
-#if _MSC_VER
-// # include <direct.h> conflicts with crawl's header. Yes this sucks
-# include <c:/Program Files/Microsoft Visual Studio 8/VC/include/direct.h>
-#else
-#include <dirent.h>
-#endif
-
#include "externs.h"
#include "chardump.h"
#include "cloud.h"
#include "clua.h"
#include "debug.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "effects.h"
#include "ghost.h"
@@ -100,6 +93,14 @@
#include "view.h"
#include "xom.h"
+#if _MSC_VER
+#include <direct.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#else
+#include <dirent.h>
+#endif
+
#ifndef HAVE_STAT
#if defined(UNIX) || defined(__MINGW32__) || defined(DOS)
#define HAVE_STAT
@@ -225,12 +226,30 @@ player_save_info read_character_info(const std::string &savefile)
return fromfile;
}
+static bool _is_good_filename(const std::string &s)
+{
+ return (s != "." && s != "..");
+}
+
// Returns the names of all files in the given directory. Note that the
// filenames returned are relative to the directory.
std::vector<std::string> get_dir_files(const std::string &dirname)
{
std::vector<std::string> files;
+#ifdef _MSC_VER
+ WIN32_FIND_DATA lData;
+ HANDLE hFind = FindFirstFile(dirname.c_str(), &lData);
+ if (hFind != INVALID_HANDLE_VALUE)
+ {
+ if (_is_good_filename(lData.cFileName))
+ files.push_back(lData.cFileName);
+ while (FindNextFile(hFind, &lData))
+ files.push_back(lData.cFileName);
+ FindClose(hFind);
+ }
+#else // non-MS VC++ compilers
+
DIR *dir = opendir(dirname.c_str());
if (!dir)
return (files);
@@ -244,6 +263,7 @@ std::vector<std::string> get_dir_files(const std::string &dirname)
files.push_back(name);
}
closedir(dir);
+#endif
return (files);
}
@@ -323,12 +343,18 @@ static bool file_exists(const std::string &name)
// Low-tech existence check.
static bool dir_exists(const std::string &dir)
{
+#ifdef _MSC_VER
+ DWORD lAttr = GetFileAttributes(dir.c_str());
+ return (lAttr != INVALID_FILE_ATTRIBUTES
+ && (lAttr & FILE_ATTRIBUTE_DIRECTORY));
+#else
DIR *d = opendir(dir.c_str());
const bool exists = !!d;
if (d)
closedir(d);
return (exists);
+#endif
}
static int create_directory(const char *dir)
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 8ce4243eca..f822989c55 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -25,7 +25,7 @@
#include "chardump.h"
#include "clua.h"
#include "delay.h"
-#include "direct.h"
+#include "directn.h"
#include "Kills.h"
#include "files.h"
#include "defines.h"
@@ -143,7 +143,7 @@ int str_to_colour( const std::string &str, int default_colour,
"iron", "bone", "random"
};
- ASSERT(ARRAYSIZE(element_cols) == (EC_RANDOM - EC_FIRE) + 1);
+ ASSERT(ARRAYSZ(element_cols) == (EC_RANDOM - EC_FIRE) + 1);
for (ret = 0; ret < 16; ret++)
{
@@ -2411,8 +2411,9 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else BOOL_OPTION(explore_greedy);
else BOOL_OPTION(explore_improved);
- else BOOL_OPTION(trap_prompt);
- else if (key == "stash_tracking")
+
+ BOOL_OPTION(trap_prompt);
+ else if (key == "stash_tracking")
{
stash_tracking =
field == "dropped" ? STM_DROPPED :
@@ -3102,7 +3103,7 @@ void menu_sort_condition::set_menu_type(std::string &s)
{ "pickup:", MT_PICKUP }
};
- for (unsigned mi = 0; mi < ARRAYSIZE(menu_type_map); ++mi)
+ for (unsigned mi = 0; mi < ARRAYSZ(menu_type_map); ++mi)
{
const std::string &name = menu_type_map[mi].mname;
if (s.find(name) == 0)
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 31c4c09e11..cfe295166b 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -517,7 +517,7 @@ void init_item_sort_comparators(item_sort_comparators &list,
if (s[0] == '<' || s[0] == '>')
s = s.substr(1);
- for (unsigned ci = 0; ci < ARRAYSIZE(cmp_map); ++ci)
+ for (unsigned ci = 0; ci < ARRAYSZ(cmp_map); ++ci)
if (cmp_map[ci].cname == s)
{
list.push_back( item_comparator( cmp_map[ci].cmp, negated ) );
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index fa6ee7194a..4a674f84e3 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -25,7 +25,7 @@
#include "cloud.h"
#include "database.h"
#include "decks.h"
-#include "direct.h"
+#include "directn.h"
#include "effects.h"
#include "fight.h"
#include "food.h"
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 78f2315915..902565deed 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -42,7 +42,7 @@
#include "debug.h"
#include "delay.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "effects.h"
#include "fight.h"
#include "food.h"
@@ -3586,10 +3586,10 @@ bool _drink_fountain()
20, 20,
4, 4, 4 };
- COMPILE_CHECK( ARRAYSIZE(weights) == ARRAYSIZE(effects), c1 );
+ COMPILE_CHECK( ARRAYSZ(weights) == ARRAYSZ(effects), c1 );
fountain_effect =
effects[choose_random_weighted(weights,
- weights + ARRAYSIZE(weights))];
+ weights + ARRAYSZ(weights))];
}
if (fountain_effect != POT_WATER && fountain_effect != POT_BLOOD)
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 63faef7768..f25bd8f34f 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1296,14 +1296,14 @@ std::string item_def::name_aux( description_level_type desc,
"smoky ", "glowing ", "sedimented ", "metallic ", "murky ",
"gluggy ", "oily ", "slimy ", "emulsified "
};
- COMPILE_CHECK( ARRAYSIZE(potion_qualifiers) == PDQ_NQUALS, c1 );
+ COMPILE_CHECK( ARRAYSZ(potion_qualifiers) == PDQ_NQUALS, c1 );
static const char *potion_colours[] = {
"clear", "blue", "black", "silvery", "cyan", "purple",
"orange", "inky", "red", "yellow", "green", "brown", "pink",
"white"
};
- COMPILE_CHECK( ARRAYSIZE(potion_colours) == PDC_NCOLOURS, c1 );
+ COMPILE_CHECK( ARRAYSZ(potion_colours) == PDC_NCOLOURS, c1 );
const char *qualifier =
(pqual < 0 || pqual >= PDQ_NQUALS)? "bug-filled "
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 541b339301..f2c89cd3e6 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -42,7 +42,7 @@
#include "debug.h"
#include "delay.h"
#include "dgnevent.h"
-#include "direct.h"
+#include "directn.h"
#include "effects.h"
#include "food.h"
#include "hiscores.h"
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index eef00e35f5..4ade6d9bb3 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -19,7 +19,7 @@
#include "cio.h"
#include "defines.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "files.h"
#include "food.h"
#include "itemname.h"
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index 5a3aa0cbb9..722091bd9a 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -13,7 +13,7 @@
#include "AppHdr.h"
#include "defines.h"
-#include "direct.h"
+#include "directn.h"
#include "initfile.h"
#include "libutil.h"
#include "externs.h"
@@ -26,7 +26,7 @@
#include <string.h>
#if defined(WIN32CONSOLE) || defined(WIN32TILES)
- #undef ARRAYSIZE
+ #undef ARRAYSZ
#include <windows.h>
#undef max
diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc
index 3e9f4b9675..015e33c906 100644
--- a/crawl-ref/source/libw32c.cc
+++ b/crawl-ref/source/libw32c.cc
@@ -58,7 +58,7 @@
#include <excpt.h>
#include <stdarg.h>
-#undef ARRAYSIZE
+#undef ARRAYSZ
#include <windows.h>
#undef max
diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc
index 2e7657b84a..f99ea111d5 100644
--- a/crawl-ref/source/luadgn.cc
+++ b/crawl-ref/source/luadgn.cc
@@ -14,7 +14,7 @@
#include "branch.h"
#include "clua.h"
#include "cloud.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "files.h"
#include "initfile.h"
@@ -1120,11 +1120,11 @@ const char *dngn_feature_names[] =
dungeon_feature_type dungeon_feature_by_name(const std::string &name)
{
- COMPILE_CHECK(ARRAYSIZE(dngn_feature_names) == NUM_REAL_FEATURES, c1);
+ COMPILE_CHECK(ARRAYSZ(dngn_feature_names) == NUM_REAL_FEATURES, c1);
if (name.empty())
return (DNGN_UNSEEN);
- for (unsigned i = 0; i < ARRAYSIZE(dngn_feature_names); ++i)
+ for (unsigned i = 0; i < ARRAYSZ(dngn_feature_names); ++i)
if (dngn_feature_names[i] == name)
return static_cast<dungeon_feature_type>(i);
@@ -1135,11 +1135,11 @@ std::vector<std::string> dungeon_feature_matches(const std::string &name)
{
std::vector<std::string> matches;
- COMPILE_CHECK(ARRAYSIZE(dngn_feature_names) == NUM_REAL_FEATURES, c1);
+ COMPILE_CHECK(ARRAYSZ(dngn_feature_names) == NUM_REAL_FEATURES, c1);
if (name.empty())
return (matches);
- for (unsigned i = 0; i < ARRAYSIZE(dngn_feature_names); ++i)
+ for (unsigned i = 0; i < ARRAYSZ(dngn_feature_names); ++i)
if (strstr(dngn_feature_names[i], name.c_str()))
matches.push_back(dngn_feature_names[i]);
@@ -1150,7 +1150,7 @@ const char *dungeon_feature_name(dungeon_feature_type rfeat)
{
const unsigned feat = rfeat;
- if (feat >= ARRAYSIZE(dngn_feature_names))
+ if (feat >= ARRAYSZ(dngn_feature_names))
return (NULL);
return dngn_feature_names[feat];
@@ -1178,7 +1178,7 @@ static const char *dgn_event_type_names[] =
static dgn_event_type dgn_event_type_by_name(const std::string &name)
{
- for (unsigned i = 0; i < ARRAYSIZE(dgn_event_type_names); ++i)
+ for (unsigned i = 0; i < ARRAYSZ(dgn_event_type_names); ++i)
if (dgn_event_type_names[i] == name)
return static_cast<dgn_event_type>(i? 1 << (i - 1) : 0);
return (DET_NONE);
@@ -1189,7 +1189,7 @@ static const char *dgn_event_type_name(unsigned evmask)
if (evmask == 0)
return (dgn_event_type_names[0]);
- for (unsigned i = 1; i < ARRAYSIZE(dgn_event_type_names); ++i)
+ for (unsigned i = 1; i < ARRAYSZ(dgn_event_type_names); ++i)
if (evmask & (1 << (i - 1)))
return (dgn_event_type_names[i]);
diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj
index ae4db2fb9c..dc1bce8539 100644
--- a/crawl-ref/source/makefile.obj
+++ b/crawl-ref/source/makefile.obj
@@ -16,7 +16,7 @@ decks.o \
delay.o \
describe.o \
dgnevent.o \
-direct.o \
+directn.o \
dungeon.o \
effects.o \
fight.o \
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 594ce07464..26fb4f78aa 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -15,7 +15,7 @@
#include "AppHdr.h"
#include "branch.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "files.h"
#include "initfile.h"
@@ -1426,6 +1426,7 @@ std::string map_def::validate_map_def()
if (!err.empty())
return (err);
+ fixup();
resolve();
test_lua_validate(true);
@@ -1719,8 +1720,7 @@ void map_def::rotate(bool clock)
void map_def::normalise()
{
- // Minivaults are padded out with floor tiles, normal maps are
- // padded out with rock walls.
+ // Pad out lines that are shorter than max.
map.normalise(' ');
}
diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc
index dfcc66ab34..5c7a008d49 100644
--- a/crawl-ref/source/mapmark.cc
+++ b/crawl-ref/source/mapmark.cc
@@ -14,7 +14,7 @@
#include "mapmark.h"
#include "clua.h"
-#include "direct.h"
+#include "directn.h"
#include "libutil.h"
#include "luadgn.h"
#include "stuff.h"
diff --git a/crawl-ref/source/mgrow.cc b/crawl-ref/source/mgrow.cc
index 482f33889e..74fa4c07e2 100644
--- a/crawl-ref/source/mgrow.cc
+++ b/crawl-ref/source/mgrow.cc
@@ -82,7 +82,7 @@ mons_experience_levels::mons_experience_levels()
static const monster_level_up *monster_level_up_target(
monster_type type, int hit_dice)
{
- for (unsigned i = 0; i < ARRAYSIZE(mon_grow); ++i)
+ for (unsigned i = 0; i < ARRAYSZ(mon_grow); ++i)
{
const monster_level_up &mlup(mon_grow[i]);
if (mlup.before == type)
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 211682bb46..b5e2093fab 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -45,9 +45,9 @@
#include "clua.h"
#include "cloud.h"
#include "delay.h"
-#include "direct.h"
+#include "directn.h"
#include "dgnevent.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "files.h"
#include "food.h"
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 1902d96dbe..c1262ee618 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -80,7 +80,7 @@ static monsterentry mondata[] = {
#include "mon-data.h"
};
-#define MONDATASIZE ARRAYSIZE(mondata)
+#define MONDATASIZE ARRAYSZ(mondata)
static mon_spellbook mspell_list[] = {
#include "mon-spll.h"
@@ -1509,7 +1509,7 @@ static const char *drac_colour_names[] = {
std::string draconian_colour_name(monster_type mtype)
{
- COMPILE_CHECK(ARRAYSIZE(drac_colour_names) ==
+ COMPILE_CHECK(ARRAYSZ(drac_colour_names) ==
MONS_PALE_DRACONIAN - MONS_DRACONIAN, c1);
if (mtype < MONS_BLACK_DRACONIAN || mtype > MONS_PALE_DRACONIAN)
@@ -1519,10 +1519,10 @@ std::string draconian_colour_name(monster_type mtype)
monster_type draconian_colour_by_name(const std::string &name)
{
- COMPILE_CHECK(ARRAYSIZE(drac_colour_names)
+ COMPILE_CHECK(ARRAYSZ(drac_colour_names)
== (MONS_PALE_DRACONIAN - MONS_DRACONIAN), c1);
- for (unsigned i = 0; i < ARRAYSIZE(drac_colour_names); ++i)
+ for (unsigned i = 0; i < ARRAYSZ(drac_colour_names); ++i)
if (name == drac_colour_names[i])
return static_cast<monster_type>(i + MONS_BLACK_DRACONIAN);
@@ -4149,7 +4149,7 @@ void monsters::load_spells(mon_spellbook_type book)
spells = ghost->spells;
else
{
- for (unsigned int i = 0; i < ARRAYSIZE(mspell_list); ++i)
+ for (unsigned int i = 0; i < ARRAYSZ(mspell_list); ++i)
{
if (mspell_list[i].type == book)
{
@@ -5451,7 +5451,7 @@ static const char *enchant_names[] =
const char *mons_enchantment_name(enchant_type ench)
{
- COMPILE_CHECK(ARRAYSIZE(enchant_names) == NUM_ENCHANTMENTS+1, c1);
+ COMPILE_CHECK(ARRAYSZ(enchant_names) == NUM_ENCHANTMENTS+1, c1);
if (ench > NUM_ENCHANTMENTS)
ench = NUM_ENCHANTMENTS;
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 7cd4b1c931..47ff11bdc7 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -994,13 +994,13 @@ static mutation_def mutation_defs[] = {
{ MUT_PATTERNED_SCALES, 1, 3, false, true }
};
-COMPILE_CHECK(ARRAYSIZE(mutation_defs) == NUM_MUTATIONS, c1);
+COMPILE_CHECK(ARRAYSZ(mutation_defs) == NUM_MUTATIONS, c1);
#ifdef DEBUG_DIAGNOSTICS
void sanity_check_mutation_defs()
{
- for (unsigned i = 0; i < ARRAYSIZE(mutation_defs); ++i)
+ for (unsigned i = 0; i < ARRAYSZ(mutation_defs); ++i)
{
const mutation_def &mdef(mutation_defs[i]);
ASSERT(mdef.mutation == static_cast<mutation_type>(i)
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 75338d3386..ff017dfefd 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -192,7 +192,7 @@ static species_type _random_draconian_species()
static species_type _get_species(const int index)
{
- if (index < 0 || (unsigned int) index >= ARRAYSIZE(old_species_order))
+ if (index < 0 || (unsigned int) index >= ARRAYSZ(old_species_order))
{
return (SP_UNKNOWN);
}
@@ -246,7 +246,7 @@ static job_type new_jobs_order[] = {
static job_type _get_class(const int index)
{
- if (index < 0 || (unsigned int) index >= ARRAYSIZE(old_jobs_order))
+ if (index < 0 || (unsigned int) index >= ARRAYSZ(old_jobs_order))
return JOB_UNKNOWN;
return (Options.use_old_selection_order? old_jobs_order[index]
@@ -264,9 +264,9 @@ static const char * Species_Abbrev_List[ NUM_SPECIES ] =
int get_species_index_by_abbrev( const char *abbrev )
{
- COMPILE_CHECK(ARRAYSIZE(Species_Abbrev_List) == NUM_SPECIES, c1);
+ COMPILE_CHECK(ARRAYSZ(Species_Abbrev_List) == NUM_SPECIES, c1);
- for (unsigned i = 0; i < ARRAYSIZE(old_species_order); i++)
+ for (unsigned i = 0; i < ARRAYSZ(old_species_order); i++)
{
const int sp = (Options.use_old_selection_order ? old_species_order[i]
: new_species_order[i]);
@@ -292,7 +292,7 @@ int get_species_index_by_name( const char *name )
strncpy( lowered_buff, name, sizeof( lowered_buff ) );
strlwr( lowered_buff );
- for (i = 0; i < ARRAYSIZE(old_species_order); i++)
+ for (i = 0; i < ARRAYSZ(old_species_order); i++)
{
const species_type real_sp
= (Options.use_old_selection_order ? old_species_order[i]
@@ -323,7 +323,7 @@ const char *get_species_abbrev( int which_species )
int get_species_by_abbrev( const char *abbrev )
{
int i;
- COMPILE_CHECK(ARRAYSIZE(Species_Abbrev_List) == NUM_SPECIES, c1);
+ COMPILE_CHECK(ARRAYSZ(Species_Abbrev_List) == NUM_SPECIES, c1);
for (i = SP_HUMAN; i < NUM_SPECIES; i++)
{
if (tolower( abbrev[0] ) == tolower( Species_Abbrev_List[i][0] )
@@ -351,10 +351,10 @@ static const char * Class_Name_List[ NUM_JOBS ] =
int get_class_index_by_abbrev( const char *abbrev )
{
- COMPILE_CHECK(ARRAYSIZE(Class_Abbrev_List) == NUM_JOBS, c1);
+ COMPILE_CHECK(ARRAYSZ(Class_Abbrev_List) == NUM_JOBS, c1);
unsigned int job;
- for (unsigned int i = 0; i < ARRAYSIZE(old_jobs_order); i++)
+ for (unsigned int i = 0; i < ARRAYSZ(old_jobs_order); i++)
{
job = (Options.use_old_selection_order ? old_jobs_order[i]
: new_jobs_order[i]);
@@ -394,7 +394,7 @@ int get_class_by_abbrev( const char *abbrev )
int get_class_index_by_name( const char *name )
{
- COMPILE_CHECK(ARRAYSIZE(Class_Name_List) == NUM_JOBS, c1);
+ COMPILE_CHECK(ARRAYSZ(Class_Name_List) == NUM_JOBS, c1);
char *ptr;
char lowered_buff[80];
@@ -405,7 +405,7 @@ int get_class_index_by_name( const char *name )
int cl = -1;
unsigned int job;
- for (unsigned int i = 0; i < ARRAYSIZE(old_jobs_order); i++)
+ for (unsigned int i = 0; i < ARRAYSZ(old_jobs_order); i++)
{
job = (Options.use_old_selection_order ? old_jobs_order[i]
: new_jobs_order[i]);
@@ -3137,12 +3137,12 @@ bool choose_race()
printed = true;
// the list musn't be longer than the number of actual species
- COMPILE_CHECK(ARRAYSIZE(old_species_order) <= NUM_SPECIES, c1);
+ COMPILE_CHECK(ARRAYSZ(old_species_order) <= NUM_SPECIES, c1);
// check whether the two lists have the same size
- COMPILE_CHECK(ARRAYSIZE(old_species_order) == ARRAYSIZE(new_species_order), c2);
+ COMPILE_CHECK(ARRAYSZ(old_species_order) == ARRAYSZ(new_species_order), c2);
- const int num_species = ARRAYSIZE(old_species_order);
+ const int num_species = ARRAYSZ(old_species_order);
spec_query:
bool prevraceok = (Options.prev_race == '*');
@@ -3386,12 +3386,12 @@ bool choose_class(void)
ng_cls = 0;
// the list musn't be longer than the number of actual classes
- COMPILE_CHECK(ARRAYSIZE(old_jobs_order) <= NUM_JOBS, c1);
+ COMPILE_CHECK(ARRAYSZ(old_jobs_order) <= NUM_JOBS, c1);
// check whether the two lists have the same size
- COMPILE_CHECK(ARRAYSIZE(old_jobs_order) == ARRAYSIZE(new_jobs_order), c2);
+ COMPILE_CHECK(ARRAYSZ(old_jobs_order) == ARRAYSZ(new_jobs_order), c2);
- const int num_classes = ARRAYSIZE(old_jobs_order);
+ const int num_classes = ARRAYSZ(old_jobs_order);
job_query:
bool prevclassok = (Options.prev_cls == '*');
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 3ffea35dd0..ffb09dde4b 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -26,7 +26,7 @@
#include "abl-show.h"
#include "branch.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "format.h"
#include "fight.h"
#include "initfile.h"
diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc
index cf02458678..b7968ea31f 100644
--- a/crawl-ref/source/overmap.cc
+++ b/crawl-ref/source/overmap.cc
@@ -29,7 +29,7 @@
#include "branch.h"
#include "cio.h"
#include "dgnevent.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "files.h"
#include "menu.h"
diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc
index d737bcb0d7..5e4744d7c3 100644
--- a/crawl-ref/source/quiver.cc
+++ b/crawl-ref/source/quiver.cc
@@ -18,6 +18,8 @@
#include "stuff.h"
#include "tags.h"
+#include <algorithm>
+
// checks base_type for OBJ_UNASSIGNED, and quantity
// bool is_valid_item( const item_def &item )
@@ -32,7 +34,7 @@ static bool _items_similar(const item_def& a, const item_def& b);
player_quiver::player_quiver()
: m_last_used_type(AMMO_THROW)
{
- COMPILE_CHECK(ARRAYSIZE(m_last_used_of_type) == NUM_AMMO, a);
+ COMPILE_CHECK(ARRAYSZ(m_last_used_of_type) == NUM_AMMO, a);
}
// Return:
@@ -292,16 +294,16 @@ void player_quiver::_get_fire_order(
// Save/load
// ----------------------------------------------------------------------
-static const short QUIVER_COOKIE = static_cast<short>(0xb015);
+static const short QUIVER_COOKIE = short(0xb015);
void player_quiver::save(writer& outf) const
{
marshallShort(outf, QUIVER_COOKIE);
marshallItem(outf, m_last_weapon);
marshallLong(outf, m_last_used_type);
- marshallLong(outf, ARRAYSIZE(m_last_used_of_type));
+ marshallLong(outf, ARRAYSZ(m_last_used_of_type));
- for (unsigned int i = 0; i < ARRAYSIZE(m_last_used_of_type); i++)
+ for (unsigned int i = 0; i < ARRAYSZ(m_last_used_of_type); i++)
marshallItem(outf, m_last_used_of_type[i]);
}
@@ -315,7 +317,7 @@ void player_quiver::load(reader& inf)
ASSERT(m_last_used_type >= AMMO_THROW && m_last_used_type < NUM_AMMO);
const unsigned long count = unmarshallLong(inf);
- ASSERT(count <= ARRAYSIZE(m_last_used_of_type));
+ ASSERT(count <= ARRAYSZ(m_last_used_of_type));
for (unsigned int i = 0; i < count; i++)
unmarshallItem(inf, m_last_used_of_type[i]);
@@ -328,9 +330,9 @@ void player_quiver::load(reader& inf)
preserve_quiver_slots::preserve_quiver_slots()
{
if (!you.m_quiver) return;
- COMPILE_CHECK(ARRAYSIZE(m_last_used_of_type) ==
- ARRAYSIZE(you.m_quiver->m_last_used_of_type), a);
- for (unsigned int i = 0; i < ARRAYSIZE(m_last_used_of_type); i++)
+ COMPILE_CHECK(ARRAYSZ(m_last_used_of_type) ==
+ ARRAYSZ(you.m_quiver->m_last_used_of_type), a);
+ for (unsigned int i = 0; i < ARRAYSZ(m_last_used_of_type); i++)
{
m_last_used_of_type[i] =
_get_pack_slot(you.m_quiver->m_last_used_of_type[i]);
@@ -340,7 +342,7 @@ preserve_quiver_slots::preserve_quiver_slots()
preserve_quiver_slots::~preserve_quiver_slots()
{
if (! you.m_quiver) return;
- for (unsigned int i = 0; i < ARRAYSIZE(m_last_used_of_type); i++)
+ for (unsigned int i = 0; i < ARRAYSZ(m_last_used_of_type); i++)
{
const int slot = m_last_used_of_type[i];
if (slot != -1)
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 6b803b434c..1ff77bcc29 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -966,7 +966,7 @@ static bool _beogh_blessing_reinforcement()
for (int i = 0; i < how_many; ++i)
{
monster_type follower_type =
- followers[random2(ARRAYSIZE(followers))];
+ followers[random2(ARRAYSZ(followers))];
int monster = create_monster(follower_type, 0, BEH_GOD_GIFT,
you.x_pos, you.y_pos, you.pet_target,
@@ -2209,7 +2209,7 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known,
"Create Life"
};
- COMPILE_CHECK(ARRAYSIZE(conducts) == NUM_CONDUCTS, c1);
+ COMPILE_CHECK(ARRAYSZ(conducts) == NUM_CONDUCTS, c1);
mprf( MSGCH_DIAGNOSTICS,
"conduct: %s; piety: %d (%+d); penance: %d (%+d)",
conducts[thing_done],
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 8e4702584d..1e9d1bb5f0 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -29,7 +29,7 @@
#include "abyss.h"
#include "beam.h"
#include "cloud.h"
-#include "direct.h"
+#include "directn.h"
#include "effects.h"
#include "invent.h"
#include "it_use2.h"
@@ -905,7 +905,7 @@ void antimagic()
if (!you.permanent_flight() && you.duration[DUR_CONTROLLED_FLIGHT] > 1)
you.duration[DUR_CONTROLLED_FLIGHT] = 1;
- for ( unsigned int i = 0; i < ARRAYSIZE(dur_list); ++i )
+ for ( unsigned int i = 0; i < ARRAYSZ(dur_list); ++i )
if ( you.duration[dur_list[i]] > 1 )
you.duration[dur_list[i]] = 1;
diff --git a/crawl-ref/source/spells1.h b/crawl-ref/source/spells1.h
index 66b66c0187..816ce24386 100644
--- a/crawl-ref/source/spells1.h
+++ b/crawl-ref/source/spells1.h
@@ -16,7 +16,7 @@
#include "externs.h"
-#include "direct.h"
+#include "directn.h"
struct bolt;
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 3b52fc9428..17bc885061 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -32,7 +32,7 @@
#include "beam.h"
#include "cloud.h"
#include "delay.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "effects.h"
#include "itemname.h"
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 29126e8206..32ceaa126a 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -27,7 +27,7 @@
#include "beam.h"
#include "branch.h"
#include "cloud.h"
-#include "direct.h"
+#include "directn.h"
#include "debug.h"
#include "delay.h"
#include "effects.h" // holy word
@@ -755,7 +755,7 @@ bool entomb(int powc)
continue;
bool proceed = false;
- for (unsigned int i = 0; i < ARRAYSIZE(safe_to_overwrite); ++i)
+ for (unsigned int i = 0; i < ARRAYSZ(safe_to_overwrite); ++i)
{
if (grd[srx][sry] == safe_to_overwrite[i])
{
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 18a23fe6d9..6347edfcf4 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -27,7 +27,7 @@
#include "debug.h"
#include "delay.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "effects.h"
#include "it_use2.h"
@@ -750,7 +750,7 @@ static bool is_domesticated_animal(int type)
MONS_SPINY_FROG, MONS_BLINK_FROG, MONS_WOLF, MONS_WARG,
MONS_BEAR, MONS_GRIZZLY_BEAR, MONS_POLAR_BEAR, MONS_BLACK_BEAR
};
- for ( unsigned int i = 0; i < ARRAYSIZE(types); ++i )
+ for ( unsigned int i = 0; i < ARRAYSZ(types); ++i )
if ( types[i] == type )
return true;
return false;
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 1b7d2dfdd7..b100a966cb 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -3676,7 +3676,7 @@ static int _power_to_barcount( int power )
const int breakpoints[] = { 5, 10, 15, 25, 35, 50, 75, 100, 150 };
int result = 0;
- for ( unsigned int i = 0; i < ARRAYSIZE(breakpoints); ++i )
+ for ( unsigned int i = 0; i < ARRAYSZ(breakpoints); ++i )
if ( power > breakpoints[i] )
++result;
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index abf3ebabc6..d6993925e7 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -24,7 +24,7 @@
#include "externs.h"
#include "beam.h"
-#include "direct.h"
+#include "directn.h"
#include "debug.h"
#include "stuff.h"
#include "itemname.h"
diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h
index 98ff8faac8..c7d60e80ae 100644
--- a/crawl-ref/source/spl-util.h
+++ b/crawl-ref/source/spl-util.h
@@ -16,7 +16,7 @@
#define SPL_UTIL_H
#include "enum.h" // just for NUM_SPELL_TYPES and TARG_ENEMY
-#include "direct.h" // just for DIR_NONE
+#include "directn.h" // just for DIR_NONE
enum spschool_flag_type
{
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index 69b52bdd73..314dd4fe19 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -13,7 +13,7 @@
#include "clua.h"
#include "command.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "food.h"
#include "itemname.h"
#include "itemprop.h"
diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc
index 992380132e..8cb1300b5b 100644
--- a/crawl-ref/source/state.cc
+++ b/crawl-ref/source/state.cc
@@ -14,7 +14,7 @@
#include "externs.h"
#include "delay.h"
-#include "direct.h"
+#include "directn.h"
#include "macro.h"
#include "menu.h" // For print_formatted_paragraph()
#include "message.h"
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 359ff03da3..9bbec1f7c7 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -16,7 +16,7 @@
#include "AppHdr.h"
#include "cio.h"
#include "database.h"
-#include "direct.h"
+#include "directn.h"
#include "message.h"
#include "misc.h"
#include "monplace.h"
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index 7ed006e988..a96c3647b3 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -17,7 +17,7 @@
#include <algorithm>
#include "dgnevent.h"
-#include "direct.h"
+#include "directn.h"
#include "itemprop.h"
#include "items.h"
#include "message.h"
@@ -254,7 +254,7 @@ void get_door_description(int door_size, const char** adjective, const char** no
"huge " , "gate",
};
- const unsigned int idx = MIN((unsigned int)door_size*2, ARRAYSIZE(descriptions)-2);
+ const unsigned int idx = MIN((unsigned int)door_size*2, ARRAYSZ(descriptions)-2);
*adjective = descriptions[idx];
*noun = descriptions[idx+1];
}
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index 6828ca631f..e3f0d6e52c 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -9,7 +9,7 @@
#ifdef USE_TILE
#include <stdio.h>
#include "decks.h"
-#include "direct.h"
+#include "directn.h"
#include "externs.h"
#include "food.h"
#include "itemname.h"
diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc
index 16b75861d5..09d309d02c 100644
--- a/crawl-ref/source/tile2.cc
+++ b/crawl-ref/source/tile2.cc
@@ -14,7 +14,7 @@
#include "branch.h"
#include "describe.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "files.h"
#include "ghost.h"
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index 0bcc023131..ce766cbe40 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -173,7 +173,7 @@ bool transform(int pow, transformation_type which_trans)
};
std::set<equipment_type> rem_stuff(default_rem,
- default_rem + ARRAYSIZE(default_rem));
+ default_rem + ARRAYSZ(default_rem));
you.redraw_evasion = true;
you.redraw_armour_class = true;
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 0301a3082e..b5f9fe7c99 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -20,7 +20,7 @@
#include "beam.h"
#include "branch.h"
#include "delay.h"
-#include "direct.h"
+#include "directn.h"
#include "it_use2.h"
#include "items.h"
#include "itemprop.h"
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 54e4fe8194..2822672f93 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -19,7 +19,7 @@
#include "delay.h"
#include "describe.h"
#include "dgnevent.h"
-#include "direct.h"
+#include "directn.h"
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index b43475b8a8..a642aea2b0 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -46,7 +46,7 @@
#include "debug.h"
#include "delay.h"
#include "dgnevent.h"
-#include "direct.h"
+#include "directn.h"
#include "dungeon.h"
#include "format.h"
#include "ghost.h"
@@ -4945,7 +4945,7 @@ void crawl_view_buffer::size(const coord_def &sz)
// Layout helper classes
// ----------------------------------------------------------------------
-// Moved from direct.h, where they didn't need to be.
+// Moved from directn.h, where they didn't need to be.
// define VIEW_MIN_HEIGHT defined elsewhere
// define VIEW_MAX_HEIGHT use Options.view_max_height
// define VIEW_MIN_WIDTH defined elsewhere
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index e00f3b8e43..2427a2b680 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -186,7 +186,7 @@ void xom_makes_you_cast_random_spell(int sever)
god_acting gdact(GOD_XOM);
- const int nxomspells = ARRAYSIZE(xom_spells);
+ const int nxomspells = ARRAYSZ(xom_spells);
if (spellenum > nxomspells)
spellenum = nxomspells;