1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-05 15:40:10 +00:00
OpenMW/apps/openmw/mwworld/timestamp.hpp

52 lines
1.3 KiB
C++
Raw Normal View History

2012-05-18 22:04:22 +02:00
#ifndef GAME_MWWORLD_TIMESTAMP_H
#define GAME_MWWORLD_TIMESTAMP_H
2014-05-12 21:04:02 +02:00
namespace ESM
{
struct TimeStamp;
2014-05-12 21:04:02 +02:00
}
2012-05-18 22:04:22 +02:00
namespace MWWorld
{
/// \brief In-game time stamp
///
/// This class is based on the global variables GameHour and DaysPassed.
class TimeStamp
{
2022-09-22 21:26:05 +03:00
float mHour;
int mDay;
2012-05-18 22:04:22 +02:00
2022-09-22 21:26:05 +03:00
public:
explicit TimeStamp(float hour = 0, int day = 0);
///< \param hour [0, 23)
/// \param day >=0
2012-05-18 22:04:22 +02:00
2022-09-22 21:26:05 +03:00
explicit TimeStamp(const ESM::TimeStamp& esm);
ESM::TimeStamp toEsm() const;
2012-05-18 22:04:22 +02:00
2022-09-22 21:26:05 +03:00
float getHour() const;
2014-05-12 21:04:02 +02:00
2022-09-22 21:26:05 +03:00
int getDay() const;
2012-05-18 22:04:22 +02:00
2022-09-22 21:26:05 +03:00
TimeStamp& operator+=(double hours);
///< \param hours >=0
2012-05-18 22:04:22 +02:00
};
2022-09-22 21:26:05 +03:00
bool operator==(const TimeStamp& left, const TimeStamp& right);
bool operator!=(const TimeStamp& left, const TimeStamp& right);
2012-05-18 22:04:22 +02:00
2022-09-22 21:26:05 +03:00
bool operator<(const TimeStamp& left, const TimeStamp& right);
bool operator<=(const TimeStamp& left, const TimeStamp& right);
2012-05-18 22:04:22 +02:00
2022-09-22 21:26:05 +03:00
bool operator>(const TimeStamp& left, const TimeStamp& right);
bool operator>=(const TimeStamp& left, const TimeStamp& right);
2012-05-18 22:04:22 +02:00
2022-09-22 21:26:05 +03:00
TimeStamp operator+(const TimeStamp& stamp, double hours);
TimeStamp operator+(double hours, const TimeStamp& stamp);
2012-05-18 22:04:22 +02:00
2022-09-22 21:26:05 +03:00
double operator-(const TimeStamp& left, const TimeStamp& right);
2012-05-18 22:04:22 +02:00
///< Returns the difference between \a left and \a right in in-game hours.
}
#endif