summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-10-17 02:17:53 -0700
committerMatthew Cline <zelgadis@sourceforge.net>2009-10-17 02:17:53 -0700
commitce61d4dca1b5ae83a387b52c159f6f8d76686352 (patch)
tree88baecc7e23d29522283cbb9e73147a5ef53e43c /crawl-ref
parentd7b69831347bab507a9634382f20654bbe5d0d6b (diff)
parent23d8378913ba999f3f2da4afc1de86487037bb6f (diff)
downloadcrawl-ref-ce61d4dca1b5ae83a387b52c159f6f8d76686352.tar.gz
crawl-ref-ce61d4dca1b5ae83a387b52c159f6f8d76686352.zip
Merge branch 'master' of ssh://zelgadis@crawl-ref.git.sourceforge.net/gitroot/crawl-ref/crawl-ref
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/INSTALL.txt538
-rw-r--r--crawl-ref/source/abyss.cc16
-rw-r--r--crawl-ref/source/acr.cc14
-rw-r--r--crawl-ref/source/beam.cc38
-rw-r--r--crawl-ref/source/cloud.cc4
-rw-r--r--crawl-ref/source/debug.cc12
-rw-r--r--crawl-ref/source/decks.cc4
-rw-r--r--crawl-ref/source/directn.cc18
-rw-r--r--crawl-ref/source/dungeon.cc60
-rw-r--r--crawl-ref/source/dungeon.h12
-rw-r--r--crawl-ref/source/effects.cc44
-rw-r--r--crawl-ref/source/fight.cc4
-rw-r--r--crawl-ref/source/files.cc6
-rw-r--r--crawl-ref/source/it_use2.cc2
-rw-r--r--crawl-ref/source/item_use.cc4
-rw-r--r--crawl-ref/source/items.cc8
-rw-r--r--crawl-ref/source/losparam.cc6
-rw-r--r--crawl-ref/source/luadgn.cc8
-rw-r--r--crawl-ref/source/makefile155
-rw-r--r--crawl-ref/source/maps.cc6
-rw-r--r--crawl-ref/source/menu.cc3
-rw-r--r--crawl-ref/source/misc.cc50
-rw-r--r--crawl-ref/source/mon-util.cc30
-rw-r--r--crawl-ref/source/monplace.cc100
-rw-r--r--crawl-ref/source/monplace.h2
-rw-r--r--crawl-ref/source/monstuff.cc68
-rw-r--r--crawl-ref/source/mstuff2.cc4
-rw-r--r--crawl-ref/source/overmap.cc8
-rw-r--r--crawl-ref/source/player.cc22
-rw-r--r--crawl-ref/source/player.h2
-rw-r--r--crawl-ref/source/ray.cc6
-rw-r--r--crawl-ref/source/religion.cc14
-rw-r--r--crawl-ref/source/spells1.cc10
-rw-r--r--crawl-ref/source/spells2.cc6
-rw-r--r--crawl-ref/source/spells3.cc6
-rw-r--r--crawl-ref/source/spells4.cc6
-rw-r--r--crawl-ref/source/spl-mis.cc6
-rw-r--r--crawl-ref/source/spl-util.cc2
-rw-r--r--crawl-ref/source/stash.cc4
-rw-r--r--crawl-ref/source/stuff.cc4
-rw-r--r--crawl-ref/source/terrain.cc321
-rw-r--r--crawl-ref/source/terrain.h60
-rw-r--r--crawl-ref/source/tilepick.cc22
-rw-r--r--crawl-ref/source/tilereg.cc22
-rw-r--r--crawl-ref/source/travel.cc189
-rw-r--r--crawl-ref/source/travel.h16
-rw-r--r--crawl-ref/source/tutorial.cc15
-rw-r--r--crawl-ref/source/view.cc119
-rw-r--r--crawl-ref/source/xom.cc38
49 files changed, 992 insertions, 1122 deletions
diff --git a/crawl-ref/INSTALL.txt b/crawl-ref/INSTALL.txt
index 6c13f73c1b..a208cdd446 100644
--- a/crawl-ref/INSTALL.txt
+++ b/crawl-ref/INSTALL.txt
@@ -5,9 +5,9 @@ Install instructions for Dungeon Crawl Stone Soup (DCSS)
Getting DCSS to run
-------------------
-This file describes how to compile a runtime executable of DCSS from the
-source code. If you're trying to compile Crawl yourself, skip ahead to the
-next section, "Building Dungeon Crawl Stone Soup".
+This file describes how to compile a runtime executable of DCSS from the source
+code. If you're trying to compile Crawl yourself, skip ahead to the next
+section, "Building Dungeon Crawl Stone Soup".
If, however, you're having trouble getting a precompiled binary to run:
@@ -39,23 +39,21 @@ The rest of the file deals with compiling from the source.
Building Dungeon Crawl Stone Soup
---------------------------------
-Crawl Stone Soup is known to compile successfully on the following
-platforms as of version 0.3:
+Crawl Stone Soup is known to compile successfully on the following platforms as
+of version 0.3:
-- Any Unix with a recent gcc (and g++), GNU make and libncurses,
- including Linux and Mac OS X. "Recent" is defined as gcc 3.3 or
- newer.
-- Microsoft Windows NT/2000/XP. The game will also run on Windows 9X
- and ME. DOS binaries can also be compiled on Windows NT+.
+- Any Unix with a recent gcc (and g++), GNU make and libncurses, including Linux
+ and Mac OS X. "Recent" is defined as gcc 3.3 or newer.
+- Microsoft Windows NT/2000/XP. The game will also run on Windows 9X and ME. DOS
+ binaries can also be compiled on Windows NT+.
-The only supported compiler is gcc (available on almost all Unixes,
-and as djgpp for DOS, and MinGW for Windows).
+The only supported compiler is gcc (available on almost all Unixes, and as djgpp
+for DOS, and MinGW for Windows).
-Other platforms are unsupported, but you should be able to build Crawl
-on pretty much any operating system with a modern C++ compiler (full
-support for the standard C++ library, in particular <string>, the
-collection classes and <algorithm> is necessary) and the curses
-library.
+Other platforms are unsupported, but you should be able to build Crawl on pretty
+much any operating system with a modern C++ compiler (full support for the
+standard C++ library, in particular <string>, the collection classes and
+<algorithm> is necessary) and the curses library.
Optional libraries
@@ -69,45 +67,26 @@ Crawl can be built with some optional features:
* Unicode characters for the map (Unix only).
Crawl Stone Soup also uses a level compiler to compile special level
-definitions; to make changes to the level compiler, you'll need the
-flex and bison/byacc tools (Other lex/yaccs may also work). More
-details are available below.
+definitions; to make changes to the level compiler, you'll need the flex and
+bison/byacc tools (Other lex/yaccs may also work). More details are available
+below.
-Sounds must be enabled by editing AppHdr.h (uncomment
-SOUND_PLAY_COMMAND on Unixes or WINMM_PLAY_SOUNDS on Windows).
+Sounds must be enabled by editing AppHdr.h (uncomment SOUND_PLAY_COMMAND on
+Unixes or WINMM_PLAY_SOUNDS on Windows).
-Regular expressions require libpcre on non-Unix operating systems. On
-Unixes, the standard POSIX regular expression support is adequate for
-Crawl's needs.
+Regular expressions require libpcre on non-Unix operating systems. On Unixes,
+the standard POSIX regular expression support is adequate for Crawl's needs.
-Stone Soup 0.3 includes Lua 5.1.2 in its source tree. Crawl uses Lua
-for dungeon generation. In addition, Crawl has a (rudimentary) Lua
-interface for users to run scripts which can do things such as
-conditionalise parts of the .crawlrc/init.txt. Such user Lua scripts
-are enabled by default, but can be turned off by removing
--DCLUA_BINDINGS from your makefile.
+Stone Soup 0.3 includes Lua 5.1.2 in its source tree. Crawl uses Lua for dungeon
+generation. In addition, Crawl has a (rudimentary) Lua interface for users to
+run scripts which can do things such as conditionalise parts of the
+.crawlrc/init.txt. Such user Lua scripts are enabled by default, but can be
+turned off by removing -DCLUA_BINDINGS from your makefile.
-Unicode support needs libncursesw and its header files; these are
-usually available in your operating system's package-management
-system. Unicode is not supported on Windows or DOS. Some systems, such
-as Mac OS X, may have Unicode support available in libncurses itself
-(i.e., without a separate libncursesw).
-
-
-Makefile system
----------------
-
-Crawl uses a selector makefile (under source/makefile) to control what
-platform it's building for. Your first step in building Crawl should be
-to edit source/makefile and point it at the correct platform makefile.
-For instance, if you're building for Windows, you'd use
-MAKEFILE=makefile.mgw to build with MinGW for Windows (# is used for
-comments in makefiles).
-
-Consult the operating-system specific sections for detailed
-information on building Crawl. When you're done building Crawl, look
-at the section "Data files" for important information on what files
-Crawl needs as it starts up.
+Unicode support needs libncursesw and its header files; these are usually
+available in your operating system's package-management system. Unicode is not
+supported on Windows or DOS. Some systems, such as Mac OS X, may have Unicode
+support available in libncurses itself (i.e., without a separate libncursesw).
Building on Unix (Linux, *BSD, Solaris, etc.)
@@ -115,179 +94,176 @@ Building on Unix (Linux, *BSD, Solaris, etc.)
Security:
-If you have untrusted local users, we highly recommend you do not
-install Crawl setgid or setuid. Just running "make install" will install
-Crawl setgid games, do *not* do this unless you're sure you trust your
-users.
+If you have untrusted local users, we highly recommend you do not install Crawl
+setgid or setuid. Just running "make install" will install Crawl setgid games,
+do *not* do this unless you're sure you trust your users.
-If you have untrusted users, the correct way to install a multiplayer
-Crawl is using a chrooted game launcher such as dgamelaunch.
+If you have untrusted users, the correct way to install a multiplayer Crawl is
+using a chrooted game launcher such as dgamelaunch.
To install or not to install:
-If only one user on the system (you) is going to be playing Crawl, you
-do not need to use "make install". A simple "make" will build Crawl in
-the source directory, where you can run it as "./crawl".
+If only one user on the system (you) is going to be playing Crawl, you do not
+need to use "make install". A simple "make" will build Crawl in the source
+directory, where you can run it as "./crawl".
Prerequisites:
-GNU gcc and g++, GNU make, libncurses or libcurses. You need the
-development headers for ncurses - they may not be installed by default
-on some Unixes.
+GNU gcc and g++, GNU make, libncurses or libcurses. You need the development
+headers for ncurses - they may not be installed by default on some Unixes.
-flex and bison are optional but highly recommended. Recent versions of
-byacc are also fine (edit your makefile appropriately).
+flex and bison are optional but highly recommended. Recent versions of byacc are
+also fine (edit your makefile appropriately).
If you want to use Unicode, you need to link with a curses library that
-understands Unicode characters, usually named libncursesw (the
-development headers for libncursesw are usually in
-/usr/include/ncursesw.) You also need to have a UTF-8 locale installed.
-You can then build Crawl with support for Unicode by setting
-UNICODE_GLYPHS = y in makefile.unix.
+understands Unicode characters, usually named libncursesw (the development
+headers for libncursesw are usually in /usr/include/ncursesw.) You also need to
+have a UTF-8 locale installed. You can then build Crawl with support for Unicode
+by setting USE_UNICODE on the 'make' command line.
Building:
* cd to the source directory (you can safely ignore the dolinks.sh and
domake.sh scripts).
-* Edit makefile and make sure that MAKEFILE=makefile.unix is
- uncommented and all other MAKEFILE= lines are commented out.
-
-* If you want to install Crawl for multiple users, edit makefile.unix
- and set SAVEDIR and DATADIR to appropriate directories. This is not
- necessary if only one user is going to play Crawl. Also check
- INSTALLDIR and change it if necessary.
-
-* Edit AppHdr.h and check that SAVE_PACKAGE_CMD and LOAD_UNPACKAGE_CMD
- are set correctly for your system. If you do not want your saves
- packaged in a zip archive, it's safe to comment out SAVE_PACKAGE_CMD
- and LOAD_UNPACKAGE_CMD.
-
-* If you don't have (or don't want to use) flex or bison, edit
- makefile.unix and set DOYACC := n. If you want to use byacc instead
- of bison, edit makefile.unix and set YACC := byacc. On some Unixes,
- you may not have flex (but have some other lex), in which case
- you'll have to set LEX := lex in makefile.unix.
-
-* Run make to build the normal (non-wizard) Crawl. On systems such as
- Solaris, you may have to use gmake for GNU make. Make sure your make
- identifies itself as GNU Make when you do make --version.
-
-* If you're installing Crawl for multiple users, run make install.
- Crawl will be copied into the directory specified by INSTALLDIR. The
- save and data directories will be created if necessary, and the
- level layout (.des) and help files will be copied to the data
- directory.
+* Most users can simply type 'make' without any extra flags, and get a working
+ build as a result. If just typing 'make' works for you, then you shouldn't
+ need to read any further. BSD and Solaris users may have to use 'gmake'
+ instead of 'make'.
-* If you do not want players to be able to script Crawl with Lua,
- edit makefile.unix and remove -DCLUA_BINDINGS from the CFOTHERS line.
+* If you want a graphical (tiled) build, then you should add 'TILES=y' to the
+ 'make' command-line, like so:
+ make TILES=y
-Building on Mac OS X
---------------------
+ Note that the graphical build requires that you have development libraries
+ installed for SDL, SDL_image, libpng, zlib, and freetype. If your system
+ doesn't have these installed, you can usually get them via your package
+ manager (apt-get, emerge, yum, etc).
+
+ If you would rather, you can go to the source/contrib directory and type
+ 'make', and the required libraries should be built for you.
+
+* If you want to install Crawl for multiple users, you can add the savegame
+ path and game data path to the 'make' command line. For instance:
+
+ make prefix=/usr/games/crawl SAVEDIR=saves/ DATADIR=data/
-You can follow the Unix instructions to build Crawl (but note you
-still need to install Xcode to get gcc and make), or alternatively you
-can use Xcode.
+ Please note that SAVEDIR and DATADIR are relative to 'prefix'.
-Note that the Unix instructions will build Crawl assuming that your
-terminal can display 16 colours. If you're planning to use
-Terminal.app (which supports only 8 colours), or you want a tiles
-build, you should follow the Mac build instructions below.
+ Of course, you should make sure that SAVEDIR and DATADIR reference the
+ appropriate directories. This is not necessary if only one user is going to
+ play Crawl.
-* Crawl has been tested to build under Xcode 3.2 on OS X 10.6.1, but
- is likely to be buildable with earlier versions.
+* Edit AppHdr.h and check that SAVE_PACKAGE_CMD and LOAD_UNPACKAGE_CMD are set
+ correctly for your system. If you do not want your saves packaged in a zip
+ archive, it's safe to comment out SAVE_PACKAGE_CMD and LOAD_UNPACKAGE_CMD.
-* Make sure Xcode is installed. Xcode should be available on the OS X
- install DVD if you haven't already installed it.
+* If you're installing Crawl for multiple users, run 'make install' as root.
+ Crawl will be copied into the directory specified by 'prefix' (see above). The
+ save and data directories will be created if necessary, and the level layout
+ and help files will be copied to the data directory.
-* You need to get the appropriate frameworks for libpng, SDL, SDL_image
- and Freetype2 installed to /Library/Frameworks.
+* If you do not want players to be able to script Crawl with Lua, add
+ 'NO_LUA_BINDINGS=y' to the 'make' command-line.
- - SDL and SDL_image frameworks can be downloaded from libsdl.org:
- http://www.libsdl.org/download-1.2.php
- http://www.libsdl.org/projects/SDL_image
- - libpng and Freetype2 need to be built from source to be compiled
- as frameworks. Let's start with libpng. Check out the source from
- git://git.uplinklabs.net/pub/scm/git/tycho/libpng.git
- and build it using the Xcode project in projects/xcode.
+Building on Mac OS X
+--------------------
- - Once libpng finishes compiling, move the libpng.framework folder
- from projects/xcode/build/Release to /Library/Frameworks.
+For non-graphical builds, you can use the Unix build process described above, or
+you can use Xcode, as described below.
- - Now get Freetype2:
- git://git.uplinklabs.net/pub/scm/git/tycho/freetype.git
- and build it using the Xcode project in builds/mac/Xcode.
+For graphical builds, we do not support the use of the Unix build process for
+various reasons.
- - Move the compiled Freetype framework to /Library/Frameworks
+* Crawl is officially build and tested under Xcode 3.2 on OS X 10.6.1, but
+ it's highly likely that other versions of Xcode will work fine.
- - You've now got the necessary dependencies installed and you can
- proceed to build Crawl.
+* Make sure Xcode is installed. Xcode should be available on the Mac OS X
+ install DVD if you haven't already installed it. You can also download Xcode
+ from Apple's website (note that their website often has versions of Xcode
+ that are newer than the versions distributed on their Mac OS X DVDs):
+ http://developer.apple.com/TOOLS/Xcode/
* Open the Xcode project (Crawl.xcodeproj) under the "source"
directory.
-* Hit Build in Xcode.
-
-* The default build configuration, Release, will build a ppc/i386
- Universal binary suitable for play on all OS X 10.4 or newer
- systems. The other build configurations are intended for development
- and may not result in a binary that can be distributed to others.
+* Hit Build in Xcode. This should build all the necessary dependencies,
+ including libpng, freetype, SDL, and SDL_image, and then finally build Crawl
+ itself. The process may take quite a while, so go grab a coke or a cup of
+ coffee.
-* You can also use makefile.osx, which will run xcodebuild from the
- command line.
+* The default build configuration, Release, will build a ppc/i386 Universal
+ binary suitable for play on all OS X 10.4 or newer systems. The other build
+ configurations are intended for development and may not result in a binary
+ that can be distributed to others.
-* If you'd like users to be able to script Crawl with Lua, you can
- edit AppHdr.h, uncomment
+* If you'd like users to be able to script Crawl with Lua, you can edit
+ AppHdr.h, uncomment
// #define CLUA_BINDINGS
- and rebuild to compile with Lua support. See the section on Lua
- for more information.
+ and rebuild to compile with Lua support. See the section on Lua for more
+ information.
Building on Windows (MinGW)
---------------------------
-NOTE: You cannot build Windows binaries on Windows 9x/ME using the
-MinGW makefile supplied (which needs the cmd.exe shell of the Windows
-NT family). If you're on 9x/ME, you can use the Cygwin build
-instructions, or build a binary on a Windows NT/2k/XP system (the
-binary will run on 9x), or build a DOS binary.
+NOTE: You cannot build Windows binaries on Windows 9x/ME using MinGW. On 9x/ME,
+you can use the Cygwin build instructions, or build a binary on a Windows
+NT/2k/XP system (the binary will run on 9x), or build a DOS binary.
-* Install MinGW from http://www.mingw.org. The MinGW installer
- is best so you don't have to fiddle with individual packages (you can
- mess with the individual packages if you like to, of course). If you
- want to edit the level compiler, also get the flex and bison packages
- (available from the GnuWin32 project on Sourceforge:
- http://gnuwin32.sourceforge.net/).
+* To install MinGW, you have two options. You can install via the installer
+ provided by the MinGW project (http://www.mingw.org), but this is not
+ officially supported by the Crawl team. If you have problems with it, we will
+ not help you until you get a supported version of MinGW, which can be obtained
+ from the msysgit project. msysgit is a full MinGW setup that even includes Git
+ (which happens to be the source code management system used by the Crawl team).
+ To get msysgit, be sure to download the 'netinstall' from here:
-* Make sure you have g++ and mingw32-make in your path.
+ http://code.google.com/p/msysgit/downloads/list
-* cd to the the Crawl source directory.
+ NOTE: Do NOT get any of the versions that do not have 'netinstall' in the
+ filename. The 'netinstall' is the only one used by the Crawl team.
-* Build Crawl by running
- mingw32-make MAKEFILE=makefile.mgw install
+* If you intend to build a graphical (tiled) build of Crawl, you will need to
+ upgrade the version of GNU Make included with MinGW. FreeType's build system
+ requires a minimum of GNU Make v3.80. You can obtain this from here, under the
+ GNU Make category:
+
+ https://sourceforge.net/projects/mingw/files/
-* If you have flex and bison, edit makefile.mgw and set DOYACC := y.
+ To install it, simply extract it with an unarchiver (such as WinRAR) to
+ c:\msysgit (or wherever you installed msysgit).
-* When you're done, you should have crawl.exe under a "rel"
- subdirectory.
+* Start msys by running 'c:\msysgit\msys.bat'. Now you're in a MinGW build
+ environment.
+
+* cd to the the Crawl source directory. For instance, if you have the crawl
+ sources in c:\crawl\source, you would type 'cd /c/crawl/source'.
+
+* Build Crawl by running 'make'. If you want a graphical build, you will need to
+ add 'TILES=y' on the 'make' command line.
+
+* When the process finishes, you should be able to run crawl right from the
+ sources directory by typing './crawl'
Building on Windows (cygwin)
----------------------------
-* Get Cygwin from http://www.cygwin.com/. When installing, ensure that
- the following packages are selected: gcc, g++, make, flex, bison,
- libncurses-devel. If you'd like to build from svn, install the svn
- client. You may also want to install diff and patch if you'd like to
- apply third party patches, or create your own.
+* Get Cygwin from http://www.cygwin.com/. When installing, ensure that the
+ following packages are selected: gcc, g++, make, flex, bison,
+ libncurses-devel. If you'd like to build from git, install the git-core
+ package. You may also want to install diff, patch, and other such tools.
* Once Cygwin is installed, open a Cygwin bash shell (use the Start
- menu, do not double-click bash.exe in Explorer). cd to the Crawl
- source directory.
+ menu or desktop icon, do not double-click bash.exe in Explorer).
+
+* cd to the the Crawl source directory. For instance, if you have the crawl
+ sources in c:\crawl\source, you would type 'cd /cygdrive/c/crawl/source'.
* Follow the Linux build instructions to build Crawl.
@@ -309,7 +285,7 @@ Building for DOS (djgpp)
* cd to the Crawl source directory.
* Build Crawl by running
- make MAKEFILE=makefile.dos
+ make -f makefile.dos
* When the build is done, crawl.exe should be in the source directory.
@@ -317,22 +293,14 @@ Building for DOS (djgpp)
Building Tiles versions
-----------------------
-* For Windows builds, run
- make MAKEFILE=makefile_tiles.mgw
-
- See the next section for step-by-step instructions.
+* On most platforms, you can simply type:
+ make TILES=y
-* For Linux builds, run
- make MAKEFILE=makefile_tiles.unix
+* If you compiled the ASCII binary before, you'll need to run 'make clean'
+ before running 'make'.
-* For Mac OS X builds, run
- make MAKEFILE=makefile_tiles.unix OSX=y
-
-* If you compiled the ASCII binary before you'll need to run make clean
- before running make.
-
-* All platforms require the same prerequisites listed in the other
- sections above for building each of these platforms.
+* All platforms require the same prerequisites listed in the other sections
+ above for building each of these platforms.
* All platforms additionally require the development versions of the following
software packages installed.
@@ -342,74 +310,20 @@ Building Tiles versions
* libpng (http://www.libpng.org/pub/png/libpng.html)
* Freetype 2 (http://www.freetype.org/download.html)
- On Mac OS X, these are expected to be installed as frameworks to
- /Library/Frameworks.
+ On Linux, these can be installed via a package manager (apt-get, emerge,
+ yum, etc).
- On Linux, these can be installed via a package manager.
+ On Mac OS X, these will be compiled automatically when you build the Xcode
+ project.
- On Windows, they should be installed, compiled, and the headers and libs
- placed in a location that the compiler can find them via its default include
- and library paths.
+ On Windows (MinGW or Cygwin), these will be compiled as needed when you run
+ 'make TILES=y'.
* If you want both ASCII and Tiles binaries you need to compile them
separately, rename one of them, and copy them into the same Crawl
directory.
-Building Tiles on Windows (MinGW)
----------------------------------
-The following instructions were submitted by zebez.
-
-The following assumes you have a working install of MinGW and is only tested
-on 4.4.0. See "Building on Windows (MinGW)" above to find out where to get it.
-
-You need:
-* freetype-2.3.5-1-bin.zip
- (http://gnuwin32.sourceforge.net/packages/freetype.htm)
-
-Get the Binaries zip file.
-Extract it to your MinGW folder.
-In your MinGW include/ folder go into "freetype2" and move "freetype" to your
-MinGW include/ folder. Delete the "freetyp2" folder.
-
-* libpng-1.2.37-bin.zip
-* libpng-1.2.37-lib.zip
-* zlib-1.2.3-lib.zip
- (http://sourceforge.net/projects/gnuwin32/files/)
-
-Extract them to your MinGW folder.
-
-* SDL-devel-1.2.13-mingw32.tar.gz
- (http://www.libsdl.org/download-1.2.php)
-
-Extract to your MinGW folder.
-If there is a folder named SDL-1.2.13 in your MinGW folder now, move all its
-contents to your MinGW root folder.
-
-* SDL_image-devel-1.2.7-VC9.zip
- (http://www.libsdl.org/projects/SDL_image/)
-
-Extract to your MinGW folder.
-If there is a folder named SDL_image-1.2.7 in your MinGW folder now, move all
-its contents to your MinGW root folder.
-Move these dll files from your MinGW lib/ folder to your MinGW bin/ folder:
-libpng12-0.dll, SDL_image.dll and zlib1.dll.
-
-Then run, from Stonesoup source folder:
- mingw32-make -f makefile_tiles.mgw install
-
-After a while it should have compiled to source/rel/. Now to actually run it
-you need to copy these dlls from MinGW bin/ to the source/rel/ folder:
-freetype6.dll, SDL.dll, libpng12-0.dll, SDL_image.dll and zlib1.dll.
-
-Depending on your compiler options you might also need libgcc_s_dw2-1.dll,
-also from the MinGW bin/ folder. You can disable the latter by adding
--static-libgcc to the compiler options in the makefile.
-
-You can suppress the compilation warnings by adding
--Wno-parentheses -Wno-array-bounds to the makefile. You'll still get some
-warnings, but everything should work fine.
-
*****************************************************************************
Data files
----------
@@ -423,42 +337,30 @@ Crawl looks for several data files when starting up. They include:
All these files are in the source tree under source/dat.
-Crawl will also look for documentation files when players invoke the
-help system. These files are available under the docs directory.
-
-Your built Crawl binary must be able to find these files, or it will
-not start.
+Crawl will also look for documentation files when players invoke the help
+system. These files are available under the docs directory.
-If Crawl is built without an explicit DATA_DIR_PATH (this is the most
-common setup), it will search for its data files under the current
-directory, and if it can't find them there, one level above the
-current directory. In short, it uses these search paths: ., ./dat,
-./docs, .., ../dat, ../docs.
+Your built Crawl binary must be able to find these files, or it will not start.
-If Crawl is built with an explicit DATA_DIR_PATH (for multiuser
-installs on Unix), it will look for its startup files strictly under
-that directory: $DIR, $DIR/dat, $DIR/docs.
+If Crawl is built without an explicit DATA_DIR_PATH (this is the most common
+setup), it will search for its data files under the current directory, and if it
+can't find them there, one level above the current directory. In short, it uses
+these search paths: ., ./dat, ./docs, .., ../dat, ../docs.
-As Crawl loads its startup files, it will convert them to a binary
-format (so that future startups will be faster) and store these binary
-files in the saves directory. These binary files (with extensions .db,
-.dsc, .idx, .lk) can be safely deleted as long as there is no running
-Crawl, and they will be regenerated the next time Crawl starts.
*****************************************************************************
The level compiler
------------------
-Crawl uses a level compiler to read the level design (.des) files in
-the source/dat directory.
+Crawl uses a level compiler to read the level design (.des) files in the
+source/dat directory.
-If you're using one of the standard makefiles, the steps described in
-this section are performed automatically:
+If you're using one of standard makefile, the steps described in this section
+are performed automatically:
-The level compiler source is in the source/util directory (levcomp.lpp
-and levcomp.ypp). The steps involved in building the level compiler
-are:
+The level compiler source is in the source/util directory (levcomp.lpp and
+levcomp.ypp). The steps involved in building the level compiler are:
* Run flex on levcomp.lpp to produce the levcomp.lex.cc lexer.
* Run bison on levcomp.ypp to produce the levcomp.tab.cc parser and
@@ -471,6 +373,7 @@ intermediate files are provided under source/prebuilt. The makefiles
provided with the Crawl source distribution will use these
pre-generated files automatically if flex/bison is not available.
+
*****************************************************************************
Optional Libraries (Lua and PCRE)
---------------------------------
@@ -480,67 +383,58 @@ Lua
Security on multiuser systems (Unix):
-Enabling Lua user scripts is unsuitable for Crawl installed setuid or
-setgid - we have not audited the user scripting interface for
-security. If you're not planning to install Crawl setuid/setgid (not
-running set[ug]id is a good idea in general), you can enable the Lua
-user-script bindings safely.
+Enabling Lua user scripts is unsuitable for Crawl installed setuid or setgid -
+we have not audited the user scripting interface for security. If you're not
+planning to install Crawl setuid/setgid (not running set[ug]id is a good idea in
+general), you can enable the Lua user-script bindings safely.
-As of 0.3, the Lua source is included with Crawl. The only step needed
-to enable user-scripts is to uncomment CLUA_BINDINGS in AppHdr.h.
+As of 0.3, the Lua source is included with Crawl. The only step needed to enable
+user-scripts is to uncomment CLUA_BINDINGS in AppHdr.h.
PCRE
----
-As of 0.4.2, PCRE 7.7 source is included with Crawl. It is enabled
-by default. The sources in pcre/util are identical to the 7.7 distro
-except for removed cmake, doc, and testdata folders (unused by Crawl)
-and a hand-rolled Makefile.
+As of 0.6.0, PCRE 7.9 source is included with Crawl. It is enabled by default.
+The sources in contrib/pcre are identical to the 7.9 distro except for the use
+of a custom-made Makefile instead of the automake system that was in place
+previously.
+
+On Unixes, you're better served by the existing POSIX regular expression
+support. If you want PCRE, your package management system is again your best
+bet. Remember to install development headers, not just the plain library.
-On Unixes, you're better served by the existing POSIX regular
-expression support. If you want PCRE, your package management system
-is again your best bet. Remember to install development headers, not
-just the plain library.
Unicode (Unix only)
-------------------
-Modern Unixes may support Unicode terminals (particularly xterms). If
-you have a terminal that can display Unicode characters, and an
-ncurses library that can handle Unicode (libncursesw, and its devel
-headers), you can build Crawl to display Unicode in the map: set
-UNICODE_GLYPHS = y in makefile.unix.
-
-On Mac OS X, libncurses includes Unicode support; makefile.unix should
-detect Mac OS automatically and link to libncurses when
-UNICODE_GLYPHS=y.
-
-NOTE: You may have libncursesw, but not have the header files; check
-that you have the header files installed as well, or you'll get a lot
-of errors. Crawl expects the ncursesw headers to be in
-/usr/include/ncursesw.
-
-After compiling Crawl with Unicode support, you still need to add the
-line "char_set = unicode" in your .crawlrc to tell Crawl to use
-Unicode. You may also need to set the locale in your terminal (notably
-on Mac OS) if the encoding does not default to UTF-8. To check this,
-run "locale charmap", which should say "UTF-8". If your encoding is
-not UTF-8, you can force it to UTF-8 on most systems by doing "export
-LC_ALL=en_US.UTF-8" or the equivalent, depending on your language
-locale and what shell you're using.
-
-Crawl tries to use en_US.UTF-8 as its default Unicode locale. If you
-do not have this locale installed, but do have some other UTF-8 locale,
-you can tell Crawl to use your preferred UTF-8 locale by setting
-UNICODE_LOCALE = ${foo}.UTF-8 in makefile.unix, where ${foo} is your
-locale name.
-
-You may not want to embed the locale in Crawl itself, but have Crawl
-use the locale as set in the environment LC_* variables. In such
-cases, you can use UNICODE_LOCALE = . in makefile.unix. Crawl will
-then use the locale as set in your environment.
-
-If you're playing Crawl on a remote machine, the remote Crawl should be
-built with Unicode support, it needs to have a UTF-8 locale installed,
-*and* your local terminal (where you're running telnet/ssh) needs to be
-able to decode UTF-8.
+Modern Unixes may support Unicode terminals (particularly xterms). If you have a
+terminal that can display Unicode characters, and an ncurses library that can
+handle Unicode (libncursesw, and its devel headers), you can build Crawl to
+display Unicode in the map: set 'USE_UNICODE=y' when running 'make'.
+
+NOTE: You may have libncursesw, but not have the header files; check that you
+have the header files installed as well, or you'll get a lot of errors. Crawl
+expects the ncursesw headers to be in /usr/include/ncursesw.
+
+After compiling Crawl with Unicode support, you still need to add the line
+"char_set = unicode" in your .crawlrc to tell Crawl to use Unicode. You may also
+need to set the locale in your terminal if the encoding does not default to
+UTF-8. To check this, run "locale charmap", which should say "UTF-8". If your
+encoding is not UTF-8, you can force it to UTF-8 on most systems by doing
+"export LC_ALL=en_US.UTF-8" or the equivalent, depending on your language locale
+and what shell you're using.
+
+Crawl tries to use en_US.UTF-8 as its default Unicode locale. If you do not have
+this locale installed, but do have some other UTF-8 locale, you can tell Crawl
+to use your preferred UTF-8 locale by setting UNICODE_LOCALE=${foo}.UTF-8 on
+the 'make' command line, where ${foo} is your locale name.
+
+You may not want to embed the locale in Crawl itself, but have Crawl use the
+locale as set in the environment LC_* variables. In such cases, you can omit the
+UNICODE_LOCALE option from the 'make' command line. Crawl will then use the
+locale as set in your environment.
+
+If you're playing Crawl on a remote machine, the remote Crawl should be built
+with Unicode support, it needs to have a UTF-8 locale installed, *and* your
+local terminal (where you're running telnet/ssh) needs to be able to decode
+UTF-8.
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index f8c331ad00..5d93e77e67 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -688,7 +688,7 @@ static bool _spawn_corrupted_servant_near(const coord_def &pos)
const coord_def p( pos.x + random2avg(4, 3) + random2(3),
pos.y + random2avg(4, 3) + random2(3) );
if (!in_bounds(p) || actor_at(p)
- || !grid_compatible(DNGN_FLOOR, grd(p)))
+ || !feat_compatible(DNGN_FLOOR, grd(p)))
{
continue;
}
@@ -754,7 +754,7 @@ static bool _is_grid_corruptible(const coord_def &c)
const dungeon_feature_type feat = grd(c);
// Stairs and portals cannot be corrupted.
- if (grid_stair_direction(feat) != CMD_NO_CMD)
+ if (feat_stair_direction(feat) != CMD_NO_CMD)
return (false);
switch (feat)
@@ -788,7 +788,7 @@ static bool _is_crowded_square(const coord_def &c)
continue;
const coord_def n(c.x + xi, c.y + yi);
- if (!in_bounds(n) || !is_traversable(grd(n)))
+ if (!in_bounds(n) || !feat_is_traversable(grd(n)))
continue;
if (++neighbours > 4)
@@ -802,7 +802,7 @@ static bool _is_crowded_square(const coord_def &c)
static bool _is_sealed_square(const coord_def &c)
{
for (adjacent_iterator ai(c); ai; ++ai)
- if ( !grid_is_opaque(grd(*ai)) )
+ if ( !feat_is_opaque(grd(*ai)) )
return (false);
return (true);
@@ -813,7 +813,7 @@ static void _corrupt_square(const crawl_environment &oenv, const coord_def &c)
// To prevent the destruction of, say, branch entries.
bool preserve_feat = true;
dungeon_feature_type feat = DNGN_UNSEEN;
- if (grid_altar_god(grd(c)) != GOD_NO_GOD)
+ if (feat_altar_god(grd(c)) != GOD_NO_GOD)
{
// altars may be safely overwritten, ha!
preserve_feat = false;
@@ -823,19 +823,19 @@ static void _corrupt_square(const crawl_environment &oenv, const coord_def &c)
else
feat = oenv.grid(c);
- if (grid_is_trap(feat, true)
+ if (feat_is_trap(feat, true)
|| feat == DNGN_SECRET_DOOR || feat == DNGN_UNSEEN)
{
return;
}
- if (is_traversable(grd(c)) && !is_traversable(feat)
+ if (feat_is_traversable(grd(c)) && !feat_is_traversable(feat)
&& _is_crowded_square(c))
{
return;
}
- if (!is_traversable(grd(c)) && is_traversable(feat) && _is_sealed_square(c))
+ if (!feat_is_traversable(grd(c)) && feat_is_traversable(feat) && _is_sealed_square(c))
return;
// What's this supposed to achieve? (jpeg)
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index abe9ec0ec8..e4ba83d5cd 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1204,7 +1204,7 @@ static void _go_upstairs()
shop();
return;
}
- else if (grid_stair_direction(ygrd) != CMD_GO_UPSTAIRS)
+ else if (feat_stair_direction(ygrd) != CMD_GO_UPSTAIRS)
{
if (ygrd == DNGN_STONE_ARCH)
mpr("There is nothing on the other side of the stone arch.");
@@ -1243,7 +1243,7 @@ static void _go_downstairs()
return;
}
- if (grid_stair_direction(grd(you.pos())) != CMD_GO_DOWNSTAIRS
+ if (feat_stair_direction(grd(you.pos())) != CMD_GO_DOWNSTAIRS
&& !shaft)
{
if (grd(you.pos()) == DNGN_STONE_ARCH)
@@ -3041,7 +3041,7 @@ static bool _untrap_target(const coord_def move, bool check_confused)
}
const dungeon_feature_type feat = grd(target);
- if (!grid_is_closed_door(feat) || you.confused())
+ if (!feat_is_closed_door(feat) || you.confused())
{
switch (feat)
{
@@ -3053,7 +3053,7 @@ static bool _untrap_target(const coord_def move, bool check_confused)
bool do_msg = true;
// Press trigger/switch/button in wall.
- if (grid_is_solid(feat))
+ if (feat_is_solid(feat))
{
dgn_event event(DET_WALL_HIT, target);
event.arg1 = NON_MONSTER;
@@ -3160,7 +3160,7 @@ static void _open_door(coord_def move, bool check_confused)
const dungeon_feature_type feat = (in_bounds(doorpos) ? grd(doorpos)
: DNGN_UNSEEN);
- if (!grid_is_closed_door(feat))
+ if (!feat_is_closed_door(feat))
{
if (you.confused())
{
@@ -3740,7 +3740,7 @@ static void _move_player(coord_def move)
dungeon_feature_type dangerous = DNGN_FLOOR;
for (adjacent_iterator ai(you.pos(), false); ai; ++ai)
{
- if (is_grid_dangerous(grd(*ai))
+ if (is_feat_dangerous(grd(*ai))
&& (dangerous == DNGN_FLOOR || grd(*ai) == DNGN_LAVA))
{
dangerous = grd(*ai);
@@ -3871,7 +3871,7 @@ static void _move_player(coord_def move)
}
// BCR - Easy doors single move
- if (Options.easy_open && !attacking && grid_is_closed_door(targ_grid))
+ if (Options.easy_open && !attacking && feat_is_closed_door(targ_grid))
{
_open_door(move.x, move.y, false);
you.prev_move = move;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 224ac15eb0..83736773da 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1433,7 +1433,7 @@ static void _munge_bounced_bolt(bolt &old_bolt, bolt &new_bolt,
// is shot into an inside corner.
ray_def test_ray = temp_ray;
test_ray.advance(true);
- if (in_bounds(test_ray.pos()) && !grid_is_solid(test_ray.pos()))
+ if (in_bounds(test_ray.pos()) && !cell_is_solid(test_ray.pos()))
break;
shift = 0.0;
@@ -1651,15 +1651,15 @@ void bolt::bounce()
{
do
ray.regress();
- while (grid_is_solid(grd(ray.pos())));
+ while (feat_is_solid(grd(ray.pos())));
bounce_pos = ray.pos();
ray.advance_and_bounce();
range_used += 2;
}
- while (range_used < range && grid_is_solid(grd(ray.pos())));
+ while (range_used < range && feat_is_solid(grd(ray.pos())));
- if (!grid_is_solid(grd(ray.pos())))
+ if (!feat_is_solid(grd(ray.pos())))
_munge_bounced_bolt(old_bolt, *this, old_ray, ray);
}
@@ -1698,7 +1698,7 @@ void bolt::digging_wall_effect()
msg_generated = true;
}
}
- else if (grid_is_wall(feat))
+ else if (feat_is_wall(feat))
finish_beam();
}
@@ -1832,7 +1832,7 @@ void bolt::affect_wall()
else if (flavour == BEAM_DISINTEGRATION || flavour == BEAM_NUKE)
nuke_wall_effect();
- if (grid_is_solid(pos()))
+ if (cell_is_solid(pos()))
finish_beam();
}
@@ -1847,13 +1847,13 @@ coord_def bolt::pos() const
void bolt::hit_wall()
{
const dungeon_feature_type feat = grd(pos());
- ASSERT( grid_is_solid(feat) );
+ ASSERT( feat_is_solid(feat) );
if (is_tracer && YOU_KILL(thrower) && in_bounds(target) && !passed_target
&& pos() != target && pos() != source && foe_info.count == 0
&& flavour != BEAM_DIGGING && flavour <= BEAM_LAST_REAL
&& bounces == 0 && reflections == 0 && see_cell(target)
- && !grid_is_solid(grd(target)))
+ && !feat_is_solid(grd(target)))
{
// Okay, with all those tests passed, this is probably an instance
// of the player manually targetting something whose line of fire
@@ -1909,7 +1909,7 @@ void bolt::hit_wall()
{
do
ray.regress();
- while (ray.pos() != source && grid_is_solid(ray.pos()));
+ while (ray.pos() != source && cell_is_solid(ray.pos()));
// target is where the explosion is centered, so update it.
if (is_explosion && !is_tracer)
@@ -1928,7 +1928,7 @@ void bolt::affect_cell(bool avoid_self)
fake_flavour();
const coord_def old_pos = pos();
- const bool was_solid = grid_is_solid(grd(pos()));
+ const bool was_solid = feat_is_solid(grd(pos()));
bool avoid_monster = (avoid_self && this->thrower == KILL_MON_MISSILE);
bool avoid_player = (avoid_self && this->thrower != KILL_MON_MISSILE);
@@ -1974,7 +1974,7 @@ void bolt::affect_cell(bool avoid_self)
affect_monster(m);
}
- if (!grid_is_solid(grd(pos())))
+ if (!feat_is_solid(grd(pos())))
affect_ground();
}
@@ -2112,7 +2112,7 @@ void bolt::do_fire()
break;
}
- ASSERT((!grid_is_solid(grd(pos())) || avoid_self)
+ ASSERT((!feat_is_solid(grd(pos())) || avoid_self)
|| is_tracer && affects_wall(grd(pos())));
const bool was_seen = seen;
@@ -2886,7 +2886,7 @@ void mimic_alert(monsters *mimic)
bool bolt::is_bouncy(dungeon_feature_type feat) const
{
- if (real_flavour == BEAM_CHAOS && grid_is_solid(feat))
+ if (real_flavour == BEAM_CHAOS && feat_is_solid(feat))
return (true);
if (is_enchantment())
@@ -3172,12 +3172,12 @@ void bolt::affect_place_clouds()
// Fire/cold over water/lava
if (feat == DNGN_LAVA && flavour == BEAM_COLD
- || grid_is_watery(feat) && is_fiery())
+ || feat_is_watery(feat) && is_fiery())
{
place_cloud(CLOUD_STEAM, p, 2 + random2(5), whose_kill(), killer());
}
- if (grid_is_watery(feat) && flavour == BEAM_COLD
+ if (feat_is_watery(feat) && flavour == BEAM_COLD
&& damage.num * damage.size > 35)
{
place_cloud(CLOUD_COLD, p, damage.num * damage.size / 30 + 1,
@@ -3204,7 +3204,7 @@ void bolt::affect_place_explosion_clouds()
// First check: fire/cold over water/lava.
if (grd(p) == DNGN_LAVA && flavour == BEAM_COLD
- || grid_is_watery(grd(p)) && is_fiery())
+ || feat_is_watery(grd(p)) && is_fiery())
{
place_cloud(CLOUD_STEAM, p, 2 + random2(5), whose_kill(), killer());
return;
@@ -5684,9 +5684,9 @@ void bolt::determine_affected_cells(explosion_map& m, const coord_def& delta,
const dungeon_feature_type dngn_feat = grd(loc);
// Check to see if we're blocked by a wall.
- if (grid_is_wall(dngn_feat)
+ if (feat_is_wall(dngn_feat)
|| dngn_feat == DNGN_SECRET_DOOR
- || grid_is_closed_door(dngn_feat))
+ || feat_is_closed_door(dngn_feat))
{
// Special case: explosion originates from rock/statue
// (e.g. Lee's Rapid Deconstruction) - in this case, ignore
@@ -5695,7 +5695,7 @@ void bolt::determine_affected_cells(explosion_map& m, const coord_def& delta,
return;
}
- if (grid_is_solid(dngn_feat) && !grid_is_wall(dngn_feat) && stop_at_statues)
+ if (feat_is_solid(dngn_feat) && !feat_is_wall(dngn_feat) && stop_at_statues)
return;
// Hmm, I think we're OK.
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index ce99e8de5c..f0d3146cf9 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -114,7 +114,7 @@ static int _spread_cloud(const cloud_struct &cloud)
if (!in_bounds(*ai)
|| env.cgrid(*ai) != EMPTY_CLOUD
- || grid_is_solid(grd(*ai))
+ || feat_is_solid(grd(*ai))
|| is_sanctuary(*ai) && !is_harmless_cloud(cloud.type))
{
continue;
@@ -145,7 +145,7 @@ static void _spread_fire(const cloud_struct &cloud)
continue;
// burning trees produce flames all around
- if (!grid_is_solid(*ai) && make_flames)
+ if (!cell_is_solid(*ai) && make_flames)
_place_new_cloud( CLOUD_FIRE, *ai, cloud.decay/2+1, cloud.whose,
cloud.killer, cloud.spread_rate );
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 6cef944a8c..451b00f500 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -738,7 +738,7 @@ bool _take_portal_vault_stairs( const bool down )
for (rectangle_iterator ri(1); ri; ++ri)
{
- if (grid_stair_direction(grd(*ri)) == cmd)
+ if (feat_stair_direction(grd(*ri)) == cmd)
{
stair_pos = *ri;
break;
@@ -774,7 +774,7 @@ void wizard_level_travel( bool down )
// This lets us, for example, use &U to exit from Pandemonium and
// &D to go to the next level.
- command_type real_dir = grid_stair_direction(stairs);
+ command_type real_dir = feat_stair_direction(stairs);
if (down && real_dir == CMD_GO_UPSTAIRS
|| !down && real_dir == CMD_GO_DOWNSTAIRS)
{
@@ -3247,7 +3247,7 @@ void debug_mons_scan()
#ifdef WIZARD
static void _debug_acquirement_stats(FILE *ostat)
{
- if (grid_destroys_items(grd(you.pos())))
+ if (feat_destroys_items(grd(you.pos())))
{
mpr("You must stand on a square which doesn't destroy items "
"in order to do this.");
@@ -5204,7 +5204,7 @@ void wizard_dismiss_all_monsters(bool force_all)
static void _debug_kill_traps()
{
for (rectangle_iterator ri(1); ri; ++ri)
- if (grid_is_trap(grd(*ri), true))
+ if (feat_is_trap(grd(*ri), true))
destroy_trap(*ri);
}
@@ -5244,7 +5244,7 @@ static void _debug_destroy_doors()
for (int x = 0; x < GXM; ++x)
{
const dungeon_feature_type feat = grd[x][y];
- if (feat == DNGN_SECRET_DOOR || grid_is_closed_door(feat))
+ if (feat == DNGN_SECRET_DOOR || feat_is_closed_door(feat))
grd[x][y] = DNGN_FLOOR;
}
}
@@ -6909,7 +6909,7 @@ static bool _mg_region_flood(const coord_def &c, int region, bool flag)
}
const dungeon_feature_type ft = grd(c);
- if (is_travelable_stair(ft))
+ if (feat_is_travelable_stair(ft))
found_exit = true;
for (int yi = -1; yi <= 1; ++yi)
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 8c6aaad9e3..ad3e2c8a2c 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1569,7 +1569,7 @@ static void _stairs_card(int power, deck_rarity_type rarity)
you.duration[DUR_REPEL_STAIRS_MOVE] = 0;
you.duration[DUR_REPEL_STAIRS_CLIMB] = 0;
- if (grid_stair_direction(grd(you.pos())) == CMD_NO_CMD)
+ if (feat_stair_direction(grd(you.pos())) == CMD_NO_CMD)
you.duration[DUR_REPEL_STAIRS_MOVE] = 1000;
else
you.duration[DUR_REPEL_STAIRS_CLIMB] = 500; // more annoying
@@ -1579,7 +1579,7 @@ static void _stairs_card(int power, deck_rarity_type rarity)
for (radius_iterator ri(you.pos(), LOS_RADIUS, false, true, true); ri; ++ri)
{
dungeon_feature_type feat = grd(*ri);
- if (grid_stair_direction(feat) != CMD_NO_CMD
+ if (feat_stair_direction(feat) != CMD_NO_CMD
&& feat != DNGN_ENTER_SHOP)
{
stairs_avail.push_back(*ri);
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 44459c2131..7adf1fbf4a 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -472,8 +472,8 @@ void full_describe_view()
// Grab all items known (or thought) to be in the stashes in view.
for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri)
{
- if (grid_stair_direction(grd(*ri)) != CMD_NO_CMD
- || is_altar(grd(*ri)))
+ if (feat_stair_direction(grd(*ri)) != CMD_NO_CMD
+ || feat_is_altar(grd(*ri)))
{
list_features.push_back(*ri);
}
@@ -693,7 +693,7 @@ void full_describe_view()
desc += "</" + colour_str +">) ";
#endif
desc += feature_description(c);
- if (is_travelable_stair(grd(c)) && !travel_cache.know_stair(c))
+ if (is_unknown_stair(c))
desc += " (not visited)";
FeatureMenuEntry *me = new FeatureMenuEntry(desc, c, hotkey);
me->tag = "description";
@@ -2492,7 +2492,7 @@ void describe_floor()
msg_channel_type channel = MSGCH_EXAMINE;
// Water is not terribly important if you don't mind it.
- if (grid_is_water(grid) && player_likes_water())
+ if (feat_is_water(grid) && player_likes_water())
channel = MSGCH_EXAMINE_FILTER;
mpr((prefix + feat + suffix).c_str(), channel);
@@ -2549,13 +2549,13 @@ std::string feature_description(dungeon_feature_type grid,
if (bloody)
desc += ", spattered with blood";
- return thing_do_grammar(dtype, add_stop, grid_is_trap(grid), desc);
+ return thing_do_grammar(dtype, add_stop, feat_is_trap(grid), desc);
}
static std::string _base_feature_desc(dungeon_feature_type grid,
trap_type trap)
{
- if (grid_is_trap(grid) && trap != NUM_TRAPS)
+ if (feat_is_trap(grid) && trap != NUM_TRAPS)
{
switch (trap)
{
@@ -2901,7 +2901,7 @@ std::string feature_description(const coord_def& where, bool bloody,
if (grid == DNGN_SECRET_DOOR)
grid = grid_secret_door_appearance(where);
- if (grid == DNGN_OPEN_DOOR || grid_is_closed_door(grid))
+ if (grid == DNGN_OPEN_DOOR || feat_is_closed_door(grid))
{
std::set<coord_def> all_door;
find_connected_identical(where, grd(where), all_door);
@@ -3058,7 +3058,7 @@ static std::string _stair_destination_description(const coord_def &pos)
const stair_info *si = linf->get_stair(pos);
if (si)
return (" " + si->describe());
- else if (is_stair(grd(pos)))
+ else if (feat_is_stair(grd(pos)))
return (" (unknown stair)");
}
return ("");
@@ -3522,7 +3522,7 @@ static void _describe_cell(const coord_def& where, bool in_range)
msg_channel_type channel = MSGCH_EXAMINE;
if (feat == DNGN_FLOOR
|| feat == DNGN_FLOOR_SPECIAL
- || grid_is_water(feat))
+ || feat_is_water(feat))
{
channel = MSGCH_EXAMINE_FILTER;
}
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 1fd256c3fa..5893121c55 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -1467,7 +1467,7 @@ static bool _branch_entrances_are_connected()
for (int x = 0; x < GXM; ++x)
{
coord_def gc(x,y);
- if (!grid_is_branch_stairs(grd(gc)))
+ if (!feat_is_branch_stairs(grd(gc)))
continue;
if (!_has_connected_stone_stairs_from(gc))
return (false);
@@ -1732,21 +1732,21 @@ static void _check_doors()
for (int x = 1; x < GXM-1; x++)
for (int y = 1; y < GYM-1; y++)
{
- if (!grid_is_closed_door(grd[x][y]))
+ if (!feat_is_closed_door(grd[x][y]))
continue;
int solid_count = 0;
- if (grid_is_solid( grd[x - 1][y] ))
+ if (feat_is_solid( grd[x - 1][y] ))
solid_count++;
- if (grid_is_solid( grd[x + 1][y] ))
+ if (feat_is_solid( grd[x + 1][y] ))
solid_count++;
- if (grid_is_solid( grd[x][y - 1] ))
+ if (feat_is_solid( grd[x][y - 1] ))
solid_count++;
- if (grid_is_solid( grd[x][y + 1] ))
+ if (feat_is_solid( grd[x][y + 1] ))
solid_count++;
grd[x][y] = (solid_count < 2 ? DNGN_FLOOR
@@ -1859,7 +1859,7 @@ static int _count_connected(int margin)
for (int i = margin; i < GXM - margin; ++i)
for (int j = margin; j < GYM - margin; ++j)
- taken[i][j] = grid_is_water(grd[i][j]);
+ taken[i][j] = feat_is_water(grd[i][j]);
int count = 0;
@@ -3181,8 +3181,8 @@ static void _make_trail(int xs, int xr, int ys, int yr, int corrlength,
static int _good_door_spot(int x, int y)
{
- if (!grid_is_solid(grd[x][y]) && grd[x][y] < DNGN_ENTER_PANDEMONIUM
- || grid_is_closed_door(grd[x][y]))
+ if (!feat_is_solid(grd[x][y]) && grd[x][y] < DNGN_ENTER_PANDEMONIUM
+ || feat_is_closed_door(grd[x][y]))
{
return 1;
}
@@ -3240,8 +3240,8 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
{
// left side
if (grd[sx-1][ry] == DNGN_FLOOR
- && grid_is_solid(grd[sx-1][ry-1])
- && grid_is_solid(grd[sx-1][ry+1]))
+ && feat_is_solid(grd[sx-1][ry-1])
+ && feat_is_solid(grd[sx-1][ry+1]))
{
if (x_chance_in_y(doorlevel, 10))
grd[sx-1][ry] = DNGN_CLOSED_DOOR;
@@ -3249,8 +3249,8 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
// right side
if (grd[ex+1][ry] == DNGN_FLOOR
- && grid_is_solid(grd[ex+1][ry-1])
- && grid_is_solid(grd[ex+1][ry+1]))
+ && feat_is_solid(grd[ex+1][ry-1])
+ && feat_is_solid(grd[ex+1][ry+1]))
{
if (x_chance_in_y(doorlevel, 10))
grd[ex+1][ry] = DNGN_CLOSED_DOOR;
@@ -3262,8 +3262,8 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
{
// top
if (grd[rx][sy-1] == DNGN_FLOOR
- && grid_is_solid(grd[rx-1][sy-1])
- && grid_is_solid(grd[rx+1][sy-1]))
+ && feat_is_solid(grd[rx-1][sy-1])
+ && feat_is_solid(grd[rx+1][sy-1]))
{
if (x_chance_in_y(doorlevel, 10))
grd[rx][sy-1] = DNGN_CLOSED_DOOR;
@@ -3271,8 +3271,8 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
// bottom
if (grd[rx][ey+1] == DNGN_FLOOR
- && grid_is_solid(grd[rx-1][ey+1])
- && grid_is_solid(grd[rx+1][ey+1]))
+ && feat_is_solid(grd[rx-1][ey+1])
+ && feat_is_solid(grd[rx+1][ey+1]))
{
if (x_chance_in_y(doorlevel, 10))
grd[rx][ey+1] = DNGN_CLOSED_DOOR;
@@ -3493,7 +3493,7 @@ static void _place_aquatic_monsters(int level_number, char level_type)
if (grd[x][y] == DNGN_LAVA)
lava_spaces++;
- if (grid_is_water(grd[x][y]))
+ if (feat_is_water(grd[x][y]))
water_spaces++;
}
@@ -3983,7 +3983,7 @@ static void _dig_away_from(vault_placement &place, const coord_def &pos)
{
if (!xi && !yi)
continue;
- if (!grid_is_solid(dig_at + coord_def(xi, yi))
+ if (!cell_is_solid(dig_at + coord_def(xi, yi))
&& ++adjacent_count >= 2)
{
return;
@@ -4002,12 +4002,12 @@ static void _dig_vault_loose( vault_placement &place,
static bool _grid_needs_exit(int x, int y)
{
- return (!grid_is_solid(x, y)
- || grid_is_closed_door(grd[x][y])
+ return (!cell_is_solid(x, y)
+ || feat_is_closed_door(grd[x][y])
|| grd[x][y] == DNGN_SECRET_DOOR);
}
-static bool _map_grid_is_on_edge(const vault_placement &place,
+static bool _map_feat_is_on_edge(const vault_placement &place,
const coord_def &c)
{
for (int xi = c.x - 1; xi <= c.x + 1; ++xi)
@@ -4026,7 +4026,7 @@ static void _pick_internal_float_exits(const vault_placement &place,
for (int y = place.pos.y + 1; y < place.pos.y + place.size.y - 1; ++y)
for (int x = place.pos.x + 1; x < place.pos.x + place.size.x - 1; ++x)
if (_grid_needs_exit(x, y)
- && _map_grid_is_on_edge(place, coord_def(x, y)))
+ && _map_feat_is_on_edge(place, coord_def(x, y)))
{
exits.push_back( coord_def(x, y) );
}
@@ -5243,10 +5243,10 @@ bool join_the_dots(const coord_def &from, const coord_def &to,
join_count++;
const dungeon_feature_type feat = grd(at);
- if (early_exit && at != from && is_traversable(feat))
+ if (early_exit && at != from && feat_is_traversable(feat))
return (true);
- if (unforbidden(at, MMT_VAULT) && !is_traversable(feat))
+ if (unforbidden(at, MMT_VAULT) && !feat_is_traversable(feat))
grd(at) = DNGN_FLOOR;
if (join_count > 10000) // just insurance
@@ -6328,7 +6328,7 @@ bool octa_room(spec_room &sr, int oblique_max,
if (grd[x][y] == DNGN_FLOOR && type_floor == DNGN_SHALLOW_WATER)
grd[x][y] = DNGN_SHALLOW_WATER;
- if (grd[x][y] == DNGN_CLOSED_DOOR && !grid_is_solid(type_floor))
+ if (grd[x][y] == DNGN_CLOSED_DOOR && !feat_is_solid(type_floor))
grd[x][y] = DNGN_FLOOR; // ick
}
@@ -6475,7 +6475,7 @@ static void _change_labyrinth_border(const dgn_region &region,
if (!in_bounds(c)) // paranoia
continue;
- if (grd(c) == wall || !grid_is_wall(grd(c)))
+ if (grd(c) == wall || !feat_is_wall(grd(c)))
continue;
// All border grids have neighbours without any access to floor.
@@ -6886,7 +6886,7 @@ static void _labyrinth_level(int level_number)
static bool _is_wall(int x, int y)
{
- return grid_is_wall(grd[x][y]);
+ return feat_is_wall(grd[x][y]);
}
static int _box_room_door_spot(int x, int y)
@@ -7698,7 +7698,7 @@ struct nearest_point
inline static bool _dgn_square_travel_ok(const coord_def &c)
{
const dungeon_feature_type feat = grd(c);
- return (is_traversable(feat) || grid_is_trap(feat)
+ return (feat_is_traversable(feat) || feat_is_trap(feat)
|| feat == DNGN_SECRET_DOOR);
}
@@ -7711,7 +7711,7 @@ static coord_def _dgn_find_closest_to_stone_stairs(coord_def base_pos)
for (int y = 0; y < GYM; ++y)
for (int x = 0; x < GXM; ++x)
{
- if (!travel_point_distance[x][y] && grid_is_stone_stair(grd[x][y]))
+ if (!travel_point_distance[x][y] && feat_is_stone_stair(grd[x][y]))
_dgn_fill_zone(coord_def(x, y), 1, np, _dgn_square_travel_ok);
}
diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h
index 125041258d..75f5d641c5 100644
--- a/crawl-ref/source/dungeon.h
+++ b/crawl-ref/source/dungeon.h
@@ -288,9 +288,9 @@ bool flood_find<fgrd, bound_check>::path_flood(
}
}
- const dungeon_feature_type grid = fgrid(dc);
+ const dungeon_feature_type feat = fgrid(dc);
- if (grid == NUM_FEATURES)
+ if (feat == NUM_FEATURES)
{
if (want_exit)
{
@@ -301,16 +301,16 @@ bool flood_find<fgrd, bound_check>::path_flood(
return (false);
}
- if (needed_features[ grid ])
+ if (needed_features[ feat ])
{
unexplored_place = dc;
unexplored_dist = traveled_distance;
return (true);
}
- if (!is_traversable(grid)
- && grid != DNGN_SECRET_DOOR
- && !grid_is_trap(grid))
+ if (!feat_is_traversable(feat)
+ && feat != DNGN_SECRET_DOOR
+ && !feat_is_trap(feat))
{
return (false);
}
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 2647a39a63..0c96386338 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2219,11 +2219,11 @@ bool acquirement(object_class_type class_wanted, int agent,
}
}
- if (grid_destroys_items(grd(you.pos())))
+ if (feat_destroys_items(grd(you.pos())))
{
// How sad (and stupid).
if (!silenced(you.pos()) && !quiet)
- mprf(MSGCH_SOUND, grid_item_destruction_message(grd(you.pos())));
+ mprf(MSGCH_SOUND, feat_item_destruction_message(grd(you.pos())));
if (agent > GOD_NO_GOD && agent < NUM_GODS)
{
@@ -2818,7 +2818,7 @@ static void _hell_effects()
static bool _is_floor(const dungeon_feature_type feat)
{
- return (!grid_is_solid(feat) && !grid_destroys_items(feat));
+ return (!feat_is_solid(feat) && !feat_destroys_items(feat));
}
// This function checks whether we can turn a wall into a floor space and
@@ -2829,7 +2829,7 @@ static bool _is_floor(const dungeon_feature_type feat)
// . # 2
// #x# or .x. -> 0x1
// . # 3
-static bool _grid_is_flanked_by_walls(const coord_def &p)
+static bool _feat_is_flanked_by_walls(const coord_def &p)
{
const coord_def adjs[] = { coord_def(p.x-1,p.y),
coord_def(p.x+1,p.y),
@@ -2841,10 +2841,10 @@ static bool _grid_is_flanked_by_walls(const coord_def &p)
if (!in_bounds(adjs[i]))
return (false);
- return (grid_is_wall(grd(adjs[0])) && grid_is_wall(grd(adjs[1]))
+ return (feat_is_wall(grd(adjs[0])) && feat_is_wall(grd(adjs[1]))
&& _is_floor(grd(adjs[2])) && _is_floor(grd(adjs[3]))
|| _is_floor(grd(adjs[0])) && _is_floor(grd(adjs[1]))
- && grid_is_wall(grd(adjs[2])) && grid_is_wall(grd(adjs[3])));
+ && feat_is_wall(grd(adjs[2])) && feat_is_wall(grd(adjs[3])));
}
// Sometimes if a floor is turned into a wall, a dead-end will be created.
@@ -2875,7 +2875,7 @@ static bool _deadend_check_wall(const coord_def &p)
// The grids to the left and right of p are walls. (We already know that
// they are symmetric, so only need to check one side. We also know that
// the other direction, here up/down must then be non-walls.)
- if (grid_is_wall(grd[p.x-1][p.y]))
+ if (feat_is_wall(grd[p.x-1][p.y]))
{
// Run the check twice, once in either direction.
for (int i = -1; i <= 1; i++)
@@ -2889,9 +2889,9 @@ static bool _deadend_check_wall(const coord_def &p)
const coord_def d(p.x+1, p.y+2*i);
if (in_bounds(a) && in_bounds(b)
- && grid_is_wall(grd(a)) && grid_is_wall(grd(b))
+ && feat_is_wall(grd(a)) && feat_is_wall(grd(b))
&& (!in_bounds(c) || !in_bounds(d)
- || !grid_is_wall(grd(c)) || !grid_is_wall(grd(d))))
+ || !feat_is_wall(grd(c)) || !feat_is_wall(grd(d))))
{
return (false);
}
@@ -2910,9 +2910,9 @@ static bool _deadend_check_wall(const coord_def &p)
const coord_def d(p.x+2*i, p.y+1);
if (in_bounds(a) && in_bounds(b)
- && grid_is_wall(grd(a)) && grid_is_wall(grd(b))
+ && feat_is_wall(grd(a)) && feat_is_wall(grd(b))
&& (!in_bounds(c) || !in_bounds(d)
- || !grid_is_wall(grd(c)) || !grid_is_wall(grd(d))))
+ || !feat_is_wall(grd(c)) || !feat_is_wall(grd(d))))
{
return (false);
}
@@ -2940,7 +2940,7 @@ static bool _deadend_check_wall(const coord_def &p)
// as well.
static bool _deadend_check_floor(const coord_def &p)
{
- if (grid_is_wall(grd[p.x-1][p.y]))
+ if (feat_is_wall(grd[p.x-1][p.y]))
{
for (int i = -1; i <= 1; i++)
{
@@ -3028,7 +3028,7 @@ void change_labyrinth(bool msg)
// directions, and by floor on the two remaining sides.
for (rectangle_iterator ri(c1, c2); ri; ++ri)
{
- if (is_terrain_seen(*ri) || !grid_is_wall(grd(*ri)))
+ if (is_terrain_seen(*ri) || !feat_is_wall(grd(*ri)))
continue;
// Skip on grids inside vaults so as not to disrupt them.
@@ -3036,7 +3036,7 @@ void change_labyrinth(bool msg)
continue;
// Make sure we don't accidentally create "ugly" dead-ends.
- if (_grid_is_flanked_by_walls(*ri) && _deadend_check_floor(*ri))
+ if (_feat_is_flanked_by_walls(*ri) && _deadend_check_floor(*ri))
targets.push_back(*ri);
}
@@ -3090,7 +3090,7 @@ void change_labyrinth(bool msg)
{
const coord_def c(targets[count]);
// Maybe not valid anymore...
- if (!grid_is_wall(grd(c)) || !_grid_is_flanked_by_walls(c))
+ if (!feat_is_wall(grd(c)) || !_feat_is_flanked_by_walls(c))
continue;
// Use the adjacent floor grids as source and destination.
@@ -3152,7 +3152,7 @@ void change_labyrinth(bool msg)
if (std::abs(p.x-c.x) + std::abs(p.y-c.y) <= 1)
continue;
- if (_grid_is_flanked_by_walls(p) && _deadend_check_wall(p))
+ if (_feat_is_flanked_by_walls(p) && _deadend_check_wall(p))
points.push_back(p);
}
@@ -3186,7 +3186,7 @@ void change_labyrinth(bool msg)
int wall_count = 0;
coord_def old_adj(c);
for (adjacent_iterator ai(c); ai; ++ai)
- if (grid_is_wall(grd(*ai)) && one_chance_in(++wall_count))
+ if (feat_is_wall(grd(*ai)) && one_chance_in(++wall_count))
old_adj = *ai;
if (old_adj != c && !is_bloodcovered(old_adj))
@@ -3205,10 +3205,10 @@ void change_labyrinth(bool msg)
// Rather than use old_grid directly, replace with an adjacent
// wall type, preferably stone, rock, or metal.
old_grid = grd[p.x-1][p.y];
- if (!grid_is_wall(old_grid))
+ if (!feat_is_wall(old_grid))
{
old_grid = grd[p.x][p.y-1];
- if (!grid_is_wall(old_grid))
+ if (!feat_is_wall(old_grid))
{
if (msg)
{
@@ -3272,7 +3272,7 @@ void change_labyrinth(bool msg)
// and move them to a random adjacent non-wall grid.
for (rectangle_iterator ri(c1, c2); ri; ++ri)
{
- if (!grid_is_wall(grd(*ri)) || igrd(*ri) == NON_ITEM)
+ if (!feat_is_wall(grd(*ri)) || igrd(*ri) == NON_ITEM)
continue;
if (msg)
@@ -4041,7 +4041,7 @@ static void _catchup_monster_moves(monsters *mon, int turns)
const coord_def next(pos + inc);
const dungeon_feature_type feat = grd(next);
- if (grid_is_solid(feat)
+ if (feat_is_solid(feat)
|| monster_at(next)
|| !monster_habitable_grid(mon, feat))
{
@@ -4335,7 +4335,7 @@ void collect_radius_points(std::vector<std::vector<coord_def> > &radius_points,
if (visited_indices.find(idx) == visited_indices.end()
&& in_bounds(temp.first)
- && !grid_is_solid(temp.first))
+ && !cell_is_solid(temp.first))
{
fringe.push(temp);
}
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 8f8f67f64a..a136971334 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -621,7 +621,7 @@ bool melee_attack::attack()
// Defending monster protects itself from attacks using the wall
// it's in.
- if (defender->atype() == ACT_MONSTER && grid_is_solid(defender->pos())
+ if (defender->atype() == ACT_MONSTER && cell_is_solid(defender->pos())
&& mons_wall_shielded(defender_as_monster()))
{
std::string feat_name = raw_feature_description(grd(defender->pos()));
@@ -2549,7 +2549,7 @@ static bool _move_stairs(const actor* attacker, const actor* defender)
const coord_def orig_pos = attacker->pos();
const dungeon_feature_type stair_feat = grd(orig_pos);
- if (grid_stair_direction(stair_feat) == CMD_NO_CMD)
+ if (feat_stair_direction(stair_feat) == CMD_NO_CMD)
return (false);
// The player can't use shops to escape, so don't bother.
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 8d4dceaf98..86c87298b2 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -999,7 +999,7 @@ static void _close_level_gates()
if (you.char_direction == GDT_ASCENDING
&& you.level_type != LEVEL_PANDEMONIUM)
{
- if (grid_sealable_portal(grd(*ri)))
+ if (feat_sealable_portal(grd(*ri)))
{
grd(*ri) = DNGN_STONE_ARCH;
env.markers.remove_markers_at(*ri, MAT_ANY);
@@ -1464,8 +1464,8 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode,
{
dungeon_feature_type feat = grd(you.pos());
if (feat != DNGN_ENTER_SHOP
- && grid_stair_direction(feat) != CMD_NO_CMD
- && grid_stair_direction(stair_taken) != CMD_NO_CMD)
+ && feat_stair_direction(feat) != CMD_NO_CMD
+ && feat_stair_direction(stair_taken) != CMD_NO_CMD)
{
std::string stair_str =
feature_description(feat, NUM_TRAPS, false,
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index b3d296d6a5..dd6aa27168 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -247,7 +247,7 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known)
// Merfolk boots unmeld if levitation takes us out of water.
if (!player_is_airborne() && you.species == SP_MERFOLK
- && grid_is_water(grd(you.pos())))
+ && feat_is_water(grd(you.pos())))
{
unmeld_one_equip(EQ_BOOTS);
}
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 4d3a0c5974..ab63b492ae 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3047,7 +3047,7 @@ bool thrown_object_destroyed(item_def *item, const coord_def& where,
// destruction: plus / (1 + plus) chance of survival.
bool destroyed = (chance == 0) ? false : (one_chance_in(chance)
&& one_chance_in(item->plus + 1));
- bool hostile_grid = grid_destroys_items(grd(where));
+ bool hostile_grid = feat_destroys_items(grd(where));
// Non-returning items thrown into item-destroying grids are always
// destroyed. Returning items are only destroyed if they would have
@@ -3058,7 +3058,7 @@ bool thrown_object_destroyed(item_def *item, const coord_def& where,
if (hostile_grid)
{
if (player_can_hear(where))
- mprf(MSGCH_SOUND, grid_item_destruction_message(grd(where)));
+ mprf(MSGCH_SOUND, feat_item_destruction_message(grd(where)));
item_was_destroyed(*item, NON_MONSTER);
destroyed = true;
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 7433d434ee..c784cf2503 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1960,7 +1960,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
const dungeon_feature_type my_grid = grd(you.pos());
- if (!grid_destroys_items(my_grid)
+ if (!feat_destroys_items(my_grid)
&& !copy_item_to_grid( you.inv[item_dropped],
you.pos(), quant_drop, true ))
{
@@ -1971,10 +1971,10 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
mprf("You drop %s.",
quant_name(you.inv[item_dropped], quant_drop, DESC_NOCAP_A).c_str());
- if (grid_destroys_items(my_grid))
+ if (feat_destroys_items(my_grid))
{
if (!silenced(you.pos()))
- mprf(MSGCH_SOUND, grid_item_destruction_message(my_grid));
+ mprf(MSGCH_SOUND, feat_item_destruction_message(my_grid));
item_was_destroyed(you.inv[item_dropped], NON_MONSTER);
}
@@ -1994,7 +1994,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
if (try_offer
&& you.religion != GOD_NO_GOD
&& you.duration[DUR_PRAYER]
- && grid_altar_god(grd(you.pos())) == you.religion)
+ && feat_altar_god(grd(you.pos())) == you.religion)
{
offer_items();
}
diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc
index 132c2005f2..52a2856c80 100644
--- a/crawl-ref/source/losparam.cc
+++ b/crawl-ref/source/losparam.cc
@@ -18,7 +18,7 @@ opacity_type opacity_default::operator()(const coord_def& p) const
{
int m;
dungeon_feature_type f = env.grid(p);
- if (grid_is_opaque(f))
+ if (feat_is_opaque(f))
return OPC_OPAQUE;
else if (is_opaque_cloud(env.cgrid(p)))
return OPC_HALF;
@@ -32,7 +32,7 @@ opacity_type opacity_default::operator()(const coord_def& p) const
opacity_type opacity_fullyopaque::operator()(const coord_def& p) const
{
- if (grid_is_opaque(env.grid(p)))
+ if (feat_is_opaque(env.grid(p)))
return OPC_OPAQUE;
else
return OPC_CLEAR;
@@ -44,7 +44,7 @@ opacity_type opacity_solid::operator()(const coord_def& p) const
{
int m;
dungeon_feature_type f = env.grid(p);
- if (grid_is_solid(f))
+ if (feat_is_solid(f))
return OPC_OPAQUE;
else if (is_opaque_cloud(env.cgrid(p)))
return OPC_HALF;
diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc
index aca73554a1..c01bc869e8 100644
--- a/crawl-ref/source/luadgn.cc
+++ b/crawl-ref/source/luadgn.cc
@@ -1149,7 +1149,7 @@ static int dgn_grid(lua_State *ls)
}
LUARET1(_dgn_is_wall, boolean,
- grid_is_wall(static_cast<dungeon_feature_type>(luaL_checkint(ls, 1))))
+ feat_is_wall(static_cast<dungeon_feature_type>(luaL_checkint(ls, 1))))
static int dgn_max_bounds(lua_State *ls)
{
@@ -1747,11 +1747,11 @@ static int dgn_fixup_stairs(lua_State *ls)
for (int x = 0; x < GXM; ++x)
{
const dungeon_feature_type feat = grd[x][y];
- if (grid_is_stone_stair(feat) || grid_is_escape_hatch(feat))
+ if (feat_is_stone_stair(feat) || feat_is_escape_hatch(feat))
{
dungeon_feature_type new_feat = DNGN_UNSEEN;
- if (grid_stair_direction(feat) == CMD_GO_DOWNSTAIRS)
+ if (feat_stair_direction(feat) == CMD_GO_DOWNSTAIRS)
new_feat = down_feat;
else
new_feat = up_feat;
@@ -2377,7 +2377,7 @@ static int dgn_fill_disconnected_zones(lua_State *ls)
LUAFN(_dgn_is_opaque)
{
COORDS(c, 1, 2);
- lua_pushboolean(ls, grid_is_opaque(grd(c)));
+ lua_pushboolean(ls, feat_is_opaque(grd(c)));
return (1);
}
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile
index 54572a6a0e..e76f3aa166 100644
--- a/crawl-ref/source/makefile
+++ b/crawl-ref/source/makefile
@@ -56,6 +56,7 @@ LIBSDLIMAGE := contrib/install/lib/libSDL_image.a
LIBFREETYPE := contrib/install/lib/libfreetype.a
LIBSQLITE := contrib/install/lib/libsqlite3.a
LIBLUA := contrib/install/lib/liblua.a
+LIBZ := contrib/install/lib/libz.a
#
# Platform Detection
@@ -74,6 +75,13 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_NCURSES = YesPlease
NEEDS_LIBW32C = YesPlease
NEEDS_PCRE = YesPlease
+ ifdef TILES
+ NEEDS_FREETYPE = YesPlease
+ NEEDS_SDL = YesPlease
+ NEEDS_SDLIMAGE = YesPlease
+ NEEDS_LIBPNG = YesPlease
+ NEEDS_ZLIB = YesPlease
+ endif
endif
ifneq (,$(findstring CYGWIN,$(uname_S)))
GAME = crawl.exe
@@ -112,10 +120,6 @@ ifndef NO_RDYNAMIC
LDFLAGS := -rdynamic
endif
-
-# If you have lex and yacc, set DOYACC to y (lowercase y).
-DOYACC := y
-
# Permissions to set on the game executable.
MCHMOD := 2755
@@ -125,14 +129,14 @@ MCHMOD_SAVEDIR := 775
# The user:group to install the game as.
INSTALL_UGRP := games:games
-INSTALLDIR := /usr/games/crawl
+prefix := /usr/games/crawl
# If you're installing Crawl for multiple users, you *must* set this to a
# valid path before building Crawl. This is not necessary if you are building
# Crawl for a single user.
-# SAVEDIR := /usr/games/crawl/saves/
-# DATADIR := /usr/games/crawl/data/
+# SAVEDIR := saves/
+# DATADIR := data/
INCLUDES_L += -Icontrib/install/include
LIB += -Lcontrib/install/lib
@@ -180,50 +184,17 @@ RLTILES = rltiles
#
ifdef TILES
-DEFINES_L += -DUSE_TILE
-INCLUDES_L += -I$(RLTILES)
-
-ifdef NEED_APPKIT
-LIB += -framework OpenGL -framework AppKit
-endif
-
-ifdef APPLE_GCC
-
-# SDL has a goof in the stock SDL_config.h which checks whether
-# __MACOSX__ is defined. It's not one of Apple's stock markers,
-# so we define it ourselves here.
-#
-DEFINES += -D__MACOSX__
-
-EXTRA_OBJECTS += SDLMain.o
-
-# If the /Library/Frameworks folder exists, add a -F flag
-#
-ifneq ($(shell ls -a /Library/Frameworks 2> /dev/null),)
-LIB += -F/Library/Frameworks/ -Fcontrib/Frameworks
-endif
-
-# Check if our dependencies exist as frameworks. If so, use their
-# headers and link to them.
-#
-ifneq ($(shell ls /Library/Frameworks/SDL.framework 2> /dev/null),)
-INCLUDES_L += -I/Library/Frameworks/SDL.framework/Headers
-LIB += -framework SDL
-endif
-ifneq ($(shell ls /Library/Frameworks/SDL_image.framework 2> /dev/null),)
-INCLUDES_L += -I/Library/Frameworks/SDL_image.framework/Headers
-LIB += -framework SDL_image
-endif
-ifneq ($(shell ls /Library/Frameworks/Freetype2.framework 2> /dev/null),)
-INCLUDES_L += -I/Library/Frameworks/Freetype2.framework/Headers
-LIB += -framework Freetype2
+ifeq ($(uname_S),Darwin)
+ifndef UNSUPPORTED_BUILD
+$(warning Using this makefile to build a tiles build on Mac OS X is NOT OFFICIALLY SUPPORTED.)
+$(warning You should have no expectation of stability if you choose to continue anyway!)
+$(warning Please use the Xcode project instead.)
+$(error To build anyway, add the flag UNSUPPORTED_BUILD=y to the command-line)
endif
-ifneq ($(shell ls /Library/Frameworks/libpng.framework 2> /dev/null),)
-INCLUDES_L += -I/Library/Frameworks/libpng.framework/Headers
-LIB += -framework libpng
endif
-else # MacOS
+DEFINES_L += -DUSE_TILE
+INCLUDES_L += -I$(RLTILES)
# Okay, we have to assume we're on something else that
# uses standard UNIX-like methods for finding libs.
@@ -237,7 +208,13 @@ ifneq (,$(findstring MINGW,$(uname_S)))
CONTRIB_DEPENDS += $(LIBSDL) $(LIBSDLIMAGE) $(LIBFREETYPE)
endif
+ifndef NO_PKGCONFIG
ifneq ($(shell which pkg-config 2> /dev/null),)
+PKGCONFIG = YesPlease
+endif
+endif
+
+ifdef PKGCONFIG
# If pkg-config is available, it's the surest way to find where
# the contributing libraries are located.
@@ -264,16 +241,18 @@ else # pkg-config
PNG_INCLUDE := -I/opt/libpng/include
PNG_CFLAGS :=
-PNG_LDFLAGS := -L/opt/libpng/lib -lpng
+PNG_LDFLAGS := -L/opt/libpng/lib -lpng -lz
FREETYPE_INCLUDE := -I/opt/freetype/include -Icontrib/install/include/freetype2
FREETYPE_CFLAGS :=
FREETYPE_LDFLAGS := -L/opt/freetype/lib -lfreetype
+ifndef NO_SDLCONFIG
SDLCONFIG := $(which sdl-config)
ifeq ($(SDLCONFIG),)
SDLCONFIG := $(shell pwd)/contrib/install/bin/sdl-config
endif
+endif
ifneq ($(SDLCONFIG),)
@@ -306,8 +285,6 @@ endif
DEFINES_L += $(PNG_CFLAGS) $(FREETYPE_CFLAGS) $(SDL_CFLAGS)
INCLUDES_L += $(PNG_INCLUDE) $(FREETYPE_INCLUDE) $(SDL_INCLUDE)
-endif # MacOS
-
endif # TILES
ifeq ($(GCC_GTE_4_3_0),Yes)
@@ -315,7 +292,11 @@ CFWARN_L += -Wno-array-bounds
endif
CFWARN_L += -Wno-parentheses -Wwrite-strings -Wshadow -pedantic -D_FORTIFY_SOURCE=0
-CFOTHERS_L = $(EXTERNAL_FLAGS) $(EXTRA_FLAGS) $(DEFINES) -DCLUA_BINDINGS $(SDL_CFLAGS)
+CFOTHERS_L = $(EXTERNAL_FLAGS) $(EXTRA_FLAGS) $(DEFINES) $(SDL_CFLAGS)
+
+ifndef NO_LUA_BINDINGS
+CFOTHERS_L += -DCLUA_BINDINGS
+endif
#
# Figure out the build settings for this type of build
@@ -376,26 +357,26 @@ endif
endif
ifneq ($(strip $(SAVEDIR)),)
-CFOTHERS_L += '-DSAVE_DIR_PATH="$(strip $(SAVEDIR))"'
+CFOTHERS_L += '-DSAVE_DIR_PATH="$(strip $(prefix))/$(strip $(SAVEDIR))"'
endif
ifneq ($(strip $(DATADIR)),)
-CFOTHERS_L += '-DDATA_DIR_PATH="$(strip $(DATADIR))"'
+CFOTHERS_L += '-DDATA_DIR_PATH="$(strip $(prefix))/$(strip $(DATADIR))"'
endif
ifndef NO_NCURSES
# Usually, it can be autodetected for you:
ifneq ($(shell ls /usr/include/ncursesw 2> /dev/null),)
-UNICODE_GLYPHS = YesPlease
+USE_UNICODE = YesPlease
endif
-# If you're using UNICODE_GLYPHS=y, and have a preferred Unicode
+# If you have USE_UNICODE set, and have a preferred Unicode
# (UTF-8) locale you want Crawl to use, you can set it here. The
# default is en_US.UTF-8. If you'd prefer that Crawl use the locale
# as set in your environment LC_* variables, use UNICODE_LOCALE = .
UNICODE_LOCALE =
-ifdef UNICODE_GLYPHS
+ifdef USE_UNICODE
# Include path for (n)curses with Unicode support.
INCLUDES_L += -I/usr/include/ncursesw
@@ -464,10 +445,10 @@ LEX := $(shell which flex 2> /dev/null)
YACC := $(shell which bison 2> /dev/null)
ifeq ($(strip $(LEX)),)
-DOYACC := n
+NO_YACC = YesPlease
endif
ifeq ($(strip $(YACC)),)
-DOYACC := n
+NO_YACC = YesPlease
endif
ifneq ($(findstring $(MAKEFLAGS),s),s)
@@ -504,6 +485,21 @@ endif
ifdef NEEDS_PCRE
CONTRIB_DEPENDS += $(LIBPCRE)
endif
+ifdef NEEDS_FREETYPE
+CONTRIB_DEPENDS += $(LIBFREETYPE)
+endif
+ifdef NEEDS_SDL
+CONTRIB_DEPENDS += $(LIBSDL)
+endif
+ifdef NEEDS_SDLIMAGE
+CONTRIB_DEPENDS += $(LIBSDLIMAGE)
+endif
+ifdef NEEDS_LIBPNG
+CONTRIB_DEPENDS += $(LIBPNG)
+endif
+ifdef NEEDS_ZLIB
+CONTRIB_DEPENDS += $(LIBZ)
+endif
CONTRIB_DEPENDS += $(LIBLUA) $(LIBSQLITE)
LIB += $(LIBLUA) $(LIBSQLITE)
@@ -563,7 +559,7 @@ endif
$(UTIL)levcomp.tab.cc: $(CONTRIB_DEPENDS)
$(UTIL)levcomp.lex.cc: $(CONTRIB_DEPENDS)
-ifeq ($(strip $(DOYACC)),y)
+ifndef NO_YACC
prebuildyacc: $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h $(UTIL)levcomp.lex.cc
$(QUIET_COPY)$(COPY) $^ prebuilt/
@@ -597,29 +593,28 @@ install: $(GAME)
ifeq ($(DATADIR),)
$(error DATADIR not set! Set DATADIR and run make clean install again)
endif
- [ -d $(INSTALLDIR) ] || mkdir -p $(INSTALLDIR)
- $(COPY) $(GAME) $(INSTALLDIR)
- chown $(INSTALL_UGRP) $(INSTALLDIR)/$(GAME)
- chmod $(MCHMOD) $(INSTALLDIR)/$(GAME)
- mkdir -p $(DATADIR)/dat
- mkdir -p $(DATADIR)/dat/lua
- mkdir -p $(DATADIR)/dat/clua
- mkdir -p $(DATADIR)/dat/descript
- mkdir -p $(DATADIR)/dat/database
- $(COPY) dat/*.des $(DATADIR)/dat
- $(COPY) dat/lua/*.lua $(DATADIR)/dat/lua
- $(COPY) dat/clua/*.lua $(DATADIR)/dat/clua
- $(COPY) dat/descript/*.txt $(DATADIR)/dat/descript
- $(COPY) dat/database/*.txt $(DATADIR)/dat/database
+ [ -d $(prefix) ] || mkdir -p $(prefix)
+ $(COPY) $(GAME) $(prefix)
+ chown $(INSTALL_UGRP) $(prefix)/$(GAME)
+ chmod $(MCHMOD) $(prefix)/$(GAME)
+ mkdir -p $(prefix)/$(DATADIR)/dat/lua
+ mkdir -p $(prefix)/$(DATADIR)/dat/clua
+ mkdir -p $(prefix)/$(DATADIR)/dat/descript
+ mkdir -p $(prefix)/$(DATADIR)/dat/database
+ $(COPY) dat/*.des $(prefix)/$(DATADIR)/dat
+ $(COPY) dat/lua/*.lua $(prefix)/$(DATADIR)/dat/lua
+ $(COPY) dat/clua/*.lua $(prefix)/$(DATADIR)/dat/clua
+ $(COPY) dat/descript/*.txt $(prefix)/$(DATADIR)/dat/descript
+ $(COPY) dat/database/*.txt $(prefix)/$(DATADIR)/dat/database
mkdir -p $(DATADIR)/settings
- $(COPY) ../settings/* $(DATADIR)/settings/
+ $(COPY) ../settings/* $(prefix)/$(DATADIR)/settings/
mkdir -p $(DATADIR)/docs
- $(COPY) ../docs/*.txt $(DATADIR)/docs
- chown -R $(INSTALL_UGRP) $(DATADIR)
+ $(COPY) ../docs/*.txt $(prefix)/$(DATADIR)/docs
+ chown -R $(INSTALL_UGRP) $(prefix)/$(DATADIR)
ifneq ($(SAVEDIR),)
- mkdir -p $(SAVEDIR)
- chown $(INSTALL_UGRP) $(SAVEDIR)
- chmod $(MCHMOD_SAVEDIR) $(SAVEDIR)
+ mkdir -p $(prefix)/$(SAVEDIR)
+ chown $(INSTALL_UGRP) $(prefix)/$(SAVEDIR)
+ chmod $(MCHMOD_SAVEDIR) $(prefix)/$(SAVEDIR)
endif
clean:
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index eb28cb485c..38960f8bb9 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -184,17 +184,17 @@ static bool _may_overwrite_feature(const dungeon_feature_type grid,
return (water_ok);
// Handle all other non-LOS blocking grids here.
- if (!grid_is_opaque(grid)
+ if (!feat_is_opaque(grid)
&& grid != DNGN_FLOOR
&& grid != DNGN_SHALLOW_WATER
&& grid != DNGN_OPEN_DOOR
&& grid != DNGN_SECRET_DOOR
- && !grid_is_closed_door(grid))
+ && !feat_is_closed_door(grid))
{
return (false);
}
- if (grid_is_wall(grid))
+ if (feat_is_wall(grid))
return (wall_ok);
// Otherwise, feel free to clobber this feature.
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index a952dc580f..c89516add2 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -21,6 +21,7 @@ REVISION("$Rev$");
#include "player.h"
#ifdef USE_TILE
#include "stuff.h"
+ #include "terrain.h"
#include "tiles.h"
#include "travel.h"
#endif
@@ -832,7 +833,7 @@ bool FeatureMenuEntry::get_tiles(std::vector<tile_def>& tileset) const
tileset.push_back(tile_def(tileidx_feature(grd(pos), pos.x, pos.y),
TEX_DUNGEON));
- if (is_travelable_stair(grd(pos)) && !travel_cache.know_stair(pos))
+ if (is_unknown_stair(pos))
tileset.push_back(tile_def(TILE_NEW_STAIR, TEX_DEFAULT));
return (true);
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 849c875820..a43ce79974 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1041,7 +1041,7 @@ void split_potions_into_decay( int obj, int amount, bool need_msg )
// Only bother creating a distinct stack of potions
// if it won't get destroyed right away.
- if (!grid_destroys_items(grd(you.pos())))
+ if (!feat_destroys_items(grd(you.pos())))
{
item_def potion2;
potion2.base_type = OBJ_POTIONS;
@@ -1080,7 +1080,7 @@ static bool allow_bleeding_on_square(const coord_def& where)
}
// The good gods like to keep their altars pristine.
- if (is_good_god(grid_altar_god(grd(where))))
+ if (is_good_god(feat_altar_god(grd(where))))
return (false);
return (true);
@@ -1221,7 +1221,7 @@ void search_around(bool only_adjacent)
// Must have LOS, with no translucent walls in the way.
if (see_cell_no_trans(*ri))
{
- // Maybe we want distance() instead of grid_distance()?
+ // Maybe we want distance() instead of feat_distance()?
int dist = grid_distance(*ri, you.pos());
// Don't exclude own square; may be levitating.
@@ -1267,7 +1267,7 @@ void search_around(bool only_adjacent)
bool merfolk_change_is_safe(bool quiet)
{
// If already transformed, no subsequent transformation necessary.
- if (!player_is_airborne() && grid_is_water(grd(you.pos())))
+ if (!player_is_airborne() && feat_is_water(grd(you.pos())))
return (true);
std::set<equipment_type> r;
@@ -1290,7 +1290,7 @@ void merfolk_start_swimming()
static void exit_stair_message(dungeon_feature_type stair, bool /* going_up */)
{
- if (grid_is_escape_hatch(stair))
+ if (feat_is_escape_hatch(stair))
mpr("The hatch slams shut behind you.");
}
@@ -1300,9 +1300,9 @@ static void climb_message(dungeon_feature_type stair, bool going_up,
if (old_level_type != LEVEL_DUNGEON)
return;
- if (grid_is_portal(stair))
+ if (feat_is_portal(stair))
mpr("The world spins around you as you enter the gateway.");
- else if (grid_is_escape_hatch(stair))
+ else if (feat_is_escape_hatch(stair))
{
if (going_up)
mpr("A mysterious force pulls you upwards.");
@@ -1313,7 +1313,7 @@ static void climb_message(dungeon_feature_type stair, bool going_up,
(player_is_airborne() ? "float" : "slide"));
}
}
- else if (is_gate(stair))
+ else if (feat_is_gate(stair))
{
mprf("You %s %s through the gate.",
you.flight_mode() == FL_FLY ? "fly" :
@@ -1668,7 +1668,7 @@ static bool _stair_moves_pre(dungeon_feature_type stair)
if (stair != grd(you.pos()))
return (false);
- if (grid_stair_direction(stair) == CMD_NO_CMD)
+ if (feat_stair_direction(stair) == CMD_NO_CMD)
return (false);
if (!you.duration[DUR_REPEL_STAIRS_CLIMB])
@@ -1739,7 +1739,7 @@ void up_stairs(dungeon_feature_type force_stair,
}
// Probably still need this check here (teleportation) -- bwr
- if (grid_stair_direction(stair_find) != CMD_GO_UPSTAIRS)
+ if (feat_stair_direction(stair_find) != CMD_GO_UPSTAIRS)
{
if (stair_find == DNGN_STONE_ARCH)
mpr("There is nothing on the other side of the stone arch.");
@@ -1759,15 +1759,15 @@ void up_stairs(dungeon_feature_type force_stair,
if (!player_is_airborne()
&& you.confused()
&& old_level_type == LEVEL_DUNGEON
- && !grid_is_escape_hatch(stair_find)
+ && !feat_is_escape_hatch(stair_find)
&& coinflip())
{
const char* fall_where = "down the stairs";
- if (!grid_is_staircase(stair_find))
+ if (!feat_is_staircase(stair_find))
fall_where = "through the gate";
mprf("In your confused state, you trip and fall back %s.", fall_where);
- if (!grid_is_staircase(stair_find))
+ if (!feat_is_staircase(stair_find))
ouch(1, NON_MONSTER, KILLED_BY_FALLING_THROUGH_GATE);
else
ouch(1, NON_MONSTER, KILLED_BY_FALLING_DOWN_STAIRS);
@@ -1775,8 +1775,8 @@ void up_stairs(dungeon_feature_type force_stair,
return;
}
- if (you.burden_state == BS_OVERLOADED && !grid_is_escape_hatch(stair_find)
- && !is_gate(stair_find))
+ if (you.burden_state == BS_OVERLOADED && !feat_is_escape_hatch(stair_find)
+ && !feat_is_gate(stair_find))
{
mpr("You are carrying too much to climb upwards.");
you.turn_is_over = true;
@@ -1858,9 +1858,9 @@ void up_stairs(dungeon_feature_type force_stair,
const dungeon_feature_type stair_taken = stair_find;
- if (you.flight_mode() == FL_LEVITATE && !is_gate(stair_find))
+ if (you.flight_mode() == FL_LEVITATE && !feat_is_gate(stair_find))
mpr("You float upwards... And bob straight up to the ceiling!");
- else if (you.flight_mode() == FL_FLY && !is_gate(stair_find))
+ else if (you.flight_mode() == FL_FLY && !feat_is_gate(stair_find))
mpr("You fly upwards.");
else
climb_message(stair_find, true, old_level_type);
@@ -2004,7 +2004,7 @@ static void _player_change_level_downstairs(dungeon_feature_type stair_find,
&& (you.level_type != LEVEL_PANDEMONIUM
|| stair_find != DNGN_TRANSIT_PANDEMONIUM)
&& (you.level_type != LEVEL_PORTAL_VAULT
- || !grid_is_stone_stair(stair_find)))
+ || !feat_is_stone_stair(stair_find)))
{
you.level_type = LEVEL_DUNGEON;
}
@@ -2065,7 +2065,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
int shaft_level = -1;
// Probably still need this check here (teleportation) -- bwr
- if (grid_stair_direction(stair_find) != CMD_GO_DOWNSTAIRS && !shaft)
+ if (feat_stair_direction(stair_find) != CMD_GO_DOWNSTAIRS && !shaft)
{
if (stair_find == DNGN_STONE_ARCH)
mpr("There is nothing on the other side of the stone arch.");
@@ -2090,7 +2090,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
}
if (!force_stair && you.flight_mode() == FL_LEVITATE
- && !is_gate(stair_find))
+ && !feat_is_gate(stair_find))
{
mpr("You're floating high up above the floor!");
return;
@@ -2284,18 +2284,18 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
if (!player_is_airborne()
&& you.confused()
- && !grid_is_escape_hatch(stair_find)
+ && !feat_is_escape_hatch(stair_find)
&& force_stair != DNGN_ENTER_ABYSS
&& coinflip())
{
const char* fall_where = "down the stairs";
- if (!grid_is_staircase(stair_find))
+ if (!feat_is_staircase(stair_find))
fall_where = "through the gate";
mprf("In your confused state, you trip and fall %s.", fall_where);
// Note that this only does damage; it doesn't cancel the level
// transition.
- if (!grid_is_staircase(stair_find))
+ if (!feat_is_staircase(stair_find))
ouch(1, NON_MONSTER, KILLED_BY_FALLING_THROUGH_GATE);
else
ouch(1, NON_MONSTER, KILLED_BY_FALLING_DOWN_STAIRS);
@@ -2388,7 +2388,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
case LEVEL_DUNGEON:
// Xom thinks it's funny if you enter a new level via shaft
// or escape hatch, for shafts it's funnier the deeper you fell.
- if (shaft || grid_is_escape_hatch(stair_find))
+ if (shaft || feat_is_escape_hatch(stair_find))
xom_is_stimulated(shaft_depth * 50);
else
xom_is_stimulated(14);
@@ -3097,7 +3097,7 @@ void reveal_secret_door(const coord_def& p)
dungeon_feature_type door = grid_secret_door_appearance(p);
// Former secret doors become known but are still hidden to monsters
// until opened.
- grd(p) = grid_is_opaque(door) ? DNGN_DETECTED_SECRET_DOOR
+ grd(p) = feat_is_opaque(door) ? DNGN_DETECTED_SECRET_DOOR
: DNGN_OPEN_DOOR;
viewwindow(true, false);
learned_something_new(TUT_SEEN_SECRET_DOOR, p);
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 2ae2614e30..a282e0c942 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -89,10 +89,10 @@ static int _mons_real_base_speed(int mc);
habitat_type grid2habitat(dungeon_feature_type grid)
{
- if (grid_is_watery(grid))
+ if (feat_is_watery(grid))
return (HT_WATER);
- if (grid_is_rock(grid) && !grid_is_permarock(grid))
+ if (feat_is_rock(grid) && !feat_is_permarock(grid))
return (HT_ROCK);
switch (grid)
@@ -3699,7 +3699,7 @@ void monsters::init_with(const monsters &mon)
bool monsters::swimming() const
{
const dungeon_feature_type grid = grd(pos());
- return (grid_is_watery(grid) && mons_primary_habitat(this) == HT_WATER);
+ return (feat_is_watery(grid) && mons_primary_habitat(this) == HT_WATER);
}
bool monsters::wants_submerge() const
@@ -3752,7 +3752,7 @@ bool monsters::extra_balanced() const
bool monsters::floundering() const
{
const dungeon_feature_type grid = grd(pos());
- return (grid_is_water(grid)
+ return (feat_is_water(grid)
&& !cannot_fight()
// Can't use monster_habitable_grid() because that'll return
// true for non-water monsters in shallow water.
@@ -3767,11 +3767,11 @@ bool mons_class_can_pass(int mc, const dungeon_feature_type grid)
if (mons_class_wall_shielded(mc))
{
// Permanent walls can't be passed through.
- return (!grid_is_solid(grid)
- || grid_is_rock(grid) && !grid_is_permarock(grid));
+ return (!feat_is_solid(grid)
+ || feat_is_rock(grid) && !feat_is_permarock(grid));
}
- return !grid_is_solid(grid);
+ return !feat_is_solid(grid);
}
bool mons_can_pass(const monsters *mon, dungeon_feature_type grid)
@@ -4667,10 +4667,10 @@ bool monsters::drop_item(int eslot, int near)
}
dungeon_feature_type feat = grd(pos());
- if (grid_destroys_items(feat))
+ if (feat_destroys_items(feat))
{
if ( player_can_hear(pos()) )
- mprf(MSGCH_SOUND, grid_item_destruction_message(feat));
+ mprf(MSGCH_SOUND, feat_item_destruction_message(feat));
item_was_destroyed(*pitem, mindex());
unlink_item(item_index);
@@ -7145,7 +7145,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
}
}
else if (mons_near(this)
- && grid_compatible(grd(pos()), DNGN_DEEP_WATER))
+ && feat_compatible(grd(pos()), DNGN_DEEP_WATER))
{
mpr("Something invisible bursts forth from the water.");
interrupt_activity(AI_FORCE_INTERRUPT);
@@ -7402,7 +7402,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
case ENCH_AQUATIC_LAND:
// Aquatic monsters lose hit points every turn they spend on dry land.
ASSERT(mons_habitat(this) == HT_WATER
- && !grid_is_watery( grd(pos()) ));
+ && !feat_is_watery( grd(pos()) ));
// Zombies don't take damage from flopping about on land.
if (mons_is_zombified(this))
@@ -7652,7 +7652,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
// Assumption: mons_res_fire has already been checked.
case ENCH_STICKY_FLAME:
{
- if (grid_is_watery(grd(pos())))
+ if (feat_is_watery(grd(pos())))
{
if (mons_near(this) && player_monster_visible(this))
mprf("The flames covering %s go out.",
@@ -8123,9 +8123,9 @@ void monsters::apply_location_effects(const coord_def &oldpos)
if (alive() && has_ench(ENCH_AQUATIC_LAND))
{
- if (!grid_is_watery( grd(pos()) ))
+ if (!feat_is_watery( grd(pos()) ))
simple_monster_message(this, " flops around on dry land!");
- else if (!grid_is_watery( grd(oldpos) ))
+ else if (!feat_is_watery( grd(oldpos) ))
{
simple_monster_message(this, " dives back into the water!");
del_ench(ENCH_AQUATIC_LAND);
@@ -8923,7 +8923,7 @@ std::string do_mon_str_replacements(const std::string &in_msg,
msg = replace_all(msg, "@surface@", "buggy surface");
else if (feat == DNGN_LAVA)
msg = replace_all(msg, "@surface@", "lava");
- else if (grid_is_water(feat))
+ else if (feat_is_water(feat))
msg = replace_all(msg, "@surface@", "water");
else if (feat >= DNGN_ALTAR_FIRST_GOD && feat <= DNGN_ALTAR_LAST_GOD)
msg = replace_all(msg, "@surface@", "altar");
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 82984ef0bc..01306bb13b 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -70,38 +70,38 @@ static band_type _choose_band(int mon_type, int power, int &band_size);
static int _place_monster_aux(const mgen_data &mg, bool first_band_member,
bool force_pos = false);
-// Returns whether actual_grid is compatible with grid_wanted for monster
+// Returns whether actual_feat is compatible with feat_wanted for monster
// movement and generation.
-bool grid_compatible(dungeon_feature_type grid_wanted,
- dungeon_feature_type actual_grid)
+bool feat_compatible(dungeon_feature_type feat_wanted,
+ dungeon_feature_type actual_feat)
{
- if (grid_wanted == DNGN_FLOOR)
+ if (feat_wanted == DNGN_FLOOR)
{
- return (actual_grid >= DNGN_FLOOR
- && actual_grid != DNGN_BUILDER_SPECIAL_WALL
- || actual_grid == DNGN_SHALLOW_WATER);
+ return (actual_feat >= DNGN_FLOOR
+ && actual_feat != DNGN_BUILDER_SPECIAL_WALL
+ || actual_feat == DNGN_SHALLOW_WATER);
}
- if (grid_wanted >= DNGN_ROCK_WALL
- && grid_wanted <= DNGN_CLEAR_PERMAROCK_WALL)
+ if (feat_wanted >= DNGN_ROCK_WALL
+ && feat_wanted <= DNGN_CLEAR_PERMAROCK_WALL)
{
// A monster can only move through or inhabit permanent rock if that's
// exactly what it's asking for.
- if (actual_grid == DNGN_PERMAROCK_WALL
- || actual_grid == DNGN_CLEAR_PERMAROCK_WALL)
+ if (actual_feat == DNGN_PERMAROCK_WALL
+ || actual_feat == DNGN_CLEAR_PERMAROCK_WALL)
{
- return (grid_wanted == DNGN_PERMAROCK_WALL
- || grid_wanted == DNGN_CLEAR_PERMAROCK_WALL);
+ return (feat_wanted == DNGN_PERMAROCK_WALL
+ || feat_wanted == DNGN_CLEAR_PERMAROCK_WALL);
}
- return (actual_grid >= DNGN_ROCK_WALL
- && actual_grid <= DNGN_CLEAR_PERMAROCK_WALL);
+ return (actual_feat >= DNGN_ROCK_WALL
+ && actual_feat <= DNGN_CLEAR_PERMAROCK_WALL);
}
- return (grid_wanted == actual_grid
- || (grid_wanted == DNGN_DEEP_WATER
- && (actual_grid == DNGN_SHALLOW_WATER
- || actual_grid == DNGN_FOUNTAIN_BLUE)));
+ return (feat_wanted == actual_feat
+ || (feat_wanted == DNGN_DEEP_WATER
+ && (actual_feat == DNGN_SHALLOW_WATER
+ || actual_feat == DNGN_FOUNTAIN_BLUE)));
}
// Can this monster survive on actual_grid?
@@ -142,23 +142,23 @@ bool monster_habitable_grid(int monster_class,
if (actual_grid == DNGN_OPEN_SEA)
return (false);
- const dungeon_feature_type grid_preferred =
+ const dungeon_feature_type feat_preferred =
habitat2grid(mons_class_primary_habitat(monster_class));
- const dungeon_feature_type grid_nonpreferred =
+ const dungeon_feature_type feat_nonpreferred =
habitat2grid(mons_class_secondary_habitat(monster_class));
// Special check for fire elementals since their habitat is floor which
// is generally considered compatible with shallow water.
- if (monster_class == MONS_FIRE_ELEMENTAL && grid_is_watery(actual_grid))
+ if (monster_class == MONS_FIRE_ELEMENTAL && feat_is_watery(actual_grid))
return (false);
// Krakens are too large for shallow water.
if (monster_class == MONS_KRAKEN && actual_grid == DNGN_SHALLOW_WATER)
return (false);
- if (grid_compatible(grid_preferred, actual_grid)
- || (grid_nonpreferred != grid_preferred
- && grid_compatible(grid_nonpreferred, actual_grid)))
+ if (feat_compatible(feat_preferred, actual_grid)
+ || (feat_nonpreferred != feat_preferred
+ && feat_compatible(feat_nonpreferred, actual_grid)))
{
return (true);
}
@@ -185,7 +185,7 @@ bool monster_can_submerge(const monsters *mons, dungeon_feature_type grid)
{
case HT_WATER:
// Monsters can submerge in shallow water - this is intentional.
- return (grid_is_watery(grid));
+ return (feat_is_watery(grid));
case HT_LAVA:
return (grid == DNGN_LAVA);
@@ -669,10 +669,10 @@ static int _is_near_stairs(coord_def &p)
continue;
const dungeon_feature_type feat = grd(p);
- if (is_stair(feat))
+ if (feat_is_stair(feat))
{
// Shouldn't matter for escape hatches.
- if (grid_is_escape_hatch(feat))
+ if (feat_is_escape_hatch(feat))
continue;
// Should there be several stairs, don't overwrite the
@@ -694,9 +694,9 @@ static bool _valid_monster_location(const mgen_data &mg,
{
const int montype = (mons_class_is_zombified(mg.cls) ? mg.base_type
: mg.cls);
- const dungeon_feature_type grid_preferred =
+ const dungeon_feature_type feat_preferred =
habitat2grid(mons_class_primary_habitat(montype));
- const dungeon_feature_type grid_nonpreferred =
+ const dungeon_feature_type feat_nonpreferred =
habitat2grid(mons_class_secondary_habitat(montype));
if (!in_bounds(mg_pos))
@@ -707,9 +707,9 @@ static bool _valid_monster_location(const mgen_data &mg,
return (false);
// Is the monster happy where we want to put it?
- if (!grid_compatible(grid_preferred, grd(mg_pos))
- && (grid_nonpreferred == grid_preferred
- || !grid_compatible(grid_nonpreferred, grd(mg_pos))))
+ if (!feat_compatible(feat_preferred, grd(mg_pos))
+ && (feat_nonpreferred == feat_preferred
+ || !feat_compatible(feat_nonpreferred, grd(mg_pos))))
{
return (false);
}
@@ -2425,7 +2425,7 @@ static dungeon_feature_type _monster_secondary_habitat_feature(int mc)
class newmons_square_find : public travel_pathfind
{
private:
- dungeon_feature_type grid_wanted;
+ dungeon_feature_type feat_wanted;
coord_def start;
int maxdistance;
@@ -2438,7 +2438,7 @@ public:
newmons_square_find(dungeon_feature_type grdw,
const coord_def &pos,
int maxdist = 0)
- : grid_wanted(grdw), start(pos), maxdistance(maxdist),
+ : feat_wanted(grdw), start(pos), maxdistance(maxdist),
best_distance(0), nfound(0)
{
}
@@ -2459,7 +2459,7 @@ public:
{
return (false);
}
- if (!grid_compatible(grid_wanted, grd(dc)))
+ if (!feat_compatible(feat_wanted, grd(dc)))
{
if (passable.find(grd(dc)) != passable.end())
good_square(dc);
@@ -2487,18 +2487,18 @@ coord_def find_newmons_square_contiguous(monster_type mons_class,
{
coord_def p;
- const dungeon_feature_type grid_preferred =
+ const dungeon_feature_type feat_preferred =
_monster_primary_habitat_feature(mons_class);
- const dungeon_feature_type grid_nonpreferred =
+ const dungeon_feature_type feat_nonpreferred =
_monster_secondary_habitat_feature(mons_class);
- newmons_square_find nmpfind(grid_preferred, start, distance);
+ newmons_square_find nmpfind(feat_preferred, start, distance);
const coord_def pp = nmpfind.pathfind();
p = pp;
- if (grid_nonpreferred != grid_preferred && !in_bounds(pp))
+ if (feat_nonpreferred != feat_preferred && !in_bounds(pp))
{
- newmons_square_find nmsfind(grid_nonpreferred, start, distance);
+ newmons_square_find nmsfind(feat_nonpreferred, start, distance);
const coord_def ps = nmsfind.pathfind();
p = ps;
}
@@ -2514,19 +2514,19 @@ coord_def find_newmons_square(int mons_class, const coord_def &p)
if (mons_class == WANDERING_MONSTER)
mons_class = RANDOM_MONSTER;
- const dungeon_feature_type grid_preferred =
+ const dungeon_feature_type feat_preferred =
_monster_primary_habitat_feature(mons_class);
- const dungeon_feature_type grid_nonpreferred =
+ const dungeon_feature_type feat_nonpreferred =
_monster_secondary_habitat_feature(mons_class);
// Might be better if we chose a space and tried to match the monster
// to it in the case of RANDOM_MONSTER, that way if the target square
// is surrounded by water or lava this function would work. -- bwr
- if (empty_surrounds(p, grid_preferred, 2, true, empty))
+ if (empty_surrounds(p, feat_preferred, 2, true, empty))
pos = empty;
- if (grid_nonpreferred != grid_preferred && !in_bounds(pos)
- && empty_surrounds(p, grid_nonpreferred, 2, true, empty))
+ if (feat_nonpreferred != feat_preferred && !in_bounds(pos)
+ && empty_surrounds(p, feat_nonpreferred, 2, true, empty))
{
pos = empty;
}
@@ -2696,7 +2696,7 @@ bool empty_surrounds(const coord_def& where, dungeon_feature_type spc_wanted,
continue;
success =
- (grd(*ri) == spc_wanted) || grid_compatible(spc_wanted, grd(*ri));
+ (grd(*ri) == spc_wanted) || feat_compatible(spc_wanted, grd(*ri));
if (success && one_chance_in(++good_count))
empty = *ri;
@@ -3213,7 +3213,7 @@ bool monster_pathfind::traversable(const coord_def p)
if (mons)
return mons_traversable(p);
- return (!grid_is_solid(grd(p)) && !grid_destroys_items(grd(p)));
+ return (!feat_is_solid(grd(p)) && !feat_destroys_items(grd(p)));
}
// Checks whether a given monster can pass over a certain position, respecting
@@ -3227,7 +3227,7 @@ bool monster_pathfind::mons_traversable(const coord_def p)
return (false);
// Monsters that can't open doors won't be able to pass them.
- if (grid_is_closed_door(grd(p)) || grd(p) == DNGN_SECRET_DOOR)
+ if (feat_is_closed_door(grd(p)) || grd(p) == DNGN_SECRET_DOOR)
{
if (mons_is_zombified(mons))
{
@@ -3282,7 +3282,7 @@ int monster_pathfind::mons_travel_cost(coord_def npos)
ASSERT(grid_distance(pos, npos) <= 1);
// Doors need to be opened.
- if (grid_is_closed_door(grd(npos)) || grd(npos) == DNGN_SECRET_DOOR)
+ if (feat_is_closed_door(grd(npos)) || grd(npos) == DNGN_SECRET_DOOR)
return 2;
const int montype = mons_is_zombified(mons) ? mons_zombie_base(mons)
diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h
index b7c348bd00..4d24ef1815 100644
--- a/crawl-ref/source/monplace.h
+++ b/crawl-ref/source/monplace.h
@@ -310,7 +310,7 @@ bool drac_colour_incompatible(int drac, int colour);
void mark_interesting_monst(monsters* monster,
beh_type behaviour = BEH_SLEEP);
-bool grid_compatible(dungeon_feature_type grid_wanted,
+bool feat_compatible(dungeon_feature_type grid_wanted,
dungeon_feature_type actual_grid);
bool monster_habitable_grid(const monsters *m,
dungeon_feature_type actual_grid);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 80d4e11a78..42bc6a5606 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -277,7 +277,7 @@ bool curse_an_item( bool decay_potions, bool quiet )
void monster_drop_ething(monsters *monster, bool mark_item_origins,
int owner_id)
{
- const bool hostile_grid = grid_destroys_items(grd(monster->pos()));
+ const bool hostile_grid = feat_destroys_items(grd(monster->pos()));
bool destroyed = false;
@@ -313,7 +313,7 @@ void monster_drop_ething(monsters *monster, bool mark_item_origins,
}
if (destroyed)
- mprf(MSGCH_SOUND, grid_item_destruction_message(grd(monster->pos())));
+ mprf(MSGCH_SOUND, feat_item_destruction_message(grd(monster->pos())));
}
int fill_out_corpse(const monsters* monster, item_def& corpse,
@@ -395,7 +395,7 @@ int place_monster_corpse(const monsters *monster, bool silent,
// Don't attempt to place corpses within walls, either.
// Currently, this only applies to (shapeshifter) rock worms.
- if (grid_is_wall(grd(monster->pos())))
+ if (feat_is_wall(grd(monster->pos())))
return (-1);
item_def corpse;
@@ -409,7 +409,7 @@ int place_monster_corpse(const monsters *monster, bool silent,
if (corpse_class == -1 || (!force && coinflip()))
return (-1);
- if (grid_destroys_items(grd(monster->pos())))
+ if (feat_destroys_items(grd(monster->pos())))
{
item_was_destroyed(corpse);
return (-1);
@@ -2797,7 +2797,7 @@ bool swap_check(monsters *monster, coord_def &loc, bool quiet)
loc = you.pos();
// Don't move onto dangerous terrain.
- if (is_grid_dangerous(grd(monster->pos())))
+ if (is_feat_dangerous(grd(monster->pos())))
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
@@ -3429,7 +3429,7 @@ static void _mark_neighbours_target_unreachable(monsters *mon)
static bool _is_level_exit(const coord_def& pos)
{
// All types of stairs.
- if (is_stair(grd(pos)))
+ if (feat_is_stair(grd(pos)))
return (true);
// Teleportation and shaft traps.
@@ -3493,21 +3493,21 @@ static int _mons_find_nearest_level_exit(const monsters *mon,
// types, this should be expanded along with it.
static void _mons_indicate_level_exit(const monsters *mon)
{
- const dungeon_feature_type gridc = grd(mon->pos());
+ const dungeon_feature_type feat = grd(mon->pos());
const bool is_shaft = (get_trap_type(mon->pos()) == TRAP_SHAFT);
- if (is_gate(gridc))
+ if (feat_is_gate(feat))
simple_monster_message(mon, " passes through the gate.");
- else if (is_travelable_stair(gridc))
+ else if (feat_is_travelable_stair(feat))
{
- command_type dir = grid_stair_direction(gridc);
+ command_type dir = feat_stair_direction(feat);
simple_monster_message(mon,
make_stringf(" %s the %s.",
- dir == CMD_GO_UPSTAIRS ? "goes up" :
- dir == CMD_GO_DOWNSTAIRS ? "goes down"
- : "takes",
- is_escape_hatch(gridc) ? "escape hatch"
- : "stairs").c_str());
+ dir == CMD_GO_UPSTAIRS ? "goes up" :
+ dir == CMD_GO_DOWNSTAIRS ? "goes down"
+ : "takes",
+ feat_is_escape_hatch(feat) ? "escape hatch"
+ : "stairs").c_str());
}
else if (is_shaft)
{
@@ -3804,7 +3804,7 @@ static bool _find_siren_water_target(monsters *mon)
for (radius_iterator ri(mon->pos(), LOS_RADIUS, true, false);
ri; ++ri)
{
- if (!grid_is_water(grd(*ri)))
+ if (!feat_is_water(grd(*ri)))
continue;
// In the first iteration only count water grids that are
@@ -3895,7 +3895,7 @@ static bool _find_wall_target(monsters *mon)
// Target grid might have changed since we started, like if the
// player destroys the wall the monster wants to hide in.
- if (grid_is_solid(targ_pos)
+ if (cell_is_solid(targ_pos)
&& monster_habitable_grid(mon, grd(targ_pos)))
{
// Wall is still good.
@@ -3923,7 +3923,7 @@ static bool _find_wall_target(monsters *mon)
for (radius_iterator ri(mon->pos(), LOS_RADIUS, true, false);
ri; ++ri)
{
- if (!grid_is_solid(*ri)
+ if (!cell_is_solid(*ri)
|| !monster_habitable_grid(mon, grd(*ri)))
{
continue;
@@ -4362,7 +4362,7 @@ static void _handle_behaviour(monsters *mon)
mon->foe = MHITNOT;
}
- if (mons_wall_shielded(mon) && grid_is_solid(mon->pos()))
+ if (mons_wall_shielded(mon) && cell_is_solid(mon->pos()))
{
// Monster is safe, so its behaviour can be simplified to fleeing.
if (mon->behaviour == BEH_CORNERED || mon->behaviour == BEH_PANIC
@@ -4815,7 +4815,7 @@ static void _handle_behaviour(monsters *mon)
mon->foe = new_foe;
}
- if (mon->travel_target == MTRAV_WALL && grid_is_solid(mon->pos()))
+ if (mon->travel_target == MTRAV_WALL && cell_is_solid(mon->pos()))
{
if (mon->behaviour == BEH_FLEE)
{
@@ -5263,11 +5263,11 @@ static void _handle_movement(monsters *monster)
bool leftright = false;
coord_def t = monster->pos() + coord_def(mmov.x, 0);
- if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t)))
+ if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t)))
updown = true;
t = monster->pos() + coord_def(0, mmov.y);
- if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t)))
+ if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t)))
leftright = true;
if (updown && (!leftright || coinflip()))
@@ -5280,11 +5280,11 @@ static void _handle_movement(monsters *monster)
bool left = false;
bool right = false;
coord_def t = monster->pos() + coord_def(-1, mmov.y);
- if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t)))
+ if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t)))
left = true;
t = monster->pos() + coord_def(1, mmov.y);
- if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t)))
+ if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t)))
right = true;
if (left && (!right || coinflip()))
@@ -5297,11 +5297,11 @@ static void _handle_movement(monsters *monster)
bool up = false;
bool down = false;
coord_def t = monster->pos() + coord_def(mmov.x, -1);
- if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t)))
+ if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t)))
up = true;
t = monster->pos() + coord_def(mmov.x, 1);
- if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t)))
+ if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t)))
down = true;
if (up && (!down || coinflip()))
@@ -5798,7 +5798,7 @@ static bool _siren_movement_effect(const monsters *monster)
const coord_def newpos = you.pos() + dir;
- if (!in_bounds(newpos) || is_grid_dangerous(grd(newpos))
+ if (!in_bounds(newpos) || is_feat_dangerous(grd(newpos))
|| !you.can_pass_through_feat(grd(newpos)))
{
do_resist = true;
@@ -5949,7 +5949,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
if (!inside_level_bounds(t))
continue;
- if (!grid_is_solid(grd(t)))
+ if (!feat_is_solid(grd(t)))
{
monster->hit_points = -1;
used = true;
@@ -7423,7 +7423,7 @@ static void _monster_regenerate(monsters *monster)
|| cloud_type_at(monster->pos()) == CLOUD_FIRE))
|| (monster->type == MONS_WATER_ELEMENTAL
- && grid_is_watery(grd(monster->pos())))
+ && feat_is_watery(grd(monster->pos())))
|| (monster->type == MONS_AIR_ELEMENTAL
&& env.cgrid(monster->pos()) == EMPTY_CLOUD
@@ -8868,7 +8868,7 @@ static bool _mon_can_move_to_pos(const monsters *monster,
return (false);
}
else if (!monster->can_pass_through_feat(target_grid)
- || no_water && grid_is_water(target_grid))
+ || no_water && feat_is_water(target_grid))
{
return (false);
}
@@ -8901,7 +8901,7 @@ static bool _mon_can_move_to_pos(const monsters *monster,
// Fire elementals avoid water and cold.
if (monster->type == MONS_FIRE_ELEMENTAL
- && (grid_is_watery(target_grid)
+ && (feat_is_watery(target_grid)
|| targ_cloud_type == CLOUD_COLD))
{
return (false);
@@ -9124,10 +9124,10 @@ static bool _monster_move(monsters *monster)
std::vector<coord_def> adj_move;
for (adjacent_iterator ai(monster->pos()); ai; ++ai)
{
- if (!grid_is_solid(*ai))
+ if (!cell_is_solid(*ai))
{
adj_move.push_back(*ai);
- if (grid_is_watery(grd(*ai)))
+ if (feat_is_watery(grd(*ai)))
adj_water.push_back(*ai);
}
}
@@ -9190,7 +9190,7 @@ static bool _monster_move(monsters *monster)
// Normal/smart monsters know about secret doors, since they live in
// the dungeon.
if (grd(newpos) == DNGN_CLOSED_DOOR
- || grid_is_secret_door(grd(newpos)) && mons_intel(monster) >= I_NORMAL)
+ || feat_is_secret_door(grd(newpos)) && mons_intel(monster) >= I_NORMAL)
{
if (mons_is_zombified(monster))
{
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index bb23dfd7fb..ce3fba41e2 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -651,7 +651,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
&& monster_at(*ai)->attitude != monster->attitude)
sumcount++;
if (grd(*ai) != DNGN_FLOOR && grd(*ai) > DNGN_MAX_NONREACH
- && !grid_is_trap(grd(*ai)))
+ && !feat_is_trap(grd(*ai)))
sumcount++;
}
if (abs(you.pos().x-monster->pos().x)<=1 &&
@@ -676,7 +676,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
continue;
}
}
- if (grd(*ai) == DNGN_FLOOR || grid_is_trap(grd(*ai)))
+ if (grd(*ai) == DNGN_FLOOR || feat_is_trap(grd(*ai)))
{
grd(*ai) = DNGN_ROCK_WALL;
sumcount++;
diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc
index bb59e46571..a56a2bcc73 100644
--- a/crawl-ref/source/overmap.cc
+++ b/crawl-ref/source/overmap.cc
@@ -72,10 +72,10 @@ void seen_notable_thing( dungeon_feature_type which_thing,
if (you.level_type != LEVEL_DUNGEON)
return;
- const god_type god = grid_altar_god(which_thing);
+ const god_type god = feat_altar_god(which_thing);
if (god != GOD_NO_GOD)
_seen_altar( god, pos );
- else if (grid_is_branch_stairs( which_thing ))
+ else if (feat_is_branch_stairs( which_thing ))
_seen_staircase( which_thing, pos );
else
_seen_other_thing( which_thing, pos );
@@ -567,7 +567,7 @@ static bool _unnotice_shop(const level_pos &pos)
static bool _unnotice_stair(const level_pos &pos)
{
const dungeon_feature_type feat = grd(pos.pos);
- if (grid_is_branch_stairs(feat))
+ if (feat_is_branch_stairs(feat))
{
for (int i = 0; i < NUM_BRANCHES; ++i)
{
@@ -772,7 +772,7 @@ void annotate_level()
level_id li = level_id::current();
level_id li2 = level_id::current();
- if (is_stair(grd(you.pos())))
+ if (feat_is_stair(grd(you.pos())))
{
li2 = level_id::get_next_level_id(you.pos());
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 4cccea0a48..8f3343270a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -233,11 +233,11 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
bool merfolk_check = false;
if (you.species == SP_MERFOLK)
{
- if (grid_is_water(new_grid))
+ if (feat_is_water(new_grid))
merfolk_check = true;
// Safer water effects.
- if (grid_is_water(new_grid) && !grid_is_water(old_grid))
+ if (feat_is_water(new_grid) && !feat_is_water(old_grid))
{
// Check for fatal stat loss due to transforming.
// Also handles the warning message.
@@ -258,8 +258,8 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
need_doll_update = true;
#endif
}
- else if (!grid_is_water(new_grid) && grid_is_water(old_grid)
- && !is_grid_dangerous(new_grid))
+ else if (!feat_is_water(new_grid) && feat_is_water(old_grid)
+ && !is_feat_dangerous(new_grid))
{
unmeld_one_equip(EQ_BOOTS);
you.redraw_evasion = true;
@@ -273,7 +273,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
{
// XXX: at some point we're going to need to fix the swimming
// code to handle burden states.
- if (is_grid_dangerous(new_grid))
+ if (is_feat_dangerous(new_grid))
{
// Lava and dangerous deep water (ie not merfolk).
const coord_def entry = (stepped) ? you.pos() : p;
@@ -337,7 +337,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
if (trap_def* ptrap = find_trap(you.pos()))
ptrap->trigger(you, !stepped); // blinking makes it hard to evade
- command_type stair_dir = grid_stair_direction(new_grid);
+ command_type stair_dir = feat_stair_direction(new_grid);
if (stepped && stair_dir != CMD_NO_CMD
&& new_grid != DNGN_ENTER_SHOP
@@ -361,7 +361,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
std::string stair_str =
feature_description(new_grid, NUM_TRAPS, false,
DESC_CAP_THE, false);
- std::string prep = grid_preposition(new_grid, true, &you);
+ std::string prep = feat_preposition(new_grid, true, &you);
mprf("%s slides away as you move %s it!", stair_str.c_str(),
prep.c_str());
@@ -380,7 +380,7 @@ bool player_can_swim()
return (you.can_swim());
}
-bool is_grid_dangerous(int grid)
+bool is_feat_dangerous(dungeon_feature_type grid)
{
return (!player_is_airborne()
&& (grid == DNGN_LAVA
@@ -5581,7 +5581,7 @@ void dec_napalm_player()
{
if (you.duration[DUR_LIQUID_FLAMES] > 1)
{
- if (grid_is_watery(grd(you.pos())))
+ if (feat_is_watery(grd(you.pos())))
{
mpr("The flames go out!", MSGCH_WARN);
you.duration[DUR_LIQUID_FLAMES] = 0;
@@ -6260,7 +6260,7 @@ bool player::is_levitating() const
bool player::in_water() const
{
return (!airborne() && !beogh_water_walk()
- && grid_is_water(grd(you.pos())));
+ && feat_is_water(grd(you.pos())));
}
bool player::can_swim() const
@@ -6303,7 +6303,7 @@ bool player::floundering() const
bool player::can_pass_through_feat(dungeon_feature_type grid) const
{
- return !grid_is_solid(grid);
+ return !feat_is_solid(grid);
}
size_type player::body_size(int psize, bool base) const
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 8792fc0c49..ae164cbef1 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -450,7 +450,7 @@ item_def *player_weapon();
item_def *player_shield();
// Determines if the given grid is dangerous for the player to enter.
-bool is_grid_dangerous(int grid);
+bool is_feat_dangerous(dungeon_feature_type feat);
void run_macro(const char *macroname = NULL);
diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc
index 4beb6bed92..6d3db368d6 100644
--- a/crawl-ref/source/ray.cc
+++ b/crawl-ref/source/ray.cc
@@ -87,10 +87,10 @@ void ray_def::advance_and_bounce()
const double oldaccx = accx, oldaccy = accy;
adv_type rc = advance(false);
int newx = x(), newy = y();
- ASSERT(grid_is_solid(grd[newx][newy]));
+ ASSERT(feat_is_solid(grd[newx][newy]));
- const bool blocked_x = grid_is_solid(grd[oldx][newy]);
- const bool blocked_y = grid_is_solid(grd[newx][oldy]);
+ const bool blocked_x = feat_is_solid(grd[oldx][newy]);
+ const bool blocked_y = feat_is_solid(grd[newx][oldy]);
if (double_is_zero(slope) || slope > 100.0)
{
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 81bc558f2c..954dd3cf03 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1241,7 +1241,7 @@ static bool _need_missile_gift()
const item_def *launcher = _find_missile_launcher(best_missile_skill);
return (you.piety > 80
&& random2( you.piety ) > 70
- && !grid_destroys_items( grd(you.pos()) )
+ && !feat_destroys_items( grd(you.pos()) )
&& one_chance_in(8)
&& you.skills[ best_missile_skill ] >= 8
&& (launcher || best_missile_skill == SK_DARTS)
@@ -1330,7 +1330,7 @@ static void _show_pure_deck_chances()
static void _give_nemelex_gift()
{
- if (grid_destroys_items(grd(you.pos())))
+ if (feat_destroys_items(grd(you.pos())))
return;
// Nemelex will give at least one gift early.
@@ -2127,7 +2127,7 @@ static void _do_god_gift(bool prayed_for)
case GOD_TROG:
if (you.piety > 130
&& random2(you.piety) > 120
- && !grid_destroys_items(grd(you.pos()))
+ && !feat_destroys_items(grd(you.pos()))
&& one_chance_in(4))
{
if (you.religion == GOD_TROG
@@ -2274,7 +2274,7 @@ static void _do_god_gift(bool prayed_for)
}
if (gift != NUM_BOOKS
- && !grid_destroys_items(grd(you.pos())))
+ && !feat_destroys_items(grd(you.pos())))
{
if (gift == OBJ_RANDOM)
{
@@ -2433,7 +2433,7 @@ void pray()
const bool was_praying = !!you.duration[DUR_PRAYER];
bool something_happened = false;
- const god_type altar_god = grid_altar_god(grd(you.pos()));
+ const god_type altar_god = feat_altar_god(grd(you.pos()));
if (altar_god != GOD_NO_GOD)
{
if (you.flight_mode() == FL_LEVITATE)
@@ -2456,7 +2456,7 @@ void pray()
return;
}
- god_pitch(grid_altar_god(grd(you.pos())));
+ god_pitch(feat_altar_god(grd(you.pos())));
return;
}
}
@@ -4433,7 +4433,7 @@ bool trog_burn_spellbooks()
// If a grid is blocked, books lying there will be ignored.
// Allow bombing of monsters.
const unsigned short cloud = env.cgrid(*ri);
- if (grid_is_solid(grd(*ri))
+ if (feat_is_solid(grd(*ri))
|| cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_FIRE)
{
continue;
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 4d0389e9eb..0e71583ffb 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -164,10 +164,10 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink)
// Allow wizard blink to send player into walls, in case the
// user wants to alter that grid to something else.
- if (wizard_blink && grid_is_solid(grd(beam.target)))
+ if (wizard_blink && feat_is_solid(grd(beam.target)))
grd(beam.target) = DNGN_FLOOR;
- if (grid_is_solid(grd(beam.target)) || monster_at(beam.target))
+ if (feat_is_solid(grd(beam.target)) || monster_at(beam.target))
{
mpr("Oops! Maybe something was there already.");
random_blink(false);
@@ -522,7 +522,7 @@ bool conjure_flame(int pow, const coord_def& where)
return (false);
}
- if (grid_is_solid(where))
+ if (cell_is_solid(where))
{
if (grd(where) == DNGN_WAX_WALL)
mpr("The flames aren't hot enough to melt wax walls!");
@@ -1446,7 +1446,7 @@ void cast_fly(int power)
mpr("You fly up into the air.");
// Merfolk boots unmeld if flight takes us out of water.
- if (you.species == SP_MERFOLK && grid_is_water(grd(you.pos())))
+ if (you.species == SP_MERFOLK && feat_is_water(grd(you.pos())))
unmeld_one_equip(EQ_BOOTS);
}
else
@@ -1536,6 +1536,6 @@ void manage_fire_shield()
// Place fire clouds all around you
for ( adjacent_iterator ai; ai; ++ai )
- if (!grid_is_solid(grd(*ai)) && env.cgrid(*ai) == EMPTY_CLOUD)
+ if (!feat_is_solid(grd(*ai)) && env.cgrid(*ai) == EMPTY_CLOUD)
place_cloud( CLOUD_FIRE, *ai, 1 + random2(6), KC_YOU );
}
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 4e611af001..8d8ac9ba7a 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1307,7 +1307,7 @@ bool cast_summon_elemental(int pow, god_type god,
{
mon = MONS_FIRE_ELEMENTAL;
}
- else if (grid_is_watery(grd(targ))
+ else if (feat_is_watery(grd(targ))
&& (any_elemental || restricted_type == MONS_WATER_ELEMENTAL))
{
mon = MONS_WATER_ELEMENTAL;
@@ -1914,7 +1914,7 @@ bool sunlight()
target.x += x_offset[i];
target.y += y_offset[i];
- if (!in_bounds(target) || grid_is_solid(grd(target)))
+ if (!in_bounds(target) || feat_is_solid(grd(target)))
continue;
temp_bolt.explosion_draw_cell(target);
@@ -2038,7 +2038,7 @@ void path_distance(coord_def & origin,
{
idx = adj_it->x + adj_it->y * X_WIDTH;
if (see_cell(*adj_it)
- && !grid_is_solid(env.grid(*adj_it))
+ && !feat_is_solid(env.grid(*adj_it))
&& exclusion.insert(idx).second)
{
monsters * temp = monster_at(*adj_it);
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 0f431e3aff..11b71d67e6 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1605,8 +1605,8 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area)
if (you.species == SP_MERFOLK)
{
const dungeon_feature_type new_grid = grd(you.pos());
- if (grid_is_water(old_grid) && !grid_is_water(new_grid)
- || !grid_is_water(old_grid) && grid_is_water(new_grid))
+ if (feat_is_water(old_grid) && !feat_is_water(new_grid)
+ || !feat_is_water(old_grid) && feat_is_water(new_grid))
{
init_player_doll();
}
@@ -2063,7 +2063,7 @@ bool project_noise(void)
if (!silenced( pos ))
{
- if (in_bounds(pos) && !grid_is_solid(grd(pos)))
+ if (in_bounds(pos) && !feat_is_solid(grd(pos)))
{
noisy(30, pos);
success = true;
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 3f6f187090..075b0acf1b 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -934,7 +934,7 @@ static int _passwall(coord_def where, int pow, int, actor *)
switch (grd(n))
{
default:
- if (grid_is_solid(grd(n)))
+ if (feat_is_solid(grd(n)))
non_rock_barriers = true;
done = true;
break;
@@ -1733,7 +1733,7 @@ bool cast_portal_projectile(int pow)
if (item == -1)
return (false);
- if (grid_is_solid(target.target))
+ if (cell_is_solid(target.target))
{
mpr("You can't shoot at gazebos.");
return (false);
@@ -1758,7 +1758,7 @@ bool cast_portal_projectile(int pow)
bool cast_apportation(int pow, const coord_def& where)
{
// Protect the player from destroying the item.
- if (grid_destroys_items(grd(you.pos())))
+ if (feat_destroys_items(grd(you.pos())))
{
mpr( "That would be silly while over this terrain!" );
return (false);
diff --git a/crawl-ref/source/spl-mis.cc b/crawl-ref/source/spl-mis.cc
index 00a1f290f6..e2cee8e971 100644
--- a/crawl-ref/source/spl-mis.cc
+++ b/crawl-ref/source/spl-mis.cc
@@ -2118,8 +2118,8 @@ void MiscastEffect::_ice(int severity)
const dungeon_feature_type feat = grd(target->pos());
const bool frostable_feat =
- (feat == DNGN_FLOOR || grid_altar_god(feat) != GOD_NO_GOD
- || grid_is_staircase(feat) || grid_is_water(feat));
+ (feat == DNGN_FLOOR || feat_altar_god(feat) != GOD_NO_GOD
+ || feat_is_staircase(feat) || feat_is_water(feat));
const std::string feat_name = (feat == DNGN_FLOOR ? "the " : "") +
feature_description(target->pos(), false, DESC_NOCAP_THE);
@@ -2180,7 +2180,7 @@ void MiscastEffect::_ice(int severity)
you_msg = "A snowflake lands on your nose.";
break;
case 10:
- if (grid_is_water(feat))
+ if (feat_is_water(feat))
all_msg = "A thin layer of ice forms on " + feat_name;
else
all_msg = "Frost spreads across " + feat_name;
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 083cc13d14..56cb1eedb7 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -965,7 +965,7 @@ static bool _cloud_helper(cloud_func func, const coord_def& where,
cloud_type ctype, kill_category whose,
killer_type killer)
{
- if (!grid_is_solid(grd(where)) && env.cgrid(where) == EMPTY_CLOUD)
+ if (!feat_is_solid(grd(where)) && env.cgrid(where) == EMPTY_CLOUD)
{
func(where, pow, spread_rate, ctype, whose, killer);
return (true);
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index 6eb97aba92..c74e144a98 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -312,7 +312,7 @@ bool Stash::is_boring_feature(dungeon_feature_type feat)
case DNGN_UNDISCOVERED_TRAP:
return (true);
default:
- return (grid_is_solid(feat));
+ return (feat_is_solid(feat));
}
}
@@ -349,7 +349,7 @@ void Stash::update()
if (is_boring_feature(feat))
feat = DNGN_FLOOR;
- if (grid_is_trap(feat))
+ if (feat_is_trap(feat))
trap = get_trap_type(p);
// If this is your position, you know what's on this square
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 667a5fff53..efedacd0ea 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -1656,10 +1656,10 @@ int near_stairs(const coord_def &p, int max_dist,
for (radius_iterator ri(p, max_dist, true, false); ri; ++ri)
{
const dungeon_feature_type feat = grd(*ri);
- if (is_stair(feat))
+ if (feat_is_stair(feat))
{
// Shouldn't happen for escape hatches.
- if (grid_is_escape_hatch(feat))
+ if (feat_is_escape_hatch(feat))
continue;
stair_type = get_feature_dchar(feat);
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index ad0b33ee11..3dba3481ec 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -43,14 +43,14 @@ actor* actor_at(const coord_def& c)
return (monster_at(c));
}
-bool grid_is_wall(dungeon_feature_type grid)
+bool feat_is_wall(dungeon_feature_type feat)
{
- return (grid >= DNGN_MINWALL && grid <= DNGN_MAXWALL);
+ return (feat >= DNGN_MINWALL && feat <= DNGN_MAXWALL);
}
-bool grid_is_stone_stair(dungeon_feature_type grid)
+bool feat_is_stone_stair(dungeon_feature_type feat)
{
- switch (grid)
+ switch (feat)
{
case DNGN_STONE_STAIRS_UP_I:
case DNGN_STONE_STAIRS_UP_II:
@@ -64,14 +64,14 @@ bool grid_is_stone_stair(dungeon_feature_type grid)
}
}
-bool grid_is_staircase(dungeon_feature_type grid)
+bool feat_is_staircase(dungeon_feature_type feat)
{
- if (grid_is_stone_stair(grid))
+ if (feat_is_stone_stair(feat))
{
// Make up staircases in hell appear as gates.
if (player_in_hell())
{
- switch (grid)
+ switch (feat)
{
case DNGN_STONE_STAIRS_UP_I:
case DNGN_STONE_STAIRS_UP_II:
@@ -85,22 +85,17 @@ bool grid_is_staircase(dungeon_feature_type grid)
}
// All branch entries/exits are staircases, except for Zot.
- if (grid == DNGN_ENTER_ZOT || grid == DNGN_RETURN_FROM_ZOT)
+ if (feat == DNGN_ENTER_ZOT || feat == DNGN_RETURN_FROM_ZOT)
return (false);
- return (grid >= DNGN_ENTER_FIRST_BRANCH && grid <= DNGN_ENTER_LAST_BRANCH
- || grid >= DNGN_RETURN_FROM_FIRST_BRANCH
- && grid <= DNGN_RETURN_FROM_LAST_BRANCH);
+ return (feat >= DNGN_ENTER_FIRST_BRANCH && feat <= DNGN_ENTER_LAST_BRANCH
+ || feat >= DNGN_RETURN_FROM_FIRST_BRANCH
+ && feat <= DNGN_RETURN_FROM_LAST_BRANCH);
}
-bool grid_is_escape_hatch(dungeon_feature_type grid)
+bool feat_sealable_portal(dungeon_feature_type feat)
{
- return (grid == DNGN_ESCAPE_HATCH_UP || grid == DNGN_ESCAPE_HATCH_DOWN);
-}
-
-bool grid_sealable_portal(dungeon_feature_type grid)
-{
- switch (grid)
+ switch (feat)
{
case DNGN_ENTER_COCYTUS:
case DNGN_ENTER_DIS:
@@ -116,14 +111,133 @@ bool grid_sealable_portal(dungeon_feature_type grid)
}
}
-bool grid_is_portal(dungeon_feature_type grid)
+bool feat_is_portal(dungeon_feature_type feat)
+{
+ return (feat == DNGN_ENTER_PORTAL_VAULT || feat == DNGN_EXIT_PORTAL_VAULT);
+}
+
+// Returns true if the given dungeon feature is a stair, i.e., a level
+// exit.
+bool feat_is_stair(dungeon_feature_type gridc)
+{
+ return (feat_is_travelable_stair(gridc) || feat_is_gate(gridc));
+}
+
+// Returns true if the given dungeon feature is a travelable stair, i.e.,
+// it's a level exit with a consistent endpoint.
+bool feat_is_travelable_stair(dungeon_feature_type feat)
+{
+ switch (feat)
+ {
+ case DNGN_STONE_STAIRS_DOWN_I:
+ case DNGN_STONE_STAIRS_DOWN_II:
+ case DNGN_STONE_STAIRS_DOWN_III:
+ case DNGN_ESCAPE_HATCH_DOWN:
+ case DNGN_STONE_STAIRS_UP_I:
+ case DNGN_STONE_STAIRS_UP_II:
+ case DNGN_STONE_STAIRS_UP_III:
+ case DNGN_ESCAPE_HATCH_UP:
+ case DNGN_ENTER_HELL:
+ case DNGN_EXIT_HELL:
+ case DNGN_ENTER_DIS:
+ case DNGN_ENTER_GEHENNA:
+ case DNGN_ENTER_COCYTUS:
+ case DNGN_ENTER_TARTARUS:
+ case DNGN_ENTER_ORCISH_MINES:
+ case DNGN_ENTER_HIVE:
+ case DNGN_ENTER_LAIR:
+ case DNGN_ENTER_SLIME_PITS:
+ case DNGN_ENTER_VAULTS:
+ case DNGN_ENTER_CRYPT:
+ case DNGN_ENTER_HALL_OF_BLADES:
+ case DNGN_ENTER_ZOT:
+ case DNGN_ENTER_TEMPLE:
+ case DNGN_ENTER_SNAKE_PIT:
+ case DNGN_ENTER_ELVEN_HALLS:
+ case DNGN_ENTER_TOMB:
+ case DNGN_ENTER_SWAMP:
+ case DNGN_ENTER_SHOALS:
+ case DNGN_RETURN_FROM_ORCISH_MINES:
+ case DNGN_RETURN_FROM_HIVE:
+ case DNGN_RETURN_FROM_LAIR:
+ case DNGN_RETURN_FROM_SLIME_PITS:
+ case DNGN_RETURN_FROM_VAULTS:
+ case DNGN_RETURN_FROM_CRYPT:
+ case DNGN_RETURN_FROM_HALL_OF_BLADES:
+ case DNGN_RETURN_FROM_ZOT:
+ case DNGN_RETURN_FROM_TEMPLE:
+ case DNGN_RETURN_FROM_SNAKE_PIT:
+ case DNGN_RETURN_FROM_ELVEN_HALLS:
+ case DNGN_RETURN_FROM_TOMB:
+ case DNGN_RETURN_FROM_SWAMP:
+ case DNGN_RETURN_FROM_SHOALS:
+ return (true);
+ default:
+ return (false);
+ }
+}
+
+// Returns true if the given dungeon feature is an escape hatch.
+bool feat_is_escape_hatch(dungeon_feature_type feat)
{
- return (grid == DNGN_ENTER_PORTAL_VAULT || grid == DNGN_EXIT_PORTAL_VAULT);
+ switch (feat)
+ {
+ case DNGN_ESCAPE_HATCH_DOWN:
+ case DNGN_ESCAPE_HATCH_UP:
+ return (true);
+ default:
+ return (false);
+ }
+}
+
+// Returns true if the given dungeon feature can be considered a gate.
+bool feat_is_gate(dungeon_feature_type feat)
+{
+ // Make up staircases in hell appear as gates.
+ if (player_in_hell())
+ {
+ switch (feat)
+ {
+ case DNGN_STONE_STAIRS_UP_I:
+ case DNGN_STONE_STAIRS_UP_II:
+ case DNGN_STONE_STAIRS_UP_III:
+ return (true);
+ default:
+ break;
+ }
+ }
+
+ switch (feat)
+ {
+ case DNGN_ENTER_ABYSS:
+ case DNGN_EXIT_ABYSS:
+ case DNGN_ENTER_LABYRINTH:
+ case DNGN_ENTER_PANDEMONIUM:
+ case DNGN_EXIT_PANDEMONIUM:
+ case DNGN_TRANSIT_PANDEMONIUM:
+ case DNGN_ENTER_PORTAL_VAULT:
+ case DNGN_EXIT_PORTAL_VAULT:
+ case DNGN_ENTER_ZOT:
+ case DNGN_RETURN_FROM_ZOT:
+ case DNGN_ENTER_HELL:
+ case DNGN_EXIT_HELL:
+ case DNGN_ENTER_DIS:
+ case DNGN_ENTER_GEHENNA:
+ case DNGN_ENTER_COCYTUS:
+ case DNGN_ENTER_TARTARUS:
+ return (true);
+ default:
+ return (false);
+ }
}
-command_type grid_stair_direction(dungeon_feature_type grid)
+
+
+
+
+command_type feat_stair_direction(dungeon_feature_type feat)
{
- switch (grid)
+ switch (feat)
{
case DNGN_STONE_STAIRS_UP_I:
case DNGN_STONE_STAIRS_UP_II:
@@ -185,81 +299,81 @@ command_type grid_stair_direction(dungeon_feature_type grid)
}
}
-bool grid_is_opaque(dungeon_feature_type grid)
+bool feat_is_opaque(dungeon_feature_type feat)
{
- return (grid <= DNGN_MAXOPAQUE);
+ return (feat <= DNGN_MAXOPAQUE);
}
-bool grid_is_solid(dungeon_feature_type grid)
+bool feat_is_solid(dungeon_feature_type feat)
{
- return (grid <= DNGN_MAXSOLID);
+ return (feat <= DNGN_MAXSOLID);
}
-bool grid_is_solid(int x, int y)
+bool cell_is_solid(int x, int y)
{
- return (grid_is_solid(grd[x][y]));
+ return (feat_is_solid(grd[x][y]));
}
-bool grid_is_solid(const coord_def &c)
+bool cell_is_solid(const coord_def &c)
{
- return (grid_is_solid(grd(c)));
+ return (feat_is_solid(grd(c)));
}
-bool grid_is_closed_door(dungeon_feature_type grid)
+bool feat_is_closed_door(dungeon_feature_type feat)
{
- return (grid == DNGN_CLOSED_DOOR || grid == DNGN_DETECTED_SECRET_DOOR);
+ return (feat == DNGN_CLOSED_DOOR || feat == DNGN_DETECTED_SECRET_DOOR);
}
-bool grid_is_secret_door(dungeon_feature_type grid)
+bool feat_is_secret_door(dungeon_feature_type feat)
{
- return (grid == DNGN_SECRET_DOOR || grid == DNGN_DETECTED_SECRET_DOOR);
+ return (feat == DNGN_SECRET_DOOR || feat == DNGN_DETECTED_SECRET_DOOR);
}
-bool grid_is_rock(dungeon_feature_type grid)
+bool feat_is_rock(dungeon_feature_type feat)
{
- return (grid == DNGN_ORCISH_IDOL
- || grid == DNGN_GRANITE_STATUE
- || grid == DNGN_SECRET_DOOR
- || grid >= DNGN_ROCK_WALL
- && grid <= DNGN_CLEAR_PERMAROCK_WALL);
+ return (feat == DNGN_ORCISH_IDOL
+ || feat == DNGN_GRANITE_STATUE
+ || feat == DNGN_SECRET_DOOR
+ || feat >= DNGN_ROCK_WALL
+ && feat <= DNGN_CLEAR_PERMAROCK_WALL);
}
-bool grid_is_permarock(dungeon_feature_type grid)
+bool feat_is_permarock(dungeon_feature_type feat)
{
- return (grid == DNGN_PERMAROCK_WALL || grid == DNGN_CLEAR_PERMAROCK_WALL);
+ return (feat == DNGN_PERMAROCK_WALL || feat == DNGN_CLEAR_PERMAROCK_WALL);
}
-bool grid_is_trap(dungeon_feature_type grid, bool undiscovered_too)
+bool feat_is_trap(dungeon_feature_type feat, bool undiscovered_too)
{
- return (grid == DNGN_TRAP_MECHANICAL || grid == DNGN_TRAP_MAGICAL
- || grid == DNGN_TRAP_NATURAL
- || undiscovered_too && grid == DNGN_UNDISCOVERED_TRAP);
+ return (feat == DNGN_TRAP_MECHANICAL || feat == DNGN_TRAP_MAGICAL
+ || feat == DNGN_TRAP_NATURAL
+ || undiscovered_too && feat == DNGN_UNDISCOVERED_TRAP);
}
-bool grid_is_water(dungeon_feature_type grid)
+bool feat_is_water(dungeon_feature_type feat)
{
- return (grid == DNGN_SHALLOW_WATER
- || grid == DNGN_DEEP_WATER
- || grid == DNGN_OPEN_SEA
- || grid == DNGN_WATER_RESERVED);
+ return (feat == DNGN_SHALLOW_WATER
+ || feat == DNGN_DEEP_WATER
+ || feat == DNGN_OPEN_SEA
+ || feat == DNGN_WATER_RESERVED);
}
-bool grid_is_watery(dungeon_feature_type grid)
+bool feat_is_watery(dungeon_feature_type feat)
{
- return (grid_is_water(grid) || grid == DNGN_FOUNTAIN_BLUE);
+ return (feat_is_water(feat) || feat == DNGN_FOUNTAIN_BLUE);
}
-bool grid_destroys_items(dungeon_feature_type grid)
+bool feat_destroys_items(dungeon_feature_type feat)
{
- return (grid == DNGN_LAVA || grid == DNGN_DEEP_WATER);
+ return (feat == DNGN_LAVA || feat == DNGN_DEEP_WATER);
}
-// Returns GOD_NO_GOD if grid is not an altar, otherwise returns the
+// Returns GOD_NO_GOD if feat is not an altar, otherwise returns the
// GOD_* type.
-god_type grid_altar_god(dungeon_feature_type grid)
+god_type feat_altar_god(dungeon_feature_type feat)
{
- if (grid >= DNGN_ALTAR_FIRST_GOD && grid <= DNGN_ALTAR_LAST_GOD)
- return (static_cast<god_type>(grid - DNGN_ALTAR_FIRST_GOD + 1));
+ if (feat >= DNGN_ALTAR_FIRST_GOD && feat <= DNGN_ALTAR_LAST_GOD)
+ return (static_cast<god_type>(feat - DNGN_ALTAR_FIRST_GOD + 1));
return (GOD_NO_GOD);
}
@@ -274,10 +388,23 @@ dungeon_feature_type altar_for_god(god_type god)
return static_cast<dungeon_feature_type>(DNGN_ALTAR_FIRST_GOD + god - 1);
}
-bool grid_is_branch_stairs(dungeon_feature_type grid)
+// Returns true if the dungeon feature supplied is an altar.
+bool feat_is_altar(dungeon_feature_type grid)
{
- return ((grid >= DNGN_ENTER_FIRST_BRANCH && grid <= DNGN_ENTER_LAST_BRANCH)
- || (grid >= DNGN_ENTER_DIS && grid <= DNGN_ENTER_TARTARUS));
+ return feat_altar_god(grid) != GOD_NO_GOD;
+}
+
+bool feat_is_player_altar(dungeon_feature_type grid)
+{
+ // An ugly hack, but that's what religion.cc does.
+ return (you.religion != GOD_NO_GOD
+ && feat_altar_god(grid) == you.religion);
+}
+
+bool feat_is_branch_stairs(dungeon_feature_type feat)
+{
+ return ((feat >= DNGN_ENTER_FIRST_BRANCH && feat <= DNGN_ENTER_LAST_BRANCH)
+ || (feat >= DNGN_ENTER_DIS && feat <= DNGN_ENTER_TARTARUS));
}
// Find all connected cells containing ft, starting at d.
@@ -379,13 +506,13 @@ dungeon_feature_type grid_secret_door_appearance(const coord_def &where)
for (int dx = -1; dx <= 1; dx++)
for (int dy = -1; dy <= 1; dy++)
{
- // only considering orthogonal grids
+ // only considering orthogonal cells
if ((abs(dx) + abs(dy)) % 2 == 0)
continue;
const dungeon_feature_type targ = grd[where.x + dx][where.y + dy];
- if (!grid_is_wall( targ ))
+ if (!feat_is_wall(targ))
continue;
if (ret == DNGN_FLOOR)
@@ -398,10 +525,10 @@ dungeon_feature_type grid_secret_door_appearance(const coord_def &where)
: ret);
}
-const char *grid_item_destruction_message(dungeon_feature_type grid)
+const char *feat_item_destruction_message(dungeon_feature_type feat)
{
- return (grid == DNGN_DEEP_WATER ? "You hear a splash." :
- grid == DNGN_LAVA ? "You hear a sizzling splash."
+ return (feat == DNGN_DEEP_WATER ? "You hear a splash." :
+ feat == DNGN_LAVA ? "You hear a sizzling splash."
: "You hear a crunching noise.");
}
@@ -455,7 +582,7 @@ static coord_def _dgn_find_nearest_square(
static bool _item_safe_square(const coord_def &pos)
{
const dungeon_feature_type feat = grd(pos);
- return (is_traversable(feat) && !grid_destroys_items(feat));
+ return (feat_is_traversable(feat) && !feat_destroys_items(feat));
}
// Moves an item on the floor to the nearest adjacent floor-space.
@@ -473,8 +600,8 @@ static bool _dgn_shift_item(const coord_def &pos, item_def &item)
bool is_critical_feature(dungeon_feature_type feat)
{
- return (grid_stair_direction(feat) != CMD_NO_CMD
- || grid_altar_god(feat) != GOD_NO_GOD);
+ return (feat_stair_direction(feat) != CMD_NO_CMD
+ || feat_altar_god(feat) != GOD_NO_GOD);
}
static bool _is_feature_shift_target(const coord_def &pos)
@@ -507,8 +634,8 @@ static bool _dgn_shift_feature(const coord_def &pos)
static void _dgn_check_terrain_items(const coord_def &pos, bool preserve_items)
{
- const dungeon_feature_type grid = grd(pos);
- if (grid_is_solid(grid) || grid_destroys_items(grid))
+ const dungeon_feature_type feat = grd(pos);
+ if (feat_is_solid(feat) || feat_destroys_items(feat))
{
int item = igrd(pos);
bool did_destroy = false;
@@ -528,7 +655,7 @@ static void _dgn_check_terrain_items(const coord_def &pos, bool preserve_items)
}
}
if (did_destroy && player_can_hear(pos))
- mprf(MSGCH_SOUND, grid_item_destruction_message(grid));
+ mprf(MSGCH_SOUND, feat_item_destruction_message(feat));
}
}
@@ -552,13 +679,13 @@ static void _dgn_check_terrain_blood(const coord_def &pos,
{
// Caller has already changed the grid, and old_feat is actually
// the new feat.
- if (old_feat != DNGN_FLOOR && !grid_is_solid(old_feat))
+ if (old_feat != DNGN_FLOOR && !feat_is_solid(old_feat))
env.map(pos).property &= ~(FPROP_BLOODY);
}
else
{
- if (grid_is_solid(old_feat) != grid_is_solid(new_feat)
- || grid_is_water(new_feat) || grid_destroys_items(new_feat)
+ if (feat_is_solid(old_feat) != feat_is_solid(new_feat)
+ || feat_is_water(new_feat) || feat_destroys_items(new_feat)
|| is_critical_feature(new_feat))
{
env.map(pos).property &= ~(FPROP_BLOODY);
@@ -630,7 +757,7 @@ static void _announce_swap_real(coord_def orig_pos, coord_def dest_pos)
see_cell(orig_pos) ? DESC_CAP_THE : DESC_CAP_A,
false);
- std::string prep = grid_preposition(orig_feat, false);
+ std::string prep = feat_preposition(orig_feat, false);
std::string orig_actor, dest_actor;
if (orig_pos == you.pos())
@@ -870,7 +997,7 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2,
return (true);
}
-static bool _ok_dest_grid(const actor* orig_actor,
+static bool _ok_dest_cell(const actor* orig_actor,
const dungeon_feature_type orig_feat,
const coord_def dest_pos)
{
@@ -901,7 +1028,7 @@ bool slide_feature_over(const coord_def &src, coord_def prefered_dest,
const actor* orig_actor = actor_at(src);
if (in_bounds(prefered_dest)
- && _ok_dest_grid(orig_actor, orig_feat, prefered_dest))
+ && _ok_dest_cell(orig_actor, orig_feat, prefered_dest))
{
ASSERT(prefered_dest != src);
}
@@ -910,7 +1037,7 @@ bool slide_feature_over(const coord_def &src, coord_def prefered_dest,
int squares = 0;
for (adjacent_iterator ai(src); ai; ++ai)
{
- if (_ok_dest_grid(orig_actor, orig_feat, *ai)
+ if (_ok_dest_cell(orig_actor, orig_feat, *ai)
&& one_chance_in(++squares))
{
prefered_dest = *ai;
@@ -1003,7 +1130,7 @@ bool fall_into_a_pool( const coord_def& entry, bool allow_shift,
if (escape)
{
- if (in_bounds(empty) && !is_grid_dangerous(grd(empty)))
+ if (in_bounds(empty) && !is_feat_dangerous(grd(empty)))
{
mpr("You manage to scramble free!");
move_player_to_grid( empty, false, false, true );
@@ -1032,12 +1159,12 @@ void init_feat_desc_cache()
{
for (int i = 0; i < NUM_FEATURES; i++)
{
- dungeon_feature_type grid = static_cast<dungeon_feature_type>(i);
- std::string desc = feature_description(grid);
+ dungeon_feature_type feat = static_cast<dungeon_feature_type>(i);
+ std::string desc = feature_description(feat);
lowercase(desc);
if (feat_desc_cache.find(desc) == feat_desc_cache.end())
- feat_desc_cache[desc] = grid;
+ feat_desc_cache[desc] = feat;
}
}
@@ -1056,21 +1183,21 @@ dungeon_feature_type feat_by_desc(std::string desc)
return (DNGN_UNSEEN);
}
-// If active is true, the player is just stepping onto the grid, with the
+// If active is true, the player is just stepping onto the feature, with the
// message: "<feature> slides away as you move <prep> it!"
-// Else, the actor is already on the grid:
+// Else, the actor is already on the feature:
// "<feature> moves from <prep origin> to <prep destination>!"
-std::string grid_preposition(dungeon_feature_type grid, bool active,
+std::string feat_preposition(dungeon_feature_type feat, bool active,
const actor* who)
{
const bool airborne = !who || who->airborne();
- const command_type dir = grid_stair_direction(grid);
+ const command_type dir = feat_stair_direction(feat);
if (dir == CMD_NO_CMD)
{
- if (grid == DNGN_STONE_ARCH)
+ if (feat == DNGN_STONE_ARCH)
return "beside";
- else if (grid_is_solid(grid)) // Passwall?
+ else if (feat_is_solid(feat)) // Passwall?
{
if (active)
return "inside";
@@ -1079,7 +1206,7 @@ std::string grid_preposition(dungeon_feature_type grid, bool active,
}
else if (!airborne)
{
- if (grid == DNGN_LAVA || grid_is_water(grid))
+ if (feat == DNGN_LAVA || feat_is_water(feat))
{
if (active)
return "into";
@@ -1096,7 +1223,7 @@ std::string grid_preposition(dungeon_feature_type grid, bool active,
}
}
- if (dir == CMD_GO_UPSTAIRS && grid_is_escape_hatch(grid))
+ if (dir == CMD_GO_UPSTAIRS && feat_is_escape_hatch(feat))
{
if (active)
return "under";
@@ -1113,7 +1240,7 @@ std::string grid_preposition(dungeon_feature_type grid, bool active,
}
if (dir == CMD_GO_DOWNSTAIRS
- && (grid_is_staircase(grid) || grid_is_escape_hatch(grid)))
+ && (feat_is_staircase(feat) || feat_is_escape_hatch(feat)))
{
if (active)
return "onto";
@@ -1124,13 +1251,13 @@ std::string grid_preposition(dungeon_feature_type grid, bool active,
return "beside";
}
-std::string stair_climb_verb(dungeon_feature_type grid)
+std::string stair_climb_verb(dungeon_feature_type feat)
{
- ASSERT(grid_stair_direction(grid) != CMD_NO_CMD);
+ ASSERT(feat_stair_direction(feat) != CMD_NO_CMD);
- if (grid_is_staircase(grid))
+ if (feat_is_staircase(feat))
return "climb";
- else if (grid_is_escape_hatch(grid))
+ else if (feat_is_escape_hatch(feat))
return "use";
else
return "pass through";
diff --git a/crawl-ref/source/terrain.h b/crawl-ref/source/terrain.h
index 05dd845f42..1cceb40020 100644
--- a/crawl-ref/source/terrain.h
+++ b/crawl-ref/source/terrain.h
@@ -18,33 +18,41 @@ actor* actor_at(const coord_def& c);
bool fall_into_a_pool( const coord_def& entry, bool allow_shift,
unsigned char terrain );
-
-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_closed_door(dungeon_feature_type grid);
-bool grid_is_secret_door(dungeon_feature_type grid);
-bool grid_is_rock(dungeon_feature_type grid);
-bool grid_is_permarock(dungeon_feature_type grid);
-bool grid_is_stone_stair(dungeon_feature_type grid);
-bool grid_is_staircase(dungeon_feature_type grid);
-bool grid_is_escape_hatch(dungeon_feature_type grid);
-bool grid_is_trap(dungeon_feature_type grid, bool undiscovered_too = false);
-command_type grid_stair_direction(dungeon_feature_type grid);
-bool grid_sealable_portal(dungeon_feature_type grid);
-bool grid_is_portal(dungeon_feature_type grid);
-
-std::string grid_preposition(dungeon_feature_type grid, bool active = false,
+bool cell_is_solid(int x, int y);
+bool cell_is_solid(const coord_def &c);
+
+bool feat_is_wall(dungeon_feature_type feat);
+bool feat_is_opaque(dungeon_feature_type feat);
+bool feat_is_solid(dungeon_feature_type feat);
+bool feat_is_closed_door(dungeon_feature_type feat);
+bool feat_is_secret_door(dungeon_feature_type feat);
+bool feat_is_rock(dungeon_feature_type feat);
+bool feat_is_permarock(dungeon_feature_type feat);
+bool feat_is_stone_stair(dungeon_feature_type feat);
+bool feat_is_staircase(dungeon_feature_type feat);
+bool feat_is_escape_hatch(dungeon_feature_type feat);
+bool feat_is_trap(dungeon_feature_type feat, bool undiscovered_too = false);
+command_type feat_stair_direction(dungeon_feature_type feat);
+bool feat_sealable_portal(dungeon_feature_type feat);
+bool feat_is_portal(dungeon_feature_type feat);
+
+bool feat_is_stair(dungeon_feature_type feat);
+bool feat_is_travelable_stair(dungeon_feature_type feat);
+bool feat_is_escape_hatch(dungeon_feature_type feat);
+bool feat_is_gate(dungeon_feature_type feat);
+
+std::string feat_preposition(dungeon_feature_type feat, bool active = false,
const actor* who = NULL);
-std::string stair_climb_verb(dungeon_feature_type grid);
+std::string stair_climb_verb(dungeon_feature_type feat);
-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);
+bool feat_is_water(dungeon_feature_type feat);
+bool feat_is_watery(dungeon_feature_type feat);
+god_type feat_altar_god(dungeon_feature_type feat);
dungeon_feature_type altar_for_god(god_type god);
-bool grid_is_branch_stairs(dungeon_feature_type grid);
+bool feat_is_altar(dungeon_feature_type feat);
+bool feat_is_player_altar(dungeon_feature_type grid);
+
+bool feat_is_branch_stairs(dungeon_feature_type feat);
void find_connected_identical(coord_def d, dungeon_feature_type ft,
std::set<coord_def>& out);
void find_connected_range(coord_def d, dungeon_feature_type ft_min,
@@ -54,9 +62,9 @@ void get_door_description(int door_size, const char** adjective, const char** no
dungeon_feature_type grid_secret_door_appearance(const coord_def &where);
dungeon_feature_type grid_appearance(const coord_def &gc);
unsigned int show_appearance(const coord_def &ep);
-bool grid_destroys_items(dungeon_feature_type grid);
+bool feat_destroys_items(dungeon_feature_type feat);
-const char *grid_item_destruction_message( dungeon_feature_type grid );
+const char *feat_item_destruction_message( dungeon_feature_type feat );
// Terrain changed under 'pos', perform necessary effects.
void dungeon_terrain_changed(const coord_def &pos,
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 6a150a4b05..2eedc91c6b 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -67,15 +67,8 @@ void TileNewLevel(bool first_time)
unsigned int tile = env.tile_bk_bg[x][y];
if (!(tile & TILE_FLAG_NEW_STAIR))
continue;
-
- const coord_def gc(x,y);
- int object = grd(gc);
-
- if (!is_travelable_stair((dungeon_feature_type)object)
- || travel_cache.know_stair(gc))
- {
+ if (!is_unkown_stair(coord_def(x,y)))
env.tile_bk_bg[x][y] &= ~TILE_FLAG_NEW_STAIR;
- }
}
}
@@ -118,7 +111,7 @@ static int _bow_offset(const monsters *mon)
int tileidx_monster_base(const monsters *mon, bool detected)
{
- bool in_water = grid_is_water(grd(mon->pos()));
+ bool in_water = feat_is_water(grd(mon->pos()));
int type = mon->type;
@@ -2364,7 +2357,7 @@ int tileidx_feature(int object, int gx, int gy)
{
const dungeon_feature_type appear
= grid_secret_door_appearance(coord_def(gx, gy));
- ASSERT(!grid_is_secret_door(appear));
+ ASSERT(!feat_is_secret_door(appear));
return tileidx_feature((int) appear, gx, gy);
}
case DNGN_CLEAR_ROCK_WALL:
@@ -4243,7 +4236,7 @@ void tile_init_flavour(const coord_def &gc)
env.tile_flv(gc).wall = env.tile_default.wall + wall_rnd;
}
- if (grd(gc) == DNGN_OPEN_DOOR || grid_is_closed_door(grd(gc)))
+ if (grd(gc) == DNGN_OPEN_DOOR || feat_is_closed_door(grd(gc)))
{
// Check for horizontal gates.
@@ -4271,7 +4264,7 @@ void tile_init_flavour(const coord_def &gc)
else
env.tile_flv(gc).special = 0;
}
- else if (grid_is_secret_door(grd(gc)))
+ else if (feat_is_secret_door(grd(gc)))
env.tile_flv(gc).special = 0;
else if (!env.tile_flv(gc).special)
env.tile_flv(gc).special = random2(256);
@@ -4544,11 +4537,8 @@ void tile_draw_floor()
{
if (object == DNGN_DETECTED_SECRET_DOOR)
bg |= TILE_FLAG_WAS_SECRET;
- else if (is_travelable_stair((dungeon_feature_type)object)
- && !travel_cache.know_stair(gc))
- {
+ else if (is_unkown_stair(gc))
bg |= TILE_FLAG_NEW_STAIR;
- }
}
}
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 35598704b6..d84a6bd320 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1214,16 +1214,16 @@ int DungeonRegion::handle_mouse(MouseEvent &event)
if (!(event.mod & MOD_SHIFT))
return 'g';
- const dungeon_feature_type grid = grd(gc);
- switch (grid_stair_direction(grid))
+ const dungeon_feature_type feat = grd(gc);
+ switch (feat_stair_direction(feat))
{
case CMD_GO_DOWNSTAIRS:
return ('>');
case CMD_GO_UPSTAIRS:
return ('<');
default:
- if (is_altar(grid)
- && player_can_join_god(grid_altar_god(grid)))
+ if (feat_is_altar(feat)
+ && player_can_join_god(feat_altar_god(feat)))
{
return ('p');
}
@@ -1343,14 +1343,14 @@ bool DungeonRegion::update_tip_text(std::string& tip)
if (igrd(m_cursor[CURSOR_MOUSE]) != NON_ITEM)
tip += "\n[L-Click] Pick up items (g)";
- const dungeon_feature_type grid = grd(m_cursor[CURSOR_MOUSE]);
- const command_type dir = grid_stair_direction(grid);
+ const dungeon_feature_type feat = grd(m_cursor[CURSOR_MOUSE]);
+ const command_type dir = feat_stair_direction(feat);
if (dir != CMD_NO_CMD)
{
tip += "\n[Shift-L-Click] ";
- if (grid == DNGN_ENTER_SHOP)
+ if (feat == DNGN_ENTER_SHOP)
tip += "enter shop";
- else if (is_gate(grid))
+ else if (feat_is_gate(feat))
tip += "enter gate";
else
tip += "use stairs";
@@ -1360,7 +1360,7 @@ bool DungeonRegion::update_tip_text(std::string& tip)
else
tip += " (<)";
}
- else if (is_altar(grid) && player_can_join_god(grid_altar_god(grid)))
+ else if (feat_is_altar(feat) && player_can_join_god(feat_altar_god(feat)))
tip += "\n[Shift-L-Click] pray on altar (p)";
// Character overview.
@@ -1375,7 +1375,7 @@ bool DungeonRegion::update_tip_text(std::string& tip)
{
tip = "";
- if (!grid_is_solid(m_cursor[CURSOR_MOUSE]))
+ if (!cell_is_solid(m_cursor[CURSOR_MOUSE]))
{
int mon_num = mgrd(m_cursor[CURSOR_MOUSE]);
if (mon_num == NON_MONSTER || mons_friendly(&menv[mon_num]))
@@ -1393,7 +1393,7 @@ bool DungeonRegion::update_tip_text(std::string& tip)
}
else
{
- if (i_feel_safe() && !grid_is_solid(m_cursor[CURSOR_MOUSE]))
+ if (i_feel_safe() && !cell_is_solid(m_cursor[CURSOR_MOUSE]))
tip = "[L-Click] Travel\n";
tip += "[R-Click] Describe";
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 346c04bd25..76b73924c7 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -191,9 +191,9 @@ static void _populate_stair_distances(const level_pos &target);
static bool _is_greed_inducing_square(const LevelStashes *ls,
const coord_def &c);
-bool is_player_seen(int grid_x, int grid_y)
+bool is_player_seen(int feat_x, int feat_y)
{
- return (is_terrain_seen(grid_x, grid_y));
+ return (is_terrain_seen(feat_x, feat_y));
}
// Returns true if there is a known trap at (x,y). Returns false for non-trap
@@ -201,42 +201,36 @@ bool is_player_seen(int grid_x, int grid_y)
//
inline bool is_trap(const coord_def& c)
{
- return grid_is_trap(grd(c));
+ return feat_is_trap(grd(c));
}
// Returns an estimate for the time needed to cross this feature.
// This is done, so traps etc. will usually be circumvented where possible.
inline int feature_traverse_cost(dungeon_feature_type feature)
{
- if (feature == DNGN_SHALLOW_WATER || grid_is_closed_door(feature))
+ if (feature == DNGN_SHALLOW_WATER || feat_is_closed_door(feature))
return 2;
- else if (grid_is_trap(feature))
+ else if (feat_is_trap(feature))
return 3;
return 1;
}
-// Returns true if the dungeon feature supplied is an altar.
-bool is_altar(dungeon_feature_type grid)
-{
- return grid_altar_god(grid) != GOD_NO_GOD;
-}
-
bool is_altar(const coord_def &c)
{
- return is_altar(grd(c));
+ return feat_is_altar(grd(c));
}
-inline bool is_player_altar(dungeon_feature_type grid)
+inline bool is_player_altar(const coord_def &c)
{
- // An ugly hack, but that's what religion.cc does.
- return (you.religion != GOD_NO_GOD
- && grid_altar_god(grid) == you.religion);
+ return feat_is_player_altar(grd(c));
}
-inline bool is_player_altar(const coord_def &c)
+bool is_unknown_stair(const coord_def &p, dungeon_feature_type remembered_feat)
{
- return is_player_altar(grd(c));
+ dungeon_feature_type feat = (remembered_feat == NUM_REAL_FEATURES)
+ ? env.grid(p) : feat;
+ return (feat_is_travelable_stair(feat) && !travel_cache.know_stair(p));
}
#ifdef CLUA_BINDINGS
@@ -271,14 +265,14 @@ const char *trap_name(const coord_def& c)
#endif
// Returns true if the character can cross this dungeon feature.
-bool is_traversable(dungeon_feature_type grid)
+bool feat_is_traversable(dungeon_feature_type grid)
{
return (traversable_terrain[grid] == TRAVERSABLE);
}
opacity_type _feat_opacity(dungeon_feature_type feat)
{
- return (grid_is_opaque(feat) ? OPC_OPAQUE : OPC_CLEAR);
+ return (feat_is_opaque(feat) ? OPC_OPAQUE : OPC_CLEAR);
}
// A cell is considered clear unless the player knows it's
@@ -594,7 +588,7 @@ static bool _is_reseedable(const coord_def& c)
return (true);
const dungeon_feature_type grid = grd(c);
- return (grid_is_water(grid)
+ return (feat_is_water(grid)
|| grid == DNGN_LAVA
|| is_trap(c)
|| _is_monster_blocked(c));
@@ -635,7 +629,7 @@ bool is_travelsafe_square(const coord_def& c, bool ignore_hostile,
return (true);
}
- return (is_traversable(static_cast<dungeon_feature_type>(grid))
+ return (feat_is_traversable(static_cast<dungeon_feature_type>(grid))
#ifdef CLUA_BINDINGS
|| (is_trap(c)
&& clua.callbooleanfn(false, "ch_cross_trap",
@@ -792,121 +786,6 @@ bool is_branch_stair(const coord_def& pos)
return (next.branch != curr.branch);
}
-// Returns true if the given dungeon feature is a stair, i.e., a level
-// exit.
-bool is_stair(dungeon_feature_type gridc)
-{
- return (is_travelable_stair(gridc) || is_gate(gridc));
-}
-
-// Returns true if the given dungeon feature is a travelable stair, i.e.,
-// it's a level exit with a consistent endpoint.
-bool is_travelable_stair(dungeon_feature_type gridc)
-{
- switch (gridc)
- {
- case DNGN_STONE_STAIRS_DOWN_I:
- case DNGN_STONE_STAIRS_DOWN_II:
- case DNGN_STONE_STAIRS_DOWN_III:
- case DNGN_ESCAPE_HATCH_DOWN:
- case DNGN_STONE_STAIRS_UP_I:
- case DNGN_STONE_STAIRS_UP_II:
- case DNGN_STONE_STAIRS_UP_III:
- case DNGN_ESCAPE_HATCH_UP:
- case DNGN_ENTER_HELL:
- case DNGN_EXIT_HELL:
- case DNGN_ENTER_DIS:
- case DNGN_ENTER_GEHENNA:
- case DNGN_ENTER_COCYTUS:
- case DNGN_ENTER_TARTARUS:
- case DNGN_ENTER_ORCISH_MINES:
- case DNGN_ENTER_HIVE:
- case DNGN_ENTER_LAIR:
- case DNGN_ENTER_SLIME_PITS:
- case DNGN_ENTER_VAULTS:
- case DNGN_ENTER_CRYPT:
- case DNGN_ENTER_HALL_OF_BLADES:
- case DNGN_ENTER_ZOT:
- case DNGN_ENTER_TEMPLE:
- case DNGN_ENTER_SNAKE_PIT:
- case DNGN_ENTER_ELVEN_HALLS:
- case DNGN_ENTER_TOMB:
- case DNGN_ENTER_SWAMP:
- case DNGN_ENTER_SHOALS:
- case DNGN_RETURN_FROM_ORCISH_MINES:
- case DNGN_RETURN_FROM_HIVE:
- case DNGN_RETURN_FROM_LAIR:
- case DNGN_RETURN_FROM_SLIME_PITS:
- case DNGN_RETURN_FROM_VAULTS:
- case DNGN_RETURN_FROM_CRYPT:
- case DNGN_RETURN_FROM_HALL_OF_BLADES:
- case DNGN_RETURN_FROM_ZOT:
- case DNGN_RETURN_FROM_TEMPLE:
- case DNGN_RETURN_FROM_SNAKE_PIT:
- case DNGN_RETURN_FROM_ELVEN_HALLS:
- case DNGN_RETURN_FROM_TOMB:
- case DNGN_RETURN_FROM_SWAMP:
- case DNGN_RETURN_FROM_SHOALS:
- return (true);
- default:
- return (false);
- }
-}
-
-// Returns true if the given dungeon feature is an escape hatch.
-bool is_escape_hatch(dungeon_feature_type gridc)
-{
- switch (gridc)
- {
- case DNGN_ESCAPE_HATCH_DOWN:
- case DNGN_ESCAPE_HATCH_UP:
- return (true);
- default:
- return (false);
- }
-}
-
-// Returns true if the given dungeon feature can be considered a gate.
-bool is_gate(dungeon_feature_type gridc)
-{
- // Make up staircases in hell appear as gates.
- if (player_in_hell())
- {
- switch (gridc)
- {
- case DNGN_STONE_STAIRS_UP_I:
- case DNGN_STONE_STAIRS_UP_II:
- case DNGN_STONE_STAIRS_UP_III:
- return (true);
- default:
- break;
- }
- }
-
- switch (gridc)
- {
- case DNGN_ENTER_ABYSS:
- case DNGN_EXIT_ABYSS:
- case DNGN_ENTER_LABYRINTH:
- case DNGN_ENTER_PANDEMONIUM:
- case DNGN_EXIT_PANDEMONIUM:
- case DNGN_TRANSIT_PANDEMONIUM:
- case DNGN_ENTER_PORTAL_VAULT:
- case DNGN_EXIT_PORTAL_VAULT:
- case DNGN_ENTER_ZOT:
- case DNGN_RETURN_FROM_ZOT:
- case DNGN_ENTER_HELL:
- case DNGN_EXIT_HELL:
- case DNGN_ENTER_DIS:
- case DNGN_ENTER_GEHENNA:
- case DNGN_ENTER_COCYTUS:
- case DNGN_ENTER_TARTARUS:
- return (true);
- default:
- return (false);
- }
-}
-
// Prompts the user to stop explore if necessary for the given
// explore-stop condition, returns true if explore should be stopped.
bool prompt_stop_explore(int es_why)
@@ -1112,7 +991,7 @@ static void _explore_find_target_square()
feature = grd(target);
}
while (is_travelsafe_square(target)
- && is_traversable(feature)
+ && feat_is_traversable(feature)
&& feature_traverse_cost(feature) == 1);
target -= delta;
@@ -1896,7 +1775,7 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc)
if (dc != start
&& (feature != DNGN_FLOOR
- && !grid_is_water(feature)
+ && !feat_is_water(feature)
&& feature != DNGN_LAVA
|| is_waypoint(dc)
|| is_stash(ls, dc.x, dc.y)))
@@ -1992,7 +1871,7 @@ void find_travel_pos(const coord_def& youpos,
coord_def unseen = coord_def();
for (adjacent_iterator ai(dest); ai; ++ai)
if (!see_cell(*ai)
- && (!is_terrain_seen(*ai) || !grid_is_wall(grd(*ai))))
+ && (!is_terrain_seen(*ai) || !feat_is_wall(grd(*ai))))
{
unseen = *ai;
break;
@@ -2013,7 +1892,7 @@ void find_travel_pos(const coord_def& youpos,
// happen by manual movement, so I don't think we need to worry
// about this. (jpeg)
if (!is_travelsafe_square(new_dest)
- || !is_traversable(grd(new_dest)))
+ || !feat_is_traversable(grd(new_dest)))
{
new_dest = dest;
}
@@ -2733,7 +2612,7 @@ void start_translevel_travel(bool prompt_for_destination)
command_type _trans_negotiate_stairs()
{
- return grid_stair_direction(grd(you.pos()));
+ return feat_stair_direction(grd(you.pos()));
}
static int _target_distance_from(const coord_def &pos)
@@ -2884,7 +2763,7 @@ static int _find_transtravel_stair( const level_id &cur,
// that will leave the player unable to retrace their path.
// This does not apply if we have a destination with a specific
// position on the target level travel wants to get to.
- if (grid_is_escape_hatch(si.grid)
+ if (feat_is_escape_hatch(si.grid)
&& target.pos.x == -1
&& dest.id == target.id)
{
@@ -3651,11 +3530,11 @@ void LevelInfo::get_stairs(std::vector<coord_def> &st)
{
for (rectangle_iterator ri(1); ri; ++ri)
{
- const dungeon_feature_type grid = grd(*ri);
+ const dungeon_feature_type feat = grd(*ri);
const int envc = env.map(*ri).object;
if ((*ri == you.pos() || envc)
- && is_travelable_stair(grid)
+ && feat_is_travelable_stair(feat)
&& (is_terrain_seen(*ri) || !is_branch_stair(*ri)))
{
st.push_back(*ri);
@@ -4131,7 +4010,7 @@ const runrest &runrest::operator = (int newrunmode)
return (*this);
}
-static dungeon_feature_type _base_grid_type( dungeon_feature_type grid )
+static dungeon_feature_type _base_feat_type( dungeon_feature_type grid )
{
// Don't stop for undiscovered traps:
if ((grid >= DNGN_FLOOR_MIN && grid <= DNGN_FLOOR_MAX)
@@ -4141,7 +4020,7 @@ static dungeon_feature_type _base_grid_type( dungeon_feature_type grid )
}
// Merge walls and secret doors.
- if (grid_is_wall(grid) || grid == DNGN_SECRET_DOOR)
+ if (feat_is_wall(grid) || grid == DNGN_SECRET_DOOR)
return (DNGN_ROCK_WALL);
return (grid);
@@ -4153,7 +4032,7 @@ void runrest::set_run_check(int index, int dir)
const coord_def targ = you.pos() + Compass[dir];
- run_check[index].grid = _base_grid_type( grd(targ) );
+ run_check[index].grid = _base_feat_type( grd(targ) );
}
bool runrest::check_stop_running()
@@ -4179,7 +4058,7 @@ bool runrest::run_grids_changed() const
for (int i = 0; i < 3; i++)
{
const coord_def targ = you.pos() + run_check[i].delta;
- const dungeon_feature_type targ_grid = _base_grid_type(grd(targ));
+ const dungeon_feature_type targ_grid = _base_feat_type(grd(targ));
if (run_check[i].grid != targ_grid)
return (true);
@@ -4282,26 +4161,26 @@ bool explore_discoveries::merge_feature(
}
void explore_discoveries::found_feature(const coord_def &pos,
- dungeon_feature_type grid)
+ dungeon_feature_type feat)
{
- if (grid == DNGN_ENTER_SHOP && ES_shop)
+ if (feat == DNGN_ENTER_SHOP && ES_shop)
{
- shops.push_back( named_thing<int>( shop_name(pos), grid ) );
+ shops.push_back(named_thing<int>( shop_name(pos), feat));
es_flags |= ES_SHOP;
}
- else if (is_stair(grid) && ES_stair)
+ else if (feat_is_stair(feat) && ES_stair)
{
const named_thing<int> stair(cleaned_feature_description(pos), 1);
add_stair(stair);
es_flags |= ES_STAIR;
}
- else if (grid_is_portal(grid) && ES_portal)
+ else if (feat_is_portal(feat) && ES_portal)
{
const named_thing<int> portal(cleaned_feature_description(pos), 1);
add_stair(portal);
es_flags |= ES_PORTAL;
}
- else if (is_altar(grid)
+ else if (feat_is_altar(feat)
&& ES_altar
&& !player_in_branch(BRANCH_ECUMENICAL_TEMPLE))
{
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 7370d49d44..a6fb14fc94 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -59,26 +59,24 @@ void stop_running(void);
void travel_init_new_level();
void cycle_exclude_radius(const coord_def &p);
void del_exclude(const coord_def &p);
-void set_exclude(const coord_def &p, int radius = LOS_RADIUS, bool autoexcl = false);
+void set_exclude(const coord_def &p, int radius = LOS_RADIUS,
+ bool autoexcl = false);
void maybe_remove_autoexclusion(const coord_def &p);
std::string get_exclusion_desc();
void clear_excludes();
unsigned char is_waypoint(const coord_def &p);
bool is_exclude_root(const coord_def &p);
-bool is_stair(dungeon_feature_type gridc);
-bool is_travelable_stair(dungeon_feature_type gridc);
-bool is_escape_hatch(dungeon_feature_type gridc);
-bool is_gate(dungeon_feature_type gridc);
-command_type direction_to_command( char x, char y );
-bool is_altar(dungeon_feature_type gridc);
-bool is_resting( void );
+command_type direction_to_command(char x, char y);
+bool is_resting(void);
#ifdef CLUA_BINDINGS
const char *trap_name(const coord_def &p);
#endif
-bool is_traversable(dungeon_feature_type grid);
void explore_pickup_event(int did_pickup, int tried_pickup);
bool is_excluded(const coord_def &p);
+bool feat_is_traversable(dungeon_feature_type feat);
+bool is_unknown_stair(const coord_def &p,
+ dungeon_feature_type remembered_feat = NUM_REAL_FEATURES);
void find_travel_pos(const coord_def& youpos, char *move_x, char *move_y,
std::vector<coord_def>* coords = NULL);
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index 3420909acb..119405fbac 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -2211,7 +2211,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc)
{
tiles.place_cursor(CURSOR_TUTORIAL, gc);
std::string altar = "An altar to ";
- altar += god_name(grid_altar_god(grd(gc)));
+ altar += god_name(feat_altar_god(grd(gc)));
tiles.add_text_tag(TAG_TUTORIAL, altar, gc);
}
#endif
@@ -4220,7 +4220,7 @@ static void _tutorial_describe_feature(int x, int y)
"<w>Shift</w>. ";
#endif
- if (is_travelable_stair(feat) && !travel_cache.know_stair(where))
+ if (is_unknown_stair(where))
{
ostr << "\n\nYou have not yet passed through this particular "
"set of stairs. ";
@@ -4253,8 +4253,7 @@ static void _tutorial_describe_feature(int x, int y)
"clicking the <w>left mouse button</w> while pressing "
"<w>Shift</w> instead. ";
#endif
- if (is_travelable_stair(feat)
- && !travel_cache.know_stair(where))
+ if (is_unknown_stair(where))
{
ostr << "\n\nYou have not yet passed through this "
"particular set of stairs. ";
@@ -4294,7 +4293,7 @@ static void _tutorial_describe_feature(int x, int y)
default:
if (feat >= DNGN_ALTAR_FIRST_GOD && feat <= DNGN_ALTAR_LAST_GOD)
{
- god_type altar_god = grid_altar_god(feat);
+ god_type altar_god = feat_altar_god(feat);
if (you.religion == GOD_NO_GOD)
{
@@ -4595,9 +4594,9 @@ void tutorial_describe_monster(const monsters *mons)
void tutorial_observe_cell(const coord_def& gc)
{
- if (grid_is_escape_hatch(grd(gc)))
+ if (feat_is_escape_hatch(grd(gc)))
learned_something_new(TUT_SEEN_ESCAPE_HATCH, gc);
- else if (grid_is_branch_stairs(grd(gc)))
+ else if (feat_is_branch_stairs(grd(gc)))
learned_something_new(TUT_SEEN_BRANCH, gc);
else if (is_feature('>', gc))
learned_something_new(TUT_SEEN_STAIRS, gc);
@@ -4605,7 +4604,7 @@ void tutorial_observe_cell(const coord_def& gc)
learned_something_new(TUT_SEEN_ALTAR, gc);
else if (is_feature('^', gc))
learned_something_new(TUT_SEEN_TRAP, gc);
- else if (grid_is_closed_door(grd(gc)))
+ else if (feat_is_closed_door(grd(gc)))
learned_something_new(TUT_SEEN_DOOR, gc);
else if (grd(gc) == DNGN_ENTER_SHOP)
learned_something_new(TUT_SEEN_SHOP, gc);
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 9c3e465c1c..eed2184778 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -54,6 +54,7 @@ REVISION("$Rev$");
#include "spells3.h"
#include "stash.h"
#include "tiles.h"
+#include "travel.h"
#include "state.h"
#include "terrain.h"
#include "tilemcache.h"
@@ -394,19 +395,11 @@ static unsigned _get_symbol(int object, unsigned short *colour,
return (ch);
}
-static int _view_emphasised_colour(const coord_def& where,
- dungeon_feature_type feat,
- int oldcolour, int newcolour)
+static bool _emphasise(const coord_def& where, dungeon_feature_type feat)
{
- if (is_travelable_stair(feat) && !travel_cache.know_stair(where))
- {
- if ((you.your_level || grid_stair_direction(feat) == CMD_GO_DOWNSTAIRS)
- && you.where_are_you != BRANCH_VESTIBULE_OF_HELL)
- {
- return (newcolour);
- }
- }
- return (oldcolour);
+ return (is_unknown_stair(where, feat)
+ && (you.your_level || feat_stair_direction(feat) == CMD_GO_DOWNSTAIRS)
+ && you.where_are_you != BRANCH_VESTIBULE_OF_HELL);
}
static bool _show_bloodcovered(const coord_def& where)
@@ -417,7 +410,7 @@ static bool _show_bloodcovered(const coord_def& where)
dungeon_feature_type grid = grd(where);
// Altars, stairs (of any kind) and traps should not be coloured red.
- return (!is_critical_feature(grid) && !grid_is_trap(grid));
+ return (!is_critical_feature(grid) && !feat_is_trap(grid));
}
static unsigned short _tree_colour(const coord_def& where)
@@ -439,6 +432,8 @@ static void _get_symbol( const coord_def& where,
if (object < NUM_FEATURES)
{
+ const dungeon_feature_type feat =
+ static_cast<dungeon_feature_type>(object);
const feature_def &fdef = Feature[object];
*ch = magic_mapped? fdef.magic_symbol
@@ -448,13 +443,14 @@ static void _get_symbol( const coord_def& where,
{
const int colmask = *colour & COLFLAG_MASK;
- bool excluded_stairs = (object >= DNGN_STONE_STAIRS_DOWN_I
- && object <= DNGN_ESCAPE_HATCH_UP
+ // TODO: consolidate with feat_is_stair etc.
+ bool excluded_stairs = (feat >= DNGN_STONE_STAIRS_DOWN_I
+ && feat <= DNGN_ESCAPE_HATCH_UP
&& is_exclude_root(where));
bool blocked_movement = false;
if (!excluded_stairs
- && object < NUM_FEATURES && object >= DNGN_MINMOVE
+ && feat >= DNGN_MINMOVE
&& you.duration[DUR_MESMERISED])
{
// Colour grids that cannot be reached due to beholders
@@ -474,15 +470,10 @@ static void _get_symbol( const coord_def& where,
}
if (excluded_stairs)
- {
*colour = Options.tc_excluded | colmask;
- }
else if (blocked_movement)
- {
*colour = DARKGREY | colmask;
- }
- else if (object < NUM_REAL_FEATURES && object >= DNGN_MINMOVE
- && is_sanctuary(where) )
+ else if (feat >= DNGN_MINMOVE && is_sanctuary(where))
{
if (testbits(env.map(where).property, FPROP_SANCTUARY_1))
*colour = YELLOW | colmask;
@@ -496,35 +487,29 @@ static void _get_symbol( const coord_def& where,
*colour = LIGHTGREY | colmask; // 1/12
}
}
- else if (object < NUM_REAL_FEATURES && _show_bloodcovered(where))
- {
+ else if (_show_bloodcovered(where))
*colour = RED | colmask;
- }
- else if (object < NUM_REAL_FEATURES && env.grid_colours(where))
- {
+ else if (env.grid_colours(where))
*colour = env.grid_colours(where) | colmask;
- }
else
{
// Don't clobber with BLACK, because the colour should be
// already set.
if (fdef.colour != BLACK)
*colour = fdef.colour | colmask;
- else if (object == DNGN_TREES)
+ else if (feat == DNGN_TREES)
*colour = _tree_colour(where) | colmask;
- if (fdef.em_colour != fdef.colour && fdef.em_colour)
+ if (fdef.em_colour && fdef.em_colour != fdef.colour &&
+ _emphasise(where, feat))
{
- *colour =
- _view_emphasised_colour(
- where, static_cast<dungeon_feature_type>(object),
- *colour, fdef.em_colour | colmask);
+ *colour = (fdef.em_colour | colmask);
}
}
- if (object < NUM_REAL_FEATURES
- && (object >= DNGN_FLOOR_MIN && object <= DNGN_FLOOR_MAX
- || object == DNGN_UNDISCOVERED_TRAP))
+ // TODO: should be a feat_is_whatever(feat)
+ if (feat >= DNGN_FLOOR_MIN && feat <= DNGN_FLOOR_MAX
+ || feat == DNGN_UNDISCOVERED_TRAP)
{
if (inside_halo(where))
{
@@ -541,14 +526,13 @@ static void _get_symbol( const coord_def& where,
// Note anything we see that's notable
if (!where.origin() && fdef.is_notable())
{
- seen_notable_thing( static_cast<dungeon_feature_type>(object),
- where );
+ seen_notable_thing(feat, where);
}
}
else
{
- ASSERT( object >= DNGN_START_OF_MONSTERS );
- *ch = mons_char( object - DNGN_START_OF_MONSTERS );
+ ASSERT(object >= DNGN_START_OF_MONSTERS);
+ *ch = mons_char(object - DNGN_START_OF_MONSTERS);
}
if (colour)
@@ -691,8 +675,8 @@ unsigned short dos_brand( unsigned short colour,
// FIXME: Rework this function to use the new terrain known/seen checks
// These are still env.map coordinates, NOT grid coordinates!
-screen_buffer_t colour_code_map( const coord_def& p, bool item_colour,
- bool travel_colour )
+screen_buffer_t colour_code_map(const coord_def& p, bool item_colour,
+ bool travel_colour)
{
const unsigned short map_flags = env.map(p).flags;
if (!(map_flags & MAP_GRID_KNOWN))
@@ -706,12 +690,12 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour,
}
#endif
- dungeon_feature_type grid_value = grd(p);
+ dungeon_feature_type feat_value = grd(p);
if (!see_cell(p))
{
const int remembered = get_envmap_obj(p);
if (remembered < NUM_REAL_FEATURES)
- grid_value = static_cast<dungeon_feature_type>(remembered);
+ feat_value = static_cast<dungeon_feature_type>(remembered);
}
unsigned tc = travel_colour ? _get_travel_colour(p) : DARKGREY;
@@ -735,16 +719,11 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour,
int feature_colour = DARKGREY;
const bool terrain_seen = is_terrain_seen(p);
- const feature_def &fdef = Feature[grid_value];
- feature_colour = terrain_seen? fdef.seen_colour : fdef.map_colour;
+ const feature_def &fdef = Feature[feat_value];
+ feature_colour = terrain_seen ? fdef.seen_colour : fdef.map_colour;
- if (terrain_seen && feature_colour != fdef.seen_em_colour
- && fdef.seen_em_colour)
- {
- feature_colour =
- _view_emphasised_colour(p, grid_value, feature_colour,
- fdef.seen_em_colour);
- }
+ if (terrain_seen && fdef.seen_em_colour && _emphasise(p, feat_value))
+ feature_colour = fdef.seen_em_colour;
if (feature_colour != DARKGREY)
tc = feature_colour;
@@ -775,13 +754,13 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour,
}
if (Options.feature_item_brand
- && is_critical_feature(grid_value)
+ && is_critical_feature(feat_value)
&& igrd(p) != NON_ITEM)
{
tc |= COLFLAG_FEATURE_ITEM;
}
else if (Options.trap_item_brand
- && grid_is_trap(grid_value) && igrd(p) != NON_ITEM)
+ && feat_is_trap(feat_value) && igrd(p) != NON_ITEM)
{
// FIXME: this uses the real igrd, which the player shouldn't
// be aware of.
@@ -850,13 +829,13 @@ void clear_map(bool clear_detected_items, bool clear_detected_monsters)
{
unsigned int feature = grd(p);
- unsigned int grid_symbol;
- unsigned short grid_colour;
- get_item_symbol(feature, &grid_symbol, &grid_colour);
+ unsigned int feat_symbol;
+ unsigned short feat_colour;
+ get_item_symbol(feature, &feat_symbol, &feat_colour);
unsigned int fg;
unsigned int bg;
- tileidx_unseen(fg, bg, grid_symbol, p);
+ tileidx_unseen(fg, bg, feat_symbol, p);
env.tile_bk_bg(p) = bg;
env.tile_bk_fg(p) = fg;
}
@@ -900,7 +879,7 @@ int get_mons_colour(const monsters *mons)
{
if (Options.feature_item_brand != CHATTR_NORMAL
&& is_critical_feature(grd(mons->pos()))
- && grid_stair_direction(grd(mons->pos())) != CMD_NO_CMD)
+ && feat_stair_direction(grd(mons->pos())) != CMD_NO_CMD)
{
col |= COLFLAG_FEATURE_ITEM;
}
@@ -1587,15 +1566,15 @@ inline static void _update_item_grid(const coord_def &gp, const coord_def &ep)
const item_def &eitem = mitm[igrd(gp)];
unsigned short &ecol = env.show_col(ep);
- const dungeon_feature_type grid = grd(gp);
- if (Options.feature_item_brand && is_critical_feature(grid))
+ const dungeon_feature_type feat = grd(gp);
+ if (Options.feature_item_brand && is_critical_feature(feat))
ecol |= COLFLAG_FEATURE_ITEM;
- else if (Options.trap_item_brand && grid_is_trap(grid))
+ else if (Options.trap_item_brand && feat_is_trap(feat))
ecol |= COLFLAG_TRAP_ITEM;
else
{
const unsigned short gcol = env.grid_colours(gp);
- ecol = (grid == DNGN_SHALLOW_WATER) ?
+ ecol = (feat == DNGN_SHALLOW_WATER) ?
(gcol != BLACK ? gcol : CYAN) : eitem.colour;
if (eitem.link != NON_ITEM && !crawl_state.arena)
ecol |= COLFLAG_ITEM_HEAP;
@@ -1604,7 +1583,7 @@ inline static void _update_item_grid(const coord_def &gp, const coord_def &ep)
#ifdef USE_TILE
int idx = igrd(gp);
- if (is_stair(grid))
+ if (feat_is_stair(feat))
tile_place_item_marker(ep.x, ep.y, idx);
else
tile_place_item(ep.x, ep.y, idx);
@@ -1940,7 +1919,7 @@ void blood_smell( int strength, const coord_def& where )
}
-// Determines if the given feature is present at (x, y) in _grid_ coordinates.
+// Determines if the given feature is present at (x, y) in _feat_ coordinates.
// If you have map coords, add (1, 1) to get grid coords.
// Use one of
// 1. '<' and '>' to look for stairs
@@ -2904,13 +2883,13 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg,
bool open = true;
- if (grid_is_solid(grd(*ri)) && !grid_is_closed_door(grd(*ri)))
+ if (feat_is_solid(grd(*ri)) && !feat_is_closed_door(grd(*ri)))
{
open = false;
for (adjacent_iterator ai(*ri); ai; ++ai)
{
- if (map_bounds(*ai) && (!grid_is_opaque(grd(*ai))
- || grid_is_closed_door(grd(*ai))))
+ if (map_bounds(*ai) && (!feat_is_opaque(grd(*ai))
+ || feat_is_closed_door(grd(*ai))))
{
open = true;
break;
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index eccfed5285..28bc00d85b 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -377,13 +377,13 @@ static int _exploration_estimate(bool seen_only = false)
}
bool open = true;
- if (grid_is_solid(grd(pos)) && !grid_is_closed_door(grd(pos)))
+ if (feat_is_solid(grd(pos)) && !feat_is_closed_door(grd(pos)))
{
open = false;
for (adjacent_iterator ai(pos); ai; ++ai)
{
- if (map_bounds(*ai) && (!grid_is_opaque(grd(*ai))
- || grid_is_closed_door(grd(*ai))))
+ if (map_bounds(*ai) && (!feat_is_opaque(grd(*ai))
+ || feat_is_closed_door(grd(*ai))))
{
open = true;
break;
@@ -639,10 +639,10 @@ static void _xom_make_item(object_class_type base, int subtype, int power)
items(true, base, subtype, true, power, MAKE_ITEM_RANDOM_RACE,
0, 0, GOD_XOM);
- if (grid_destroys_items(grd(you.pos())))
+ if (feat_destroys_items(grd(you.pos())))
{
if (!silenced(you.pos()))
- mprf(MSGCH_SOUND, grid_item_destruction_message(grd(you.pos())));
+ mprf(MSGCH_SOUND, feat_item_destruction_message(grd(you.pos())));
simple_god_message(" snickers.", GOD_XOM);
destroy_item(thing_created, true);
@@ -2383,8 +2383,8 @@ static void _xom_zero_miscast()
const dungeon_feature_type feat = grd(you.pos());
- if (!grid_is_solid(feat) && grid_stair_direction(feat) == CMD_NO_CMD
- && !grid_is_trap(feat) && feat != DNGN_STONE_ARCH
+ if (!feat_is_solid(feat) && feat_stair_direction(feat) == CMD_NO_CMD
+ && !feat_is_trap(feat) && feat != DNGN_STONE_ARCH
&& feat != DNGN_OPEN_DOOR && feat != DNGN_ABANDONED_SHOP)
{
const std::string feat_name =
@@ -2405,13 +2405,13 @@ static void _xom_zero_miscast()
vec->push_back(feat_name
+ " seems to rush up at you!");
- if (grid_is_water(feat))
+ if (feat_is_water(feat))
{
priority.push_back("Something invisible splashes into the "
"water beneath you!");
}
}
- else if (grid_is_water(feat))
+ else if (feat_is_water(feat))
{
priority.push_back("The water briefly recedes away from you.");
priority.push_back("Something invisible splashes into the water "
@@ -2419,7 +2419,7 @@ static void _xom_zero_miscast()
}
}
- if (!grid_destroys_items(feat) && !grid_is_solid(feat)
+ if (!feat_destroys_items(feat) && !feat_is_solid(feat)
&& inv_items.size() > 0)
{
int idx = inv_items[random2(inv_items.size())];
@@ -2816,7 +2816,7 @@ static int _xom_player_confusion_effect(int sever, bool debug = false)
{
// Don't confuse the player if standing next to lava or deep water.
for (adjacent_iterator ai; ai; ++ai)
- if (in_bounds(*ai) && is_grid_dangerous(grd(*ai)))
+ if (in_bounds(*ai) && is_feat_dangerous(grd(*ai)))
return (XOM_DID_NOTHING);
}
@@ -2883,7 +2883,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under)
ASSERT(stair_pos != you.pos());
dungeon_feature_type feat = grd(stair_pos);
- ASSERT(grid_stair_direction(feat) != CMD_NO_CMD);
+ ASSERT(feat_stair_direction(feat) != CMD_NO_CMD);
coord_def begin, towards;
@@ -2951,7 +2951,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under)
bool found_stairs = false;
int past_stairs = 0;
while (in_bounds(ray.pos()) && see_cell(ray.pos())
- && !grid_is_solid(ray.pos()) && ray.pos() != you.pos())
+ && !cell_is_solid(ray.pos()) && ray.pos() != you.pos())
{
if (ray.pos() == stair_pos)
found_stairs = true;
@@ -2961,7 +2961,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under)
}
past_stairs--;
- if (!away && grid_is_solid(ray.pos()))
+ if (!away && cell_is_solid(ray.pos()))
{
// Transparent wall between stair and player.
return (stairs_moved);
@@ -2969,7 +2969,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under)
if (away && !found_stairs)
{
- if (grid_is_solid(ray.pos()))
+ if (cell_is_solid(ray.pos()))
{
// Transparent wall between stair and player.
return (stairs_moved);
@@ -3050,11 +3050,11 @@ static int _xom_repel_stairs(bool debug = false)
for (radius_iterator ri(you.pos(), LOS_RADIUS, false, true); ri; ++ri)
{
dungeon_feature_type feat = grd(*ri);
- if (grid_stair_direction(feat) != CMD_NO_CMD
+ if (feat_stair_direction(feat) != CMD_NO_CMD
&& feat != DNGN_ENTER_SHOP)
{
stairs_avail.push_back(*ri);
- if (grid_is_staircase(feat))
+ if (feat_is_staircase(feat))
real_stairs = true;
}
}
@@ -3073,7 +3073,7 @@ static int _xom_repel_stairs(bool debug = false)
std::string feat_name;
if (!real_stairs)
{
- if (grid_is_escape_hatch(grd(stairs_avail[0])))
+ if (feat_is_escape_hatch(grd(stairs_avail[0])))
feat_name = "escape hatch";
else
feat_name = "gate";
@@ -3088,7 +3088,7 @@ static int _xom_repel_stairs(bool debug = false)
you.duration[DUR_REPEL_STAIRS_MOVE] = 1000;
if (one_chance_in(5)
- || grid_stair_direction(grd(you.pos())) != CMD_NO_CMD
+ || feat_stair_direction(grd(you.pos())) != CMD_NO_CMD
&& grd(you.pos()) != DNGN_ENTER_SHOP)
{
you.duration[DUR_REPEL_STAIRS_CLIMB] = 500;