Classes | Functions

rand_rng Namespace Reference

Classes

struct  set_random_generator
class  rng
class  simple_rng

Functions

void set_seed (int seed)
 Set the random seed for the current random number generator, sets the seed as valid nd calls the new seed callback if set.
void invalidate_seed ()
 Mark the RNG seed as invalid.
bool has_valid_seed ()
 Function to check whether the RNG has been updated with a new seed since the las invalidate_seed() call.
int get_last_seed ()
 Get the last seed the RNG was seeded with in set_seed.
void set_new_seed_callback (boost::function< void(int)> f)
 Set the callback for a function that will be called on subsequent set_seed calls.
bool has_new_seed_callback ()
void clear_new_seed_callback ()
 Clear the new seed callback.

Function Documentation

void rand_rng::clear_new_seed_callback (  ) 

Clear the new seed callback.

Referenced by playmp_controller::finish_side_turn(), events::mouse_handler::perform_attack(), and events::mouse_handler::~mouse_handler().

Here is the caller graph for this function:

int rand_rng::get_last_seed (  ) 

Get the last seed the RNG was seeded with in set_seed.

Referenced by events::mouse_handler::attack_enemy_().

Here is the caller graph for this function:

bool rand_rng::has_new_seed_callback (  ) 
Returns:
true if the seed callback is not NULL

Referenced by playmp_controller::play_human_turn().

Here is the caller graph for this function:

bool rand_rng::has_valid_seed (  ) 

Function to check whether the RNG has been updated with a new seed since the las invalidate_seed() call.

Referenced by events::mouse_handler::attack_enemy_().

Here is the caller graph for this function:

void rand_rng::invalidate_seed (  ) 

Mark the RNG seed as invalid.

Referenced by events::mouse_handler::attack_enemy_().

Here is the caller graph for this function:

void rand_rng::set_new_seed_callback ( boost::function< void(int)>  f  ) 

Set the callback for a function that will be called on subsequent set_seed calls.

Todo:
needs a reliable way of clearing the callback when things don't go as normal (e.g. player quit the game while the callback is set)

Referenced by events::mouse_handler::attack_enemy_().

Here is the caller graph for this function:

void rand_rng::set_seed ( int  seed  ) 

Set the random seed for the current random number generator, sets the seed as valid nd calls the new seed callback if set.

Referenced by do_replay_handle(), and turn_info::process_network_data().

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:25:03 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs