summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/coordit.cc
Commit message (Collapse)AuthorAgeFilesLines
* Fix another goto (in coordit.cc)reaver2014-04-071-48/+50
|
* Don't crash when sanctuary shrinks near the map edgeNeil Moore2014-02-231-1/+12
| | | | | | | | | | See for example: http://crawl.lantea.net/crawl/morgue/letownia/crash-letownia-20140224-004021.txt Introduced by 0.14-a0-622-g0c137b5, which replaced radius_iterator with C_SQUARE by rectangle_iterator. Unfortunately, the latter did not clip the iterator to the map. Add a flag to do so: false by default because iterated rectangles are not always in map coordinates.
* Add spaces after switch and catch keywords.Neil Moore2013-12-301-3/+3
|
* 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.
* Allow radius_iterator to iterate over the top/left map edge (#7809)Neil Moore2013-12-021-3/+3
| | | | | | | Valid map coordinates fall in the range [0, GXM-1] x [0, GYM-1], but we were excluding x and y coordinates of zero from the iterator check. That caused these edges of the map not to be drawn, and probably other problems.
* Drop the now unused circle_iterator.Adam Borowski2013-12-021-33/+1
| | | | It turns out it was only an implementation detail of radius_iterator.
* Rewrite the radius_iterator.Adam Borowski2013-12-021-40/+83
| | | | | | | | | | No rectangle_iterator, no circle_iterator nor circle_def, no los_glob with an internal radius_iterator then los_base; not even a single multiplication inside a loop (although the last part is negligibly small compared to a typical user). And lookie at this such simple code. It is simple, without nothing naughty behind these macros, right? Right???
* Check that nothing uses a radius_iterator centered outside the map.Adam Borowski2013-11-291-1/+4
| | | | If I'm wrong, please revert.
* Implement adjacent_iterator on its own, rather than via radius_iterator.Adam Borowski2013-11-251-0/+35
| | | | | | | | | | This hardly speeds up things, which I did not know as profile runs did not help to tell these two apart and it turns out adjacent_iterator is not that prominent... but hey, a 0.1% speedup for two pages of code might still be better committed than not. This speedup might disappear when I get around to the actual rewrite of radius_iterator, though.
* Drop unnecessary parentheses from return statements.Adam Borowski2013-11-151-1/+1
|
* Hush a warning.Adam Borowski2013-11-061-1/+1
|
* Hush a warning on 32 bit.Adam Borowski2013-11-051-2/+2
|
* Regression tests for adjacent_iterator.Adam Borowski2013-11-051-0/+38
|
* Regression tests for distance_iterator.Adam Borowski2013-11-051-0/+25
|
* Regression tests for radius_iterator (w/o LOS checks).Adam Borowski2013-11-051-0/+44
|
* Get rid of a strange accessor.Adam Borowski2013-11-051-2/+1
|
* Less los_def usage.Adam Borowski2013-11-051-0/+1
|
* Get rid of the radius_iterator "legacy" constructor.Adam Borowski2013-11-051-17/+1
| | | | | | | | | | It was really weird: working on a square, but in almost all cases restricting it to your view (a circle). Note this is _your_ view rather than from the iterator's center -- which hasn't been used once in the obvious interesting way. As usual, this commit fixes a load of "act through glass" bugs, ando/or using los modes that don't make sense in the context.
* Remove radius_iterator(coord, r, c_type, los_base).Adam Borowski2013-11-051-2/+1
|
* Remove radius_iterator(los_base).Adam Borowski2013-11-051-10/+0
|
* Remove get_los().Adam Borowski2013-11-051-1/+6
|
* Update the whole arena.Adam Borowski2013-11-051-0/+9
| | | | It was the only user of non-standard get_los().
* Implement a prototype for a new version of radius_iterator.Adam Borowski2013-11-051-0/+26
| | | | | | | | | | | | | | During conversion, use the old code. My target will have only two types of functionality: * iterating over a circle of a given radius * as above, with a LOS check towards the center The current radius_iterator/circle_def/los_base tangle either takes a majority of CPU time or at least a sizeable chunk in profile runs, due to a bad case of OOP abuse in tight loops. This badly needs a rewrite. The ability to pass it a square or someone else's los can be done using a different iterator or checking los manually later, respectively.
* Formatting fixes.Adam Borowski2013-05-091-10/+10
|
* Added dgn_connect_adjacent_rooms LUA functioninfiniplex2013-04-261-1/+82
|
* Eliminate LOS checks from one of radius_iterators.Adam Borowski2012-11-181-3/+2
|
* Drop a lot of unnecessary braces.Adam Borowski2012-10-241-2/+0
| | | | | The perl one-liner I use for this had a bug where it didn't match "else" at the end of a line (ie, most of the time).
* Drop one of redundant definitions of sgn().Adam Borowski2012-09-101-5/+0
|
* Use std namespace.Raphael Langella2012-08-261-5/+5
| | | | | | | | | | | | | 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.
* Some more return deparenthesization.Adam Borowski2012-07-051-1/+1
|
* Drop parentheses around scalar values in "return".Adam Borowski2012-07-051-6/+6
|
* Don't let iterator++ return a value.Adam Borowski2011-05-241-10/+4
| | | | This is costly (the whole iterator is copied every time!) and we never use this.
* Make file headers doxygen-friendly, drop useless fields.Adam Borowski2011-03-281-4/+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.
* The Tornado spell, first stab.Adam Borowski2010-11-121-4/+2
| | | | | | | | There's no separate cloud type yet (I want greyish but not blocking LOS ones), and moving monsters/items is not implemented yet. Pushing so people can suggest an improvement to visual effects which suck currently.
* Fix max_radius in distance_iterator, rename it again, allow querying current ↵Adam Borowski2010-11-091-13/+18
| | | | radius.
* s/spiral_iterator/equidistant_iterator/g (dpeg)Adam Borowski2010-11-041-9/+9
|
* Reduce a series of redundant comparisons.Adam Borowski2010-11-041-8/+14
|
* Give the spiral_iterator an argument, max_radius.Adam Borowski2010-10-311-4/+8
|
* A "spiral_iterator" that produces coords around a starting point.Adam Borowski2010-10-311-0/+111
| | | | | It's not an actual spiral; rather, squares at equal distances are returned in either a random or arbitrary order.
* Massive spacing fixes: "( spaces after parentheses )".Adam Borowski2010-10-151-4/+4
| | | | | | I did review it manually to find places where they made sense (like some tables), but for a massive sed job like this there might be places that I missed.
* Update actor::get_los to use global LOS.Robert Vollmert2010-03-221-4/+4
| | | | | | | | | | | | This is all not very nice. los_base is now an abstract base class for both los_def and los_glob (global LOS-backed los_def variant), and interators now take a *los_base. actor::update_los is gone. Arena LOS is quite probably broken again at the moment.
* Nuke a whole lot of old-style casts, and remove some casts completelyHaran Pilpel2010-01-291-1/+1
| | | | | (you don't need to cast an X* to a void* and you don't need to cast arguments to math.h functions such as sqrt.)
* Trim unnecessary #includes.Adam Borowski2010-01-131-1/+0
|
* Reimplement radius_iterator on the basis of circle_def.Robert Vollmert2009-11-131-50/+77
|
* Remove a few obsolete includes.Robert Vollmert2009-11-101-1/+0
| | | | Also add a few previously indirect includes.
* Move see_cell_no_trans into player.Robert Vollmert2009-11-081-4/+4
| | | | Also collect actor/player LOS code in actor-los.cc.
* Remove an unnecessary header env.h include.Robert Vollmert2009-11-081-0/+1
|
* Replace global see_cell by observe_cell and disambiguate old uses.Robert Vollmert2009-11-061-1/+1
| | | | | | | Calls to plain see_cell(pos) were replaced with either observe_cell(pos) or you.see_cell(pos). observe_cell where related to drawing the interface and messaging, you.see_cell for game mechanics, and one or the other in less clear cases (targetting, say).
* Remove bidirectionality from radius_iterator.Robert Vollmert2009-11-031-33/+0
| | | | | This wasn't used anywhere and could easily be restored if required.
* Splitting up stuff.cc.Robert Vollmert2009-10-301-0/+189
New: colour.cc, coord.cc, coordit.cc, random.cc, rng.cc.