Adonthell
0.4
|
Class that keeps track of all available achievements, their permanent unlocked state and state in the current game. More...
#include <achievements.h>
Static Public Member Functions | |
static bool | create (const u_int8 &achievement, const u_int32 &bitmask) |
Create a new achievement with the given id and the bitmask that will eventually unlock it. More... | |
static void | update (const u_int8 &achievement, const u_int8 &bit) |
Set the nth bit of the given achievement to 1. More... | |
static int | num_achievements () |
Return the total number of available achievements. More... | |
static int | num_unlocked () |
Returns how many achievements have been permanently unlocked. More... | |
static bool | is_unlocked (const u_int32 &index) |
Checks whether the achievement at the given index is unlocked. More... | |
static u_int8 | achievement_id (const u_int32 &index) |
Get the achievement id at the given index. More... | |
static void | py_signal_connect (PyObject *pyfunc, PyObject *args=NULL) |
Allow to connect a python callback to get notified when a new achievement was unlocked. More... | |
static bool | get_state (igzstream &file) |
Load achievement data from stream. More... | |
static void | put_state (ogzstream &file) |
Save achievement data to stream. More... | |
static void | init () |
Initialize achievements by loading all available achievements and their permanent unlocked status. More... | |
static void | make_persistent () |
Write permanent unlock status of available achievements. More... | |
Class that keeps track of all available achievements, their permanent unlocked state and state in the current game.
Definition at line 95 of file achievements.h.
Create a new achievement with the given id and the bitmask that will eventually unlock it.
If an achievement with the given id already exists, it will be updated.
Note that ids 0 and 255 are reserved.
achievement | the unique achievement id |
bitmask | the value that will unlock the achievement |
Definition at line 43 of file achievements.cc.
Set the nth bit of the given achievement to 1.
If the current value of the achievement afterwards matches the bitmask given when creating the achievement, the achievement will be unlocked permanently (only once).
achievement | the unique achievement id |
bit | the index of the bit to set to 1. |
Definition at line 61 of file achievements.cc.
|
inlinestatic |
Return the total number of available achievements.
Definition at line 127 of file achievements.h.
|
static |
Returns how many achievements have been permanently unlocked.
Definition at line 84 of file achievements.cc.
|
static |
Checks whether the achievement at the given index is unlocked.
index | a number between 0 and num_achievements |
Definition at line 97 of file achievements.cc.
Get the achievement id at the given index.
index | a number between 0 and num_achievements |
Definition at line 106 of file achievements.cc.
|
static |
Allow to connect a python callback to get notified when a new achievement was unlocked.
Callback will receive the achievement id along with any additional arguments given when connecting the callback
pyfunc | the callback to register |
args | the optional arguments to use when executing the callback |
Definition at line 267 of file achievements.cc.
|
static |
Load achievement data from stream.
file | the stream to read data from. |
Definition at line 115 of file achievements.cc.
|
static |
Save achievement data to stream.
file | the stream to write data to. |
Definition at line 151 of file achievements.cc.
|
static |
Initialize achievements by loading all available achievements and their permanent unlocked status.
Definition at line 166 of file achievements.cc.
|
static |
Write permanent unlock status of available achievements.
Definition at line 231 of file achievements.cc.