refactor: move Weather instance to WorldInfo

This commit is contained in:
MihailRis
2025-02-28 18:49:44 +03:00
parent 0ea842580c
commit 9c4db8fa10
9 changed files with 116 additions and 61 deletions
+3 -2
View File
@@ -208,6 +208,7 @@ void WorldInfo::deserialize(const dv::value& root) {
totalTime = timeobj["total-time"].asNumber();
}
if (root.has("weather")) {
weather.deserialize(root["weather"]);
fog = root["weather"]["fog"].asNumber();
}
nextInventoryId = root["next-inventory-id"].asInteger(2);
@@ -231,8 +232,8 @@ dv::value WorldInfo::serialize() const {
timeobj["day-time-speed"] = daytimeSpeed;
timeobj["total-time"] = totalTime;
auto& weatherobj = root.object("weather");
weatherobj["fog"] = fog;
root["weather"] = weather.serialize();
root["weather"]["fog"] = fog;
root["next-inventory-id"] = nextInventoryId;
root["next-entity-id"] = nextEntityId;