summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/losglobal.cc
Commit message (Collapse)AuthorAgeFilesLines
* Plug one case that relied on the exact order of radius_iterator.Adam Borowski2013-12-021-11/+20
| | | | | | | This plugging is quick and dirty, we can optimize it later. This part of the code is performance sensitive. Even this plugging is much faster than the old radius_iterator though: it did the full square, did double squaring for every position in it, etc.
* Drop unnecessary parentheses from return statements.Adam Borowski2013-11-151-1/+1
|
* Alias LOS_ARENA to LOS_NONE.Adam Borowski2012-11-181-1/+1
| | | | | Most iterators that allow LOS checks typically have none, it'd be weird to refer to that as "arena".
* Use std namespace.Raphael Langella2012-08-261-4/+4
| | | | | | | | | | | | | I had to rename distance() (in coord.h) to distance2() because it conflicts with the STL function to compare 2 iterators. Not a bad change given how it returns the square of the distance anyway. I also had to rename the message global variable (in message.cc) to buffer. I tried to fix and improve the coding style has much as I could, but I probably missed a few given how huge and tedious it is. I also didn't touch crawl-gdb.py, and the stuff in prebuilt, rltiles/tool and util/levcomp.*, because I have no clue about those.
* Drop a bunch of parentheses from return statements.Adam Borowski2012-08-081-2/+2
| | | | | This is incomplete, partially because of me getting bored, partially because of doubts about the point of leaving simple addition/etc in parentheses.
* Drop parentheses around scalar values in "return".Adam Borowski2012-07-051-4/+4
|
* Remove #define LOS_MAX_RADIUSAdam Borowski2012-06-241-1/+1
| | | | | | | Having both it and LOS_RADIUS is misleading, especially as they're arbitrarily used. This distinction doesn't make sense anyway, as any LOS changes need to be done at runtime, only the max matters during compilation.
* Remove a good deal of header inclusion.Adam Borowski2012-05-231-1/+0
| | | | | | | | | These accumulate but never get removed; no wonder compilation times keep rising. The includes.sh script has lots of false negatives (and positives...), and can't check .h files which cause the biggest slowdown, it'd be nice to run multidelta on those somehow.
* Disambiguate the LOS_SOLID confusion.Adam Borowski2011-12-111-0/+7
| | | | | | | | | | | Its name suggests it's about line of effect, while in fact it's both effect and sight. Thus, I've split its uses into LOS_SOLID and LOS_SOLID_SEE -- the former is what LOS_SOLID was usually understood to mean, the latter is what it actually was (being targettable with an arrow/beam). The difference is: LOS_SOLID_SEE obeys clouds. The name of the latter is abysmal -- if you have a better idea, please sed.
* Consistently use a space after flow control statements.Adam Borowski2011-12-021-1/+1
|
* Straighten the two cell_see_cell() confusion.Adam Borowski2011-09-051-0/+7
| | | | | | | | | | | | There were two functions: one used no cache and ignored clouds, another one has a cache and accepts different LOS models. I added a new cached model: LOS_SOLID (using opc_solid). All but one uses of opc_fullyopaque (two-argument cell_see_cell()) were bugs to me, so they were moved to a different model. This makes Refrigeration not work through glass walls anymore (it still works though clouds).
* More than double the speed of LOS calculations.Adam Borowski2011-08-231-17/+32
| | | | | | There are two speed-ups: * no need to check rays in the bounding square beyond a circle * don't calculate both LOS_DEFAULT and LOS_NO_TRANS every time
* Optimize invalidate_los_around().Adam Borowski2011-05-281-6/+9
| | | | | | | | | | It's the biggest CPU hog on the sprint rest test, especially its unwoken version. Changes: 1. no use of iterators (the other biggest hog, which one deserves the title is unclear due to them being entangled) 2. a π/4 optimization: no need to clear corners of a rectangle
* Rename chars used as numbers to int8_t/uint8_t. Fix some other type usage.Adam Borowski2010-07-301-1/+1
| | | | | | | | | | This should help against the signed char problems, and is good for code readability. Now, if you have a char, it's either an untyped in-memory byte, or a symbol inside a string. Small numbers are instead [u]int8_t, ints, an enum type, or, in so many cases, bools. I didn't touch any of the tiles code, as it's currently broken and I don't want to risk making it unbroken harder.
* Declare globallos static, telling the compiler there are no nasty aliases.Adam Borowski2010-07-061-3/+3
| | | | Surprisingly, this speeds things up by nearly 1%.
* Revert "Invalidate LOS entirely at start of manage_clouds for busy maps."Robert Vollmert2010-07-061-8/+0
| | | | | | This reverts commit 46bb005ece25b6dc17a2fa46bd2573687334e5af. Too expensive with increase LOS calculations once monsters wake up.
* Invalidate LOS entirely at start of manage_clouds for busy maps.Robert Vollmert2010-07-051-0/+8
| | | | | | | | | | | | | | | | Keep a count of how many LOS-affecting clouds change last turn, and invalidate LOS at the start of manage_clouds if there were more than 10 for now. Additionally, keep track of whether LOS has been completely invalidated, and skip all LOS invalidations as long as this is the case. This should be a safe change in terms of functionality, and speed things up quite a bit provided that the cloud management code doesn't cause LOS computations. (Forest fires currently check player LOS for messaging, and gloom dissipation checks halos, so if these are around, improvements may be limited.)
* Invalidate LOS using memset instead of FixedArray::init.Robert Vollmert2010-07-011-7/+8
| | | | | This speeds up Sprint resting quite a bit for me. It's quite likely that more could be done.
* Yet another version of arena LOS hacks.Robert Vollmert2010-03-221-0/+3
|
* losglobal.cc: A start at tracking LOS globally.Robert Vollmert2010-03-221-0/+89