bool SectorPersistenceGenerator::Apply(Random& rng, RefCountedPtr<Galaxy> galaxy, RefCountedPtr<Sector> sector, GalaxyGenerator::SectorConfig* config) { if (galaxy->IsInitialized()) { for (Sector::System& secsys : sector->m_systems) { Sint32 exploredTime = m_exploredSystems.Get(SystemPath(secsys.sx, secsys.sy, secsys.sz, secsys.idx), -1); if (exploredTime == 0) { secsys.m_explored = StarSystem::eEXPLORED_AT_START; secsys.m_exploredTime = 0.0; } else if (exploredTime > 0) { int year = exploredTime >> 9; int month = (exploredTime >> 5) & 0xf; int day = exploredTime & 0x1f; Time::DateTime dt(year, month, day); secsys.m_explored = StarSystem::eEXPLORED_BY_PLAYER; secsys.m_exploredTime = dt.ToGameTime(); } } }