mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-12 18:20:57 +00:00
Utils/Rate Counter: return true on first invocation
This commit is contained in:
parent
3299eea7c6
commit
430584c22b
|
@ -21,8 +21,8 @@ class rate_counter
|
|||
public:
|
||||
explicit rate_counter(unsigned rate) : rate_(rate) {}
|
||||
|
||||
/** Increments the counter by one and checks whether it is now a multiple of the chosen rate. */
|
||||
bool poll() { return (++counter_ % rate_) == 0; }
|
||||
/** Checks whether the counter is now a multiple of the chosen rate, then increments it by one. */
|
||||
bool poll() { return (counter_++ % rate_) == 0; }
|
||||
|
||||
private:
|
||||
unsigned counter_ = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user