The Battle for Wesnoth  1.15.1+dev
random_deterministic.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2018 by David White <dave@whitevine.net>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include "random.hpp"
18 #include "mt_rng.hpp"
19 
20 namespace randomness
21 {
22  /**
23  This rng is used when the normal synced rng is not available
24  this is currently only he case at the very start of the scenario (random generation of starting units traits).
25 
26  or during the "Deterministic SP mode"
27  */
29  {
30  public:
32  virtual ~rng_deterministic();
33 
34  protected:
35  virtual uint32_t next_random_impl();
36  private:
38  };
39 
40  /**
41  RAII class to use rng_deterministic in the current scope.
42  */
44  {
45  public:
48  private :
49  rng* old_rng_;
51  };
52 }
This rng is used when the normal synced rng is not available this is currently only he case at the ve...
RAII class to use rng_deterministic in the current scope.
this class does not give synced random results derived classes might do.
Definition: random.hpp:27