D'angband  0.0.0
Deeangband
 全て クラス 名前空間 ファイル 関数 変数 型定義 列挙型 列挙値 フレンド マクロ定義 ページ
Dice.h
[詳解]
1 
9 #pragma once
10 
11 #include "Deeangband.h"
12 
13 namespace Deeangband
14 {
15 
25  class Dice
26  {
27  private:
28 
29  int num;
30  int side;
31 
33 
40  template<class Archive> void serialize(Archive &archive, const unsigned int version)
41  {
42  if(version >= 0)
43  {
44  archive & boost::serialization::make_nvp("Num", num);
45  archive & boost::serialization::make_nvp("Side", side);
46  }
47  }
48 
49  template<class Archive> friend void save_construct_data(Archive & archive, const Dice *ptr, const unsigned int version)
50  {
51  archive & boost::serialization::make_nvp("num", ptr->GetNum());
52  archive & boost::serialization::make_nvp("side", ptr->GetSide());
53  }
54 
55  template<class Archive> friend void load_construct_data(Archive & archive, Dice *ptr, const unsigned int version)
56  {
57  int n, s;
58  archive & boost::serialization::make_nvp("num", n);
59  archive & boost::serialization::make_nvp("side", s);
60  ::new(ptr) Dice(num, side);
61  }
62 
63  public:
64 
65  static std::mt19937 Dice::mt;
66 
70  Dice::Dice(void);
71 
77  Dice::Dice(int num, int side);
78 
82  Dice::‾Dice(void);
83 
88  void Dice::Set(int num, int side);
89 
94  static void Dice::Initialize(void);
95 
100  int Dice::GetNum(void);
101 
106  int Dice::GetSide(void);
107 
112  int Dice::Cast(void);
113 
120  static int Dice::Cast(int num, int side);
121 
126  int Dice::MaxCast(void);
127 
134  static int Dice::MaxCast(int num, int side);
135 
141  static int Dice::Rand0(int max);
142 
148  static int Dice::Rand1(int max);
149 
155  static bool Dice::Saving(int diff);
156 
157  };
158 
159 }
160 
friend void load_construct_data(Archive &archive, Dice *ptr, const unsigned int version)
Definition: Dice.h:55
int side
ダイスの面数
Definition: Dice.h:30
friend void save_construct_data(Archive &archive, const Dice *ptr, const unsigned int version)
Definition: Dice.h:49
ゲーム中のダイス処理
Definition: Dice.h:25
void serialize(Archive &archive, const unsigned int version)
クラスのシリアライズを設定する
Definition: Dice.h:40
int num
ダイスの数
Definition: Dice.h:29
BOOST_CLASS_VERSION(Deeangband::Dice, 10)
friend class boost::serialization::access
Definition: Dice.h:32