HyperRogue  11.3d
game/visualization engine based on non-Euclidean geometry
Public Member Functions | Public Attributes | List of all members
hr::changes_t Struct Reference

Public Member Functions

void init (bool ch)
 
void commit ()
 
void rollback (int pos=0)
 
void ccell (cell *c)
 
template<class T >
void value_set (T &what, T value)
 
template<class T >
void value_add (T &what, T step)
 
template<class T >
void value_inc (T &what)
 
template<class T >
void value_keep (T &what)
 
template<class T , class U , class V >
void map_value (map< T, U > &vmap, V &key)
 
void at_commit (reaction_t act)
 
void at_rollback (reaction_t act)
 

Public Attributes

vector< reaction_t > rollbacks
 
vector< reaction_t > commits
 
bool on
 
bool checking
 

Detailed Description

A structure to keep track of changes made during the player movement. This is a singleton object, hr::changes.

Member Function Documentation

◆ init()

void hr::changes_t::init ( bool  ch)
inline

Start keeping track of changes, perform changes. init(false) if you intend to commit the changes (if successful), or init(true) if you just want to check whether the move would be successful, without performing it if it is.

◆ commit()

void hr::changes_t::commit ( )
inline

Commit the changes. Should only be called after init(false).

◆ rollback()

void hr::changes_t::rollback ( int  pos = 0)
inline

Rollback the changes. Should only be called after init(true).

◆ ccell()

void hr::changes_t::ccell ( cell c)
inline

The changes to cell c will be rolled back when rollback() is called.

◆ value_set()

template<class T >
void hr::changes_t::value_set ( T &  what,
value 
)
inline

Set the value of what to value. This change will be rolled back if necessary.

◆ value_add()

template<class T >
void hr::changes_t::value_add ( T &  what,
step 
)
inline

Add step to the value of what. This change will be rolled back if necessary.

◆ value_keep()

template<class T >
void hr::changes_t::value_keep ( T &  what)
inline

Any change to the value of what will be rolled back if necessary.

◆ map_value()

template<class T , class U , class V >
void hr::changes_t::map_value ( map< T, U > &  vmap,
V &  key 
)
inline

Like value_keep but for maps.

◆ at_commit()

void hr::changes_t::at_commit ( reaction_t  act)
inline

Perform the given action on commit.

See also
LATE

◆ at_rollback()

void hr::changes_t::at_rollback ( reaction_t  act)
inline

Perform the given action on rollback.


The documentation for this struct was generated from the following file: