summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/random-var.cc
Commit message (Collapse)AuthorAgeFilesLines
* Avoid a random_var crash (#8698)Neil Moore2014-06-191-2/+34
| | | | | If the sum of the weights of a random_var goes over INT_MAX, rescale them rather than leaving the total as a negative number.
* 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.
* Refactor ASSERT(a && b) againBrendan Hickey2013-11-151-1/+2
| | | | | | This commit converts ASSERT(a && b) to ASSERT(a); ASSERT(b); Assertions of the form !(a && b) are left intact, since there isn't an obvious readability gain over (!a || !b).
* More formatting fixes for return (...);Neil Moore2013-11-151-1/+1
|
* Drop unnecessary parentheses from return statements.Adam Borowski2013-11-151-1/+1
|
* Formatting/brace/trivial returns fixes.Adam Borowski2013-09-031-1/+1
|
* Refactor ASSERT(a && b) -> ASSERT(a); ASSERT(b);Brendan Hickey2013-04-281-1/+2
| | | | | | | Convert conjunctive assertions into separate assertions. This ought to be correctness preserving. I ran the stress tests and didn't notice anything unusual. While I have confidence in it, if you are the slightest bit suspicious of this, please roll it back. Found instances with `ASSERT(\([^(|]*\) && \([^)|]*\))` Manually inspected each instance.
* Fix bat form unarmed delay display being randomised.Raphael Langella2013-02-041-0/+12
|
* Use std namespace.Raphael Langella2012-08-261-15/+15
| | | | | | | | | | | | | 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
|
* Remove parentheses around return (simple_function_call).Adam Borowski2012-07-051-10/+10
| | | | For way too paranoid and underinclusive values of "simple".
* Drop parentheses around scalar values in "return".Adam Borowski2012-07-051-7/+7
|
* Implement div_rand_round() for random_var, use it for combat delay.Adam Borowski2011-09-191-0/+17
| | | | | | Two constants divide to the same value no matter the scale, using random_var was just a waste of CPU. What we want is to allow partial values a percentage of the time.
* Fix random_var division by a number other than 2.Adam Borowski2011-09-191-1/+1
|
* Integer random variables.Robert Vollmert2010-04-151-0/+197
Using these to get at random values is quite inefficient, but it allows computing expected values for complicated formulas like those used in fight.cc.