summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/debug.h
Commit message (Collapse)AuthorAgeFilesLines
* Move ASSERT_IN_BOUNDS to coord.hNeil Moore2014-05-291-9/+0
| | | | Since its expansion called in_bounds().
* Drop double newlines where they seem to serve no purpose.Adam Borowski2013-12-211-1/+0
| | | | | Sometimes, they're there to emphasize a break between two sections of code, which is good. In a majority of cases, though, they're just inconsistent.
* New mcros ASSERT_IN_BOUNDS{,_OR_ORIGIN}().Neil Moore2013-06-091-3/+12
| | | | | These print the out-of-bounds coordinate as part of the assertion message.
* ASSERT_RANGE(value, min, max)Adam Borowski2013-06-081-2/+17
|
* Don't use "" where a null works better.Adam Borowski2013-06-081-1/+1
|
* Add an ASSERTM macro for more verbose ASSERTsPete Hurst2013-05-231-1/+11
| | | | | | | | The syntax is ASSERTM(condition, text, args...) Where text is the format string for an additional message to be printed after the condition and file/line#, and args are additional arguments with which to format the string.
* The C++ version check failed in MSVC, add a more explicit checkPete Hurst2013-05-191-1/+1
|
* Remove an unused macro.Adam Borowski2013-05-091-3/+0
|
* Clean up leftover debug.h code from 7971002b and 64c133e5.Samuel Bronson2013-04-301-5/+0
|
* Ignore warnings about type limits, but only inside ASSERT().Adam Borowski2013-04-261-0/+18
| | | | | | | | | | | | | | | | | | These show up on gcc -Wextra, and in clang by default. These come from two sources: * us checking currently true cases that may change in the future * clang narrowing enum types and then looking at the narrowed size The latter is quite bogus, as an enum with < 128 values will break the moment 128th value is added, something this assertion guards against. In any case, assertions by definition are meant to catch stuff that shouldn't happen, and if flow analysis proves it indeed can't happen, that doesn't make the assertion less valuable. After this commit, remaining warnings in -Wextra --std=c++11 in Crawl proper (TODO: rltiles) are either compiler bugs (clang's: private field 'foo' is not used [-Wunused-private-field]) or annoying crap that can't be disabled (gcc's: enumeral and non-enumeral type in conditional expression [enabled by default]).
* A too-ugly-to-live hack to unbreak compilation on gcc-4.8.Adam Borowski2012-08-271-0/+1
| | | | | We'd need some way to have a static_assert() without using C++11 that doesn't spam warnings in the no failure case.
* Make inline functions static.Adam Borowski2012-08-091-1/+1
| | | | | | | | | This avoids unnecessary non-inlined copies. Also, we had a few large functions that had no reason for inlining, let's have them be regular ones. I also made "static inline" always use the same order, for easier grepping.
* Make COMPILE_CHECK work both with --std=c++11 and on gcc-4.8.Adam Borowski2012-06-031-2/+15
| | | | | | | | | | I could just use the sizeof() trick everywhere, but: * the old way produced a better message on gcc before 4.8 (it included the words "compile_check") * if C++11 has explicit support for this (static_assert()), we can use it when building in that mode (not the default for Crawl)
* Remove the now-unused code for emergency saves.Adam Borowski2012-04-141-9/+4
| | | | | If we want them back for assertions, it'd be far better to save _before_ going into the crash handler.
* Enable printf warnings for yet more functions & fix problems identifiedSamuel Bronson2011-12-261-3/+3
|
* Fix MSVC compilation.Hurcan Solter2011-06-121-1/+1
|
* Don't require ", c1" in COMPILE_CHECK().Adam Borowski2011-06-091-2/+2
|
* Don't say " in 'fixedvector.h' at line 72" in range check errors.Adam Borowski2011-03-301-0/+2
| | | | | | | This confuses people into thinking the error is there and that it's important information that will help us find the crash's cause. It'd be nice to know the real caller, but C++ doesn't give us that.
* Make file headers doxygen-friendly, drop useless fields.Adam Borowski2011-03-281-5/+4
| | | | | | | "File:" is shown in your editor's status bar. "Written by:" was used only for the first person who changed a file. We got git for that now, and pre-DCSS history is so woefully inaccurate it doesn't really matter.
* Mention the file and line no in die().Adam Borowski2011-01-111-1/+2
|
* A function die() that does the equivalent of ASSERT(!"foo") but always works.Adam Borowski2011-01-111-6/+2
| | | | | | | | It's what the old DEBUGSTR() did except for failing to be fatal in non-assert builds. Rationale: not aborting in known failure leads to further damage, and unlike actual (conditional) assertions, there's no gain in skipping checks.
* s/noreturn/NORETURN/ to unbreak Windows builds.Adam Borowski2011-01-071-1/+1
| | | | | It did resolve in __declspec(noreturn) which is used by the system headers as well...
* Mark AssertFailed() as noreturn.Adam Borowski2011-01-071-1/+1
|
* Add a quick and dirty debugging function for where dprf() is of no use.Adam Borowski2010-11-011-0/+3
| | | | | | | I use a similar include, but there's no reason to not have this properly as a part of the project -- as others can benefit from it as well. Something like this is needed for times such as debugging the save browser or the text display itself.
* Add ASSERT_SAVE macro for asserts where it should be safe to emergency-save ↵Darshan Shaligram2010-07-161-2/+12
| | | | | | | the game when the assert fails (doy). ASSERT_SAVE is currently used only for term size checks, but it can be used any place if it's known that the game is safe to save at that point.
* debug.h: simplify DEBUG/NDEBUG mutual exclusivity checkSteven Noonan2010-05-161-5/+1
| | | | Signed-off-by: Steven Noonan <steven@uplinklabs.net>
* Don't redefine ASSERTS if it's already defined.Adam Borowski2010-03-301-1/+1
|
* "make ASSERTS=y" to force assertion checks even in non-debug builds.Adam Borowski2010-03-301-0/+4
|
* Split up debug.ccMatthew Cline2009-11-061-93/+1
|
* Remove "called from:" comments.Vsevolod Kozlov2009-11-031-5/+0
| | | | | | These were of questionable use and freshness. Signed-off-by: Robert Vollmert <rvollmert@gmx.net>
* debug.h: add #ifdef for __MSL__ macroSteven Noonan2009-10-131-0/+2
| | | | | | | I still don't know what this macro is, but '#if __MSL__' doesn't make any sense without it defined, so we can ifdef it out. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
* platform detection: clean up abuse of '_MSC_VER' macroSteven Noonan2009-10-131-0/+2
| | | | | | | Use TARGET_COMPILER_VC instead, unless you need to find the Visual C++ version information. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
* fix 'DEBUG' macro usage consistencySteven Noonan2009-10-131-3/+3
| | | | | | | | | | | | | Sometimes we were doing #if DEBUG and others we were doing #ifdef DEBUG. If we mix both, we have problems: If the DEBUG macro isn't defined, the statement '#if DEBUG' doesn't really make sense logically, because 'DEBUG' has no value. And if we '#define DEBUG 0', then the '#ifdef DEBUG's become true statements. The easiest fix is to swap out the #ifs with #ifdefs. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
* Drop obsolete CVS last-committed headers ($Author$).Adam Borowski2009-10-061-2/+0
|
* * Also allow Maurice to steal the occasional spellbook or piece ofj-p-e-g2009-09-241-0/+1
| | | | | | | | | | | | | jewellery. * As per FR 1937144, leave a purple cloud if the player or a monster blinks or teleports away. For some reason this doesn't yet work correctly with scrolls of blinking, even though wizard blink (which uses the same function) does work. -- (from svn) Signed-off-by: Darshan Shaligram <dshaligram@users.sourceforge.net>
* Since fixed artefacts are going to be folded into unrandarts, and unrandartszelgadis2009-06-081-1/+1
| | | | | | | | | | | have already become almost identical to randarts, change "randart" to "artefact" everywhere except for things that deal exclusively with randarts. Artefact related files will be renamed later. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9921 c06c8d41-db1a-0410-9941-cceddc491573
* Run some sanity checks when loading ghosts. If anything seems fishyj-p-e-g2009-05-261-2/+0
| | | | | | | | | | | | | | | | | | | | * don't load the ghost(s) * print an error message mentioning the bones file * don't delete the bones file, so players can attach it to a bug report The last point means that the player (or admin, in the case of the servers) has to delete a buggy bones file themselves, but the benefits of making tracking down bugs easier should outweigh that inconvenience. Add a new wizmode command that calls debug_stethoscope even if the game is not compiled in debugging mode. Also, Stone Soup 0.5 bones files are now officially incompatible with 0.4. (The changes to the spell ids cause ghosts casting spells to crash the game.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9832 c06c8d41-db1a-0410-9941-cceddc491573
* Apply minor fixes patch [2727286] by kotk, minus the sqldbm.h type dolorous2009-04-171-1/+1
| | | | | | | changes (as I have no way of testing them on multiple platforms). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9615 c06c8d41-db1a-0410-9941-cceddc491573
* Mutations cleanup. Fixes [2641583]. Syncing between the various listsharanp2009-02-261-1/+1
| | | | | | | | | | | | | is no longer necessary. However, holes in the mutation numbering will cause a crash (random2(NUM_MUTATIONS) is used in a few places.) Breaks saves badly, sorry. I tested this somewhat but some bugs might have slipped in. Fixes a few other bugs (e.g. draconians not having any messages if their wings disappear) and highlights some unused code (e.g. no way to get the stinger mutation.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9234 c06c8d41-db1a-0410-9941-cceddc491573
* Clean up wizard commands.haranp2009-01-301-10/+17
| | | | | | | Fix a bug in wizard-spawning monsters (max was used instead of min.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8852 c06c8d41-db1a-0410-9941-cceddc491573
* Move the monster dumping code from state.cc to debug.cc, and dump to stderr tozelgadis2009-01-281-0/+5
| | | | | | | reduce the need to pass a file pointer all over the place. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8837 c06c8d41-db1a-0410-9941-cceddc491573
* Implemented crash data reporting, though it's only some stubs on Windows andzelgadis2009-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | DOS. On UNIX with USE_UNIX_SIGNALS defined, when any crash causing signal happens it will dump to a file the current crawl_state, anything caught by the items and monsters scans, and level building info if the crash happened during level generation. Also, if crawl is linked against the GNU C library (and the exectuable is in ELF format) it will dump the stack trace. The code attempts to automatically detect the presence of glibc, but that might not work on all systems. This should work on OS X, since there's an OS X man page for the glibc functions that get the stack trace. Don't know if it would work with MinGW. Actually getting function names for the stack trace requires the use of the "-rdynamic" linker option, which increases the size of the stripped executable by 27% (yikes!), but still prints the function names even when stripped. All of the function names in the stack trace are mangled C++ ones, but that shouldn't be too much of a problem. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8532 c06c8d41-db1a-0410-9941-cceddc491573
* Some wizard/debugging commands:zelgadis2008-12-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | * The &" command now shows the total experience value of all monster on the level. * &G now prevents dismissed monsters from dropping their original equipment, except for unrandarts and fixed arts. You can force the dismissed monsters to drop all of their non-summoned items by adding "keepitem" to the regexp string. * &R can now either change the random monster spawn rate for the current level, or immediately spawn a given number of random monsters. * &^D can be used to examine and alter player enchantments/durations. * The targeting command "S" can be used to turn a permanent monster into a summoned one. * The targeting command "~" can be used to polymorph a monster into one of a particular type. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7870 c06c8d41-db1a-0410-9941-cceddc491573
* Fixing compilation error.ennewalker2008-09-281-0/+1
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7057 c06c8d41-db1a-0410-9941-cceddc491573
* Implement the first part of FR 2055862: Make the database search alsoj-p-e-g2008-09-271-0/+6
| | | | | | | | | | | | output AC/EV and damage/accuracy/speed for armour and weapons, respectively. Also, you can now wish for specific fixed and randarts in wizard mode via the 'o' command. (I was getting annoyed at always having to create all of them whenever I wanted to play around with the Singing Sword.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7048 c06c8d41-db1a-0410-9941-cceddc491573
* Remove pre-Stone Soup change history from source files, and push it allj-p-e-g2008-09-141-7/+0
| | | | | | | | | | into a file crawlhistory.txt in docs/obsolete. I used a perl script to do this under the assumption that all these change logs used the same system following the keyword "Change History". git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6930 c06c8d41-db1a-0410-9941-cceddc491573
* Massive overhaul to move towards coord_def().haranp2008-07-301-1/+2
| | | | | | | | | | This might have introduced some bugs: I now get intermittent crashes on startup (this might have to do with the changes to special_room.) Sorry about that - committing before I need to do any more big conflict resolutions. Fixes coming later. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6732 c06c8d41-db1a-0410-9941-cceddc491573
* Implemented monster spell miscasts. Spell miscasting is now handledzelgadis2008-07-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | by the MiscastEffect class, which has helper methods to make most of the non-helper code agnostic with respect to whether the miscaster is the player or a monster. Mummy death curses now affect monsters, and Zot traps now directly affect friendly and good-neutral monsters. In wizard mode you can force the player or a monster to miscast by targeting it and pressing 'M'. Todo/issues/notes: * Clouds now have a killer_type in addition to a kill_category. * There aren't any divination monster miscast effects yet. * Many of the harmless message-only miscast effects are missing monster messages. * If a monster actually miscasts a spell (not getting a mummy death curse or setting off a Zot trap) and this kills both the monster and the player then the wrong monster will be listed in hiscore entry. Since monsters can't do true spell miscasts yet, this can wait. * There was old, non-functioning code making Zot traps heal, haste or turn invisible hostile monsters that triggered it. I fixed it and then commented it out. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6723 c06c8d41-db1a-0410-9941-cceddc491573
* [2026251] Fixed Elf:1 arrival sometimes being disconnected - the map used ↵dshaligram2008-07-241-0/+1
| | | | | | | | | | | ORIENT: south, but defined no exits. Fixed by applying the old floating vault exit behaviour to all vaults (apart from minivaults) so explicit @ exits are now optional. Also fixed maps being unable to place monsters on shallow water. Added debug_mons_scan to scan the mgrd for stranded monsters in fulldebug mode. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6659 c06c8d41-db1a-0410-9941-cceddc491573
* Large tiles-related changes. Platform-specific rendering removed and ↵ennewalker2008-07-151-0/+2
| | | | | | replaced with SDL/OpenGL. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6550 c06c8d41-db1a-0410-9941-cceddc491573