Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Public Attributes | Friends | List of all members
core::system::Clock::Time Struct Reference

Simple struct representing a point in time. More...

#include <Clock.hpp>

Public Member Functions

 Time ()
 Construct a new Time at noon of day 0. More...
 
 Time (unsigned int hour, unsigned int minute, unsigned int day=0)
 Creates a new time. More...
 
void addMinutes (unsigned int minutes)
 Adds the amount of minutes to this time. Wraps hours and days. More...
 
void addHours (unsigned int hours)
 Adds the number of hours to this time. Wraps days. More...
 
bool operator== (const Time &right) const
 Checks if two times are the same. Compares days as well unless either day is 0. More...
 
bool operator< (const Time &right) const
 Checks to see if a given time appears later than the current time. Counts days unless either day is 0. More...
 
bool operator> (const Time &right) const
 Checks to see if a given time appears earlier than the current time. Counts days unless either day is 0. More...
 

Public Attributes

unsigned int day
 Number of days elapsed in game since beginning. Starts at 1. More...
 
unsigned int hour
 Current hour of the day, in range [0, 23]. More...
 
unsigned int minute
 Current minute of the hour. In range [0, 59]. More...
 

Friends

std::ostream & operator<< (std::ostream &stream, const Time &time)
 

Detailed Description

Simple struct representing a point in time.

Definition at line 32 of file Clock.hpp.

Constructor & Destructor Documentation

◆ Time() [1/2]

core::system::Clock::Time::Time ( )

Construct a new Time at noon of day 0.

Definition at line 34 of file Clock.cpp.

◆ Time() [2/2]

core::system::Clock::Time::Time ( unsigned int  hour,
unsigned int  minute,
unsigned int  day = 0 
)

Creates a new time.

Parameters
hourThe hour of the time
minuteThe minute of the time
dayThe day of the time. Set to 0 to ignore when comparing times

Definition at line 39 of file Clock.cpp.

Member Function Documentation

◆ addHours()

void core::system::Clock::Time::addHours ( unsigned int  hours)

Adds the number of hours to this time. Wraps days.

Parameters
hoursThe number of hours to add

Definition at line 51 of file Clock.cpp.

◆ addMinutes()

void core::system::Clock::Time::addMinutes ( unsigned int  minutes)

Adds the amount of minutes to this time. Wraps hours and days.

Parameters
minutesThe number of minutes to add

Definition at line 44 of file Clock.cpp.

◆ operator<()

bool core::system::Clock::Time::operator< ( const Time right) const

Checks to see if a given time appears later than the current time. Counts days unless either day is 0.

Parameters
rightThe time to check against
Returns
True if right is later than this time

Definition at line 63 of file Clock.cpp.

◆ operator==()

bool core::system::Clock::Time::operator== ( const Time right) const

Checks if two times are the same. Compares days as well unless either day is 0.

Parameters
rightThe time to check against
Returns
True if the times are the same, false if different

Definition at line 58 of file Clock.cpp.

◆ operator>()

bool core::system::Clock::Time::operator> ( const Time right) const

Checks to see if a given time appears earlier than the current time. Counts days unless either day is 0.

Parameters
rightThe time to check against
Returns
True if right is earlier than this time

Definition at line 75 of file Clock.cpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const Time time 
)
friend

Definition at line 97 of file Clock.hpp.

Member Data Documentation

◆ day

unsigned int core::system::Clock::Time::day

Number of days elapsed in game since beginning. Starts at 1.

Definition at line 34 of file Clock.hpp.

◆ hour

unsigned int core::system::Clock::Time::hour

Current hour of the day, in range [0, 23].

Definition at line 37 of file Clock.hpp.

◆ minute

unsigned int core::system::Clock::Time::minute

Current minute of the hour. In range [0, 59].

Definition at line 40 of file Clock.hpp.


The documentation for this struct was generated from the following files: