Adonthell  0.4
achievement_data Class Reference

Data for a single achievement. More...

#include <achievements.h>

Public Member Functions

 achievement_data (const u_int8 &id, const u_int32 &expected)
 Create a new achievement with the given id and the bitmask that will eventually unlock it. More...
 
u_int8 id () const
 Get the unique id of the achievement. More...
 
bool update (const u_int8 &bit)
 Set the nth bit of the given achievement to 1. More...
 
bool is_unlocked () const
 Check whether the achievement is permanently unlocked. More...
 

Friends

class achievements
 

Detailed Description

Data for a single achievement.

This contains of a unique id, the state that will unlock the achievement, whether the achievement has already been unlocked and the state of the achievement in the current game.

Definition at line 43 of file achievements.h.

Constructor & Destructor Documentation

§ achievement_data()

achievement_data::achievement_data ( const u_int8 id,
const u_int32 expected 
)

Create a new achievement with the given id and the bitmask that will eventually unlock it.

Parameters
idthe unique achievement id
expectedthe value that will unlock the achievement

Definition at line 277 of file achievements.cc.

Member Function Documentation

§ id()

u_int8 achievement_data::id ( ) const
inline

Get the unique id of the achievement.

Returns
the unique id of the achievement

Definition at line 60 of file achievements.h.

§ update()

bool achievement_data::update ( const u_int8 bit)

Set the nth bit of the given achievement to 1.

Parameters
bitthe index of the bit to set to 1
Returns
true if the new achievement value matches the expected bitmask to permanently unlock the achievement. False otherwise.

Definition at line 286 of file achievements.cc.

§ is_unlocked()

bool achievement_data::is_unlocked ( ) const
inline

Check whether the achievement is permanently unlocked.

Returns
true if the achievement is unlocked, false otherwise.

Definition at line 74 of file achievements.h.


The documentation for this class was generated from the following files: