Roguelike
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
timeelapsed.h
Go to the documentation of this file.
1 #ifndef ROGUELIKE_ACTION_TIME_TIMEELAPSED_H_
2 #define ROGUELIKE_ACTION_TIME_TIMEELAPSED_H_
3 
4 // Inheritance
5 #include <ugdk/action/task.h>
6 
7 // External Dependencies
8 #include <set>
9 
10 // Internal Dependencies
11 // (none)
12 
13 // Forward Declarations
14 #include "game/base.h"
15 
16 namespace game {
17 namespace action {
18 namespace time {
19 
20 struct TimeElapsed {
21  bool elapsed;
22  double time;
23 
24  TimeElapsed(bool elapsed) : elapsed(elapsed), time( 0.0) {}
25  TimeElapsed(double time) : elapsed( true ), time(time) {}
26 
27  operator bool() const { return elapsed; }
28  operator double() const { return time; }
29 
31  if( (bool)rhs == false ) return *this;
32  this->elapsed = true;
33  this->time += (double)rhs;
34  return *this;
35  }
36 };
37 
38 } // namespace time
39 } // namespace action
40 } // namespace game
41 
42 #endif /* ROGUELIKE_ACTION_TIME_TIMEELAPSED_H_ */
bool elapsed
Definition: timeelapsed.h:21
Definition: aim.cc:15
TimeElapsed & operator+=(const TimeElapsed &rhs)
Definition: timeelapsed.h:30
TimeElapsed(bool elapsed)
Definition: timeelapsed.h:24
Definition: timeelapsed.h:20
double time
Definition: timeelapsed.h:22
TimeElapsed(double time)
Definition: timeelapsed.h:25