OSDN Git Service

[Modify] 色々怪しいがビルドは通るところまで。 / Various suspicious but the build passes...
[deeangband/Deeangband-new.git] / Deeangband / HaveGameTime.cpp
1 /*!
2 * @file HaveGameTime.cpp
3 * @brief \83Q\81[\83\80\83^\83C\83\80\95Û\8e\9d\92\8a\8fÛ\83N\83\89\83X\82ð\92è\8b`\82·\82é
4 * @date 2014/06/11
5 * @author Deskull
6 * 2014 Sikabane Works.
7 */
8
9 #include "stdafx.h"
10 #include "HaveGameTime.h"
11
12 namespace Deeangband
13 {
14         HaveGameTime::HaveGameTime(void)
15         {
16                 WipeData();
17                 return;
18         }
19
20         HaveGameTime::~HaveGameTime(void)
21         {
22                 WipeData();
23                 return;
24         }
25
26         void HaveGameTime::WipeData(void)
27         {
28                 this->time = 0;
29                 this->turn = 0;
30         }
31
32         GAME_TIME HaveGameTime::GetGameTime(void)
33         {
34                 return this->time;
35         }
36
37         TURN HaveGameTime::GetTurn(void)
38         {
39                 return this->turn;
40         }
41
42         TURN HaveGameTime::GetWait(void)
43         {
44                 return this->wait;
45         }
46
47         void HaveGameTime::PlusWait(ACTION_WAIT plusWait, bool normalRand)
48         {
49                 double wait = normalRand ? Dice::CastNormalRand(plusWait, 5) : plusWait;
50                 if(plusWait <= 0) plusWait = 1;
51                 this->wait += plusWait;
52                 std::normal_distribution<> distWait(wait, GameConstants::ActionWaitDeviation);
53                 this->wait += (ACTION_WAIT)distWait(Dice::mt);
54         }
55
56         bool operator<(HaveGameTime left, HaveGameTime right)
57         {
58                 return left.GetWait() < right.GetWait();
59         }
60
61         bool operator>(HaveGameTime left, HaveGameTime right)
62         {
63                 return left.GetWait() > right.GetWait();
64         }
65
66 }