add save version info to dfhack-status.dat · cppcooper/dfhack@f9936f4 · GitHub
Skip to content

Commit f9936f4

Browse files
committed
add save version info to dfhack-status.dat
1 parent 06cb875 commit f9936f4

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

library/include/modules/World.h

Lines changed: 1 addition & 0 deletions

library/modules/Persistence.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ distribution.
3434
#include "modules/Persistence.h"
3535
#include "modules/World.h"
3636

37+
#include "df/world.h"
38+
3739
#include <json/json.h>
3840

3941
#include <unordered_map>
@@ -205,6 +207,13 @@ void Persistence::Internal::save(color_ostream& out) {
205207
if (strlen(Version::dfhack_run_url())) {
206208
file << "Build url: " << Version::dfhack_run_url() << std::endl;
207209
}
210+
if (df::global::world and df::global::version) {
211+
file << std::endl;
212+
file << "World name: " << World::getWorldName() << " (" << World::getWorldName(true) << ")" << std::endl;
213+
file << "World generated in version: " << df::global::world->original_save_version << std::endl;
214+
file << "World last saved in version: " << df::global::world->save_version << std::endl;
215+
file << "World loaded in version: " << *df::global::version << std::endl;
216+
}
208217
}
209218

210219
// write entity data
@@ -304,7 +313,6 @@ void Persistence::Internal::load(color_ostream& out) {
304313
const std::string legacy_fname = getSaveFilePath(world_name, "legacy-data");
305314
if (Filesystem::exists(legacy_fname)) {
306315
int synthesized_entity_id = Persistence::WORLD_ENTITY_ID;
307-
using df::global::world;
308316
if (World::IsSiteLoaded())
309317
synthesized_entity_id = World::GetCurrentSiteId();
310318
load_file(legacy_fname, synthesized_entity_id);

library/modules/World.cpp

Lines changed: 7 additions & 0 deletions

0 commit comments

Comments
 (0)