mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 01:15:33 +00:00
Support negative days in TimeStamp
As vanilla engine does.
This commit is contained in:
parent
a5b1ce77ea
commit
4f360e6374
1 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <components/esm/defs.hpp>
|
#include <components/esm/defs.hpp>
|
||||||
|
|
||||||
|
@ -10,8 +11,8 @@ namespace MWWorld
|
||||||
TimeStamp::TimeStamp (float hour, int day)
|
TimeStamp::TimeStamp (float hour, int day)
|
||||||
: mHour (hour), mDay (day)
|
: mHour (hour), mDay (day)
|
||||||
{
|
{
|
||||||
if (hour<0 || hour>=24 || day<0)
|
if (hour < 0 || hour >= 24)
|
||||||
throw std::runtime_error ("invalid time stamp");
|
throw std::runtime_error("invalid time stamp hour: " + std::to_string(hour));
|
||||||
}
|
}
|
||||||
|
|
||||||
float TimeStamp::getHour() const
|
float TimeStamp::getHour() const
|
||||||
|
|
Loading…
Reference in a new issue