Helper similar to std::unique_lock for detecting when calculations such as abilities have entered infinite recursion. More...
Public Member Functions | |
recursion_guard () | |
Construct an empty instance, only useful for extending the lifetime of a recursion_guard returned from unit.update_variables_recursion() by std::moving it to an instance declared in a larger scope. More... | |
operator bool () const | |
Returns true if a level of recursion was available at the time when update_variables_recursion() created this object. More... | |
recursion_guard (recursion_guard &&other) | |
recursion_guard (const recursion_guard &other)=delete | |
recursion_guard & | operator= (recursion_guard &&) |
recursion_guard & | operator= (const recursion_guard &)=delete |
~recursion_guard () | |
Private Member Functions | |
recursion_guard (const unit &u, const config &ability) | |
Only expected to be called in update_variables_recursion(), which handles some of the checks. More... | |
Private Attributes | |
std::shared_ptr< const unit > | parent |
Friends | |
class | unit |
Helper similar to std::unique_lock for detecting when calculations such as abilities have entered infinite recursion.
This assumes that there's only a single thread accessing the unit, it's a lightweight increment/decrement counter rather than a mutex.