Mercurial > minori
diff src/core/date.cpp @ 11:fc1bf97c528b
*: use C++11 standard
I've been meaning to do this for a while, but I didn't want to reimplement
the filesystem code. Now we are on C++11 and most compilers from the past 5 centuries should support this now
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 17 Sep 2023 06:14:30 -0400 |
parents | 4b198a111713 |
children | cde8f67a7c7d |
line wrap: on
line diff
--- a/src/core/date.cpp Sat Sep 16 02:06:01 2023 -0400 +++ b/src/core/date.cpp Sun Sep 17 06:14:30 2023 -0400 @@ -31,13 +31,13 @@ } Date::Date(int32_t y) { - year = std::make_unique<int32_t>(MAX(0, y)); + SetYear(y); } Date::Date(int32_t y, int8_t m, int8_t d) { - year = std::make_unique<int32_t>(MAX(0, y)); - month = std::make_unique<int8_t>(CLAMP(m, 1, 12)); - day = std::make_unique<int8_t>(CLAMP(d, 1, 31)); + SetYear(y); + SetMonth(m); + SetDay(d); } void Date::VoidYear() { @@ -53,15 +53,15 @@ } void Date::SetYear(int32_t y) { - year = std::make_unique<int32_t>(MAX(0, y)); + year.reset(new int32_t(MAX(0, y))); } void Date::SetMonth(int8_t m) { - month = std::make_unique<int8_t>(CLAMP(m, 1, 12)); + month.reset(new int8_t(CLAMP(m, 1, 12))); } void Date::SetDay(int8_t d) { - day = std::make_unique<int8_t>(CLAMP(d, 1, 31)); + day.reset(new int8_t(CLAMP(d, 1, 31))); } int32_t Date::GetYear() const {