Read the original edition calendar for gameplay, desktop and saves (by Codex)
Prepare verified release / draft (push) Waiting to run
Prepare verified release / draft (push) Waiting to run
This commit is contained in:
1 parent
f0ef79a119
commit
d43d09a378
16 files changed
+130
-11
No files matched your search
@@ -2,6 +2,7 @@
|
||||
#include "formats/badge_policy.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "ui/desk_state.hpp"
|
||||
#include "game/calendar.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
@@ -462,7 +463,11 @@ void validate_desk_state(const DeskState& d) {
|
||||
|
||||
DeskDate desk_date(uint32_t counter, const LeImage& exe) {
|
||||
if (counter == 0xffff || counter > 3000000) throw FormatError("desk: unsupported date counter");
|
||||
DeskDate d; d.weekday = int((counter + 2) % 7);
|
||||
// Partial data-only images use the explicitly installed calendar. Full
|
||||
// executable images must supply their verified original date setup.
|
||||
const auto epoch = exe.contains(layout::CalendarDateSetup)
|
||||
? calendar_epoch_from_executable(exe) : calendar_epoch();
|
||||
DeskDate d; d.weekday = int((counter + uint32_t(epoch.weekday)) % 7);
|
||||
int cycle = 3, years = 0;
|
||||
while (counter > uint32_t(364 + (cycle == 4))) {
|
||||
if (cycle == 4) { cycle = 0; --counter; }
|
||||
@@ -479,7 +484,7 @@ DeskDate desk_date(uint32_t counter, const LeImage& exe) {
|
||||
d.day -= month_days();
|
||||
if (++d.month == 13) { d.month = 1; ++years; }
|
||||
}
|
||||
d.year = 2026 + years;
|
||||
d.year = epoch.year + years;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user