Fixing minor bugs in texts, encoding, UI
This commit is contained in:
1 parent
79413e7319
commit
d4365728fe
87 files changed
+883
-404
No files matched your search
+9
-5
@@ -412,13 +412,15 @@ namespace ZL
|
||||
nlohmann::json root;
|
||||
gameState.save(root);
|
||||
const std::string path = "resources/config/start_state.json";
|
||||
/*
|
||||
std::ofstream file(path);
|
||||
if (file.is_open()) {
|
||||
file << root.dump(2);
|
||||
std::cout << "[reset] Saved initial state snapshot to " << path << std::endl;
|
||||
} else {
|
||||
std::cerr << "[reset] Could not open " << path << " for writing" << std::endl;
|
||||
}
|
||||
}*/
|
||||
saveJsonToFile(root, path);
|
||||
}
|
||||
|
||||
void Game::createLocations()
|
||||
@@ -1664,7 +1666,7 @@ namespace ZL
|
||||
SaveSlotInfo Game::readSlotInfo(int slot) const
|
||||
{
|
||||
std::string path = "save_slot" + std::to_string(slot) + ".json";
|
||||
std::string content = ZL::readTextFile(path);
|
||||
std::string content = ZL::readSavedTextFile(path);
|
||||
if (content.empty()) return {};
|
||||
try {
|
||||
nlohmann::json root = nlohmann::json::parse(content);
|
||||
@@ -1683,18 +1685,20 @@ namespace ZL
|
||||
nlohmann::json root;
|
||||
gameState.save(root);
|
||||
std::string path = "save_slot" + std::to_string(slot) + ".json";
|
||||
std::ofstream file(path);
|
||||
|
||||
/*std::ofstream file(path);
|
||||
if (file.is_open()) {
|
||||
file << root.dump(2);
|
||||
} else {
|
||||
std::cerr << "[save] Could not open " << path << " for writing" << std::endl;
|
||||
}
|
||||
}*/
|
||||
saveJsonToFile(root, path);
|
||||
}
|
||||
|
||||
void Game::loadGame(int slot)
|
||||
{
|
||||
std::string path = "save_slot" + std::to_string(slot) + ".json";
|
||||
std::string content = ZL::readTextFile(path);
|
||||
std::string content = ZL::readSavedTextFile(path);
|
||||
if (content.empty()) {
|
||||
std::cerr << "[save] Save file not found or empty: " << path << std::endl;
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user