Debian Codegraph @

src/event.h

raw
1 // Copyright © 2001-2002 Rob Kaper <[email protected]>,
2 // 2001 Erik Bourget <[email protected]>
3 // 2010-2015 Sylvain Rochet <[email protected]>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // version 2 as published by the Free Software Foundation.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; see the file COPYING. If not, see
16 // <http://www.gnu.org/licenses/>.
17 #ifndef MONOP_EVENT_H
18 #define MONOP_EVENT_H
19
20 #include <time.h>
21 #include <sys/time.h>
22
23 #include "gameobject.h"
24
25 class Game;
26
27 class Event : public GameObject
28 {
29 public:
30 enum EventType { Metaserver=0, TokenMovementTimeout, UserDecision, AuctionTimeout, PlayerTimeout, SocketTimeout };
31
32 Event(int id, EventType type, Game *game = 0);
33
34 void setLaunchTime(int ms);
35 void setFrequency(int ms) { m_frequency = ms; }
36 void setType(unsigned int type) { m_type = type; }
37 void setObject(GameObject *object) { m_object = object; }
38
39 struct timeval *launchTime() { return &m_launchTime; }
40 int frequency() { return m_frequency; }
41 unsigned int type() { return m_type; }
42 GameObject *object() { return m_object; }
43
44 private:
45 struct timeval m_launchTime;
46 int m_frequency;
47 unsigned int m_type;
48 GameObject *m_object;
49 };
50
51 #endif // MONOP_EVENT_H