diff options
author | Daniel Schadt <kingdread@gmx.de> | 2018-04-27 13:22:29 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2018-04-27 13:22:29 +0200 |
commit | 1fe2fde9604db53e57996648d6d8627480391bab (patch) | |
tree | cdf77eaa1b45795b00b75ce5b1e1d52b0259be17 /src/statistics/boon.rs | |
parent | 8423b0c401a484314241391f2f78d129eef704c4 (diff) | |
download | evtclib-1fe2fde9604db53e57996648d6d8627480391bab.tar.gz evtclib-1fe2fde9604db53e57996648d6d8627480391bab.tar.bz2 evtclib-1fe2fde9604db53e57996648d6d8627480391bab.zip |
speed up boon calculation
This prevents calling BoonQueue::simulate a lot of times. Still needs
more profiling to make it even faster.
Diffstat (limited to 'src/statistics/boon.rs')
-rw-r--r-- | src/statistics/boon.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/statistics/boon.rs b/src/statistics/boon.rs index 912fdb6..059329f 100644 --- a/src/statistics/boon.rs +++ b/src/statistics/boon.rs @@ -158,6 +158,18 @@ impl BoonQueue { BoonType::Intensity => self.queue.last().cloned().unwrap_or(0), } } + + /// Calculate when the boon queue should be updated next. + /// + /// The next update always means that a stack runs out, even if it has no + /// visible effect. + /// + /// For each queue: `next_update() <= next_change()`. + /// + /// A return value of 0 means that there's no update awaiting. + pub fn next_update(&self) -> u64 { + self.queue.last().cloned().unwrap_or(0) + } } #[cfg(test)] |