Skip to content

Commit

Permalink
Merge pull request #6010 from sturnclaw/savebump
Browse files Browse the repository at this point in the history
Increment savefile version to v91
  • Loading branch information
sturnclaw authored Jan 12, 2025
2 parents 8630489 + a58d0bd commit 2b9846f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
1 change: 0 additions & 1 deletion SAVEBUMP.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ Regular tasks
- data/libs/NameGen.lua: Add new authors to name generator

One-time tasks
- DynamicBody.cpp: the std::isnan() check in constructor should be removed
- add your one-time tasks here
27 changes: 27 additions & 0 deletions data/culture/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -629,16 +629,20 @@ local surname = {
"Allen",
"Anderson",
"Armstrong",
"Ashworth",
"Atkinson",
"Bailey",
"Baker",
"Ball",
"Bailey",
"Barker",
"Barnes",
"Bartholomew",
"Bell",
"Bennett",
"Booth",
"Bradley",
"Briggs",
"Brooks",
"Brown",
"Burton",
Expand All @@ -651,11 +655,13 @@ local surname = {
"Collins",
"Cook",
"Cooper",
"Copland",
"Corbyn",
"Cox",
"Davidson",
"Davies",
"Dawson",
"Dennett",
"Dixon",
"Edwards",
"Elliott",
Expand All @@ -676,10 +682,15 @@ local surname = {
"Harris",
"Harrison",
"Harvey",
"Hemingway",
"Henderson",
"Hill",
"Hills",
"Hindle",
"Hodgetts",
"Holmes",
"Howard",
"Howlett",
"Hughes",
"Hunt",
"Hunter",
Expand All @@ -689,6 +700,7 @@ local surname = {
"Johnson",
"Johnston",
"Jones",
"Jordan",
"Kelly",
"Kennedy",
"King",
Expand All @@ -697,6 +709,7 @@ local surname = {
"Lee",
"Lewis",
"Lloyd",
"List",
"Marshall",
"Martin",
"Mason",
Expand All @@ -705,53 +718,67 @@ local surname = {
"Miller",
"Mitchell",
"Moore",
"Morales",
"Morgan",
"Morris",
"Morrison",
"Morton",
"Mueller",
"Murphy",
"Murray",
"Norris",
"Owen",
"Palmer",
"Parker",
"Payne",
"Pearce",
"Pearson",
"Perry",
"Peterson",
"Phillips",
"Powell",
"Price",
"Reid",
"Reilly",
"Reynolds",
"Richards",
"Richardson",
"Roberts",
"Robertson",
"Robinson",
"Rogers",
"Ronald",
"Rose",
"Ross",
"Russell",
"Salt",
"Saunders",
"Scott",
"Schmidt",
"Shaw",
"Sheets",
"Simpson",
"Smith",
"Spencer",
"Stevens",
"Stewart",
"Talkington",
"Taylor",
"Thomas",
"Thompson",
"Thomson",
"Turner",
"Tyler",
"Walker",
"Walsh",
"Ward",
"Watson",
"Watts",
"Webb",
"Webster",
"Werle",
"West",
"Westerhoff",
"White",
"Wilkinson",
"Williams",
Expand Down
6 changes: 0 additions & 6 deletions src/DynamicBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ DynamicBody::DynamicBody(const Json &jsonObj, Space *space) :
throw SavedGameCorruptException();
}

// fix saves with nans
// SAVEBUMP: This can be removed starting with save version 91
if (std::isnan(m_angVel.x) || std::isnan(m_angVel.y) || std::isnan(m_angVel.z)) {
m_angVel = vector3d(0.0);
}

m_aiMessage = AIError::AIERROR_NONE;
m_decelerating = false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/SaveGameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

static const char s_saveDirName[] = "savefiles";

static const int s_saveVersion = 90;
// Last incremented: 01/2025 prior to 02-03-2025 release
static const int s_saveVersion = 91;

// A simple job to load a savegame into a Json object
class LoadGameToJsonJob : public Job
Expand Down Expand Up @@ -181,4 +182,3 @@ std::vector<FileSystem::FileInfo> SaveGameManager::ListSaves()
}
return saves;
}

10 changes: 3 additions & 7 deletions src/Shields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ void Shields::ClearModel()
m_shieldMaterial.Reset();
}

void Shields::SaveToJson(Json &jsonObj)
void Shields::SaveToJson(Json &shieldsObj)
{
Json shieldsObj({}); // Create JSON object to contain shields data.
shieldsObj = Json::object(); // Create JSON object to contain shields data.

shieldsObj["enabled"] = m_enabled;
shieldsObj["num_shields"] = m_shields.size();
Expand All @@ -172,15 +172,11 @@ void Shields::SaveToJson(Json &jsonObj)
shieldArray.push_back(shieldArrayEl); // Append shield object to array.
}
shieldsObj["shield_array"] = shieldArray; // Add shield array to shields object.

jsonObj["shields"] = shieldsObj; // Add shields object to supplied object.
}

void Shields::LoadFromJson(const Json &jsonObj)
void Shields::LoadFromJson(const Json &shieldsObj)
{
try {
Json shieldsObj = jsonObj["shields"];

m_enabled = shieldsObj["enabled"];
assert(shieldsObj["num_shields"].get<unsigned int>() == m_shields.size());

Expand Down
4 changes: 2 additions & 2 deletions src/Ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Ship::Ship(const Json &jsonObj, Space *space) :

m_navLights->LoadFromJson(shipObj);

m_shields->LoadFromJson(shipObj);
m_shields->LoadFromJson(shipObj["shields"]);

m_shipName = shipObj["name"].get<std::string>();
Properties().Set("shipName", m_shipName);
Expand Down Expand Up @@ -300,7 +300,7 @@ void Ship::SaveToJson(Json &jsonObj, Space *space)

m_navLights->SaveToJson(shipObj);

m_shields->SaveToJson(shipObj);
m_shields->SaveToJson(shipObj["shields"]);

shipObj["name"] = m_shipName;

Expand Down

0 comments on commit 2b9846f

Please sign in to comment.