File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ namespace DFHack
8888 DFHACK_EXPORT bool isArena (df::game_type t = (df::game_type)-1);
8989 DFHACK_EXPORT bool isLegends (df::game_type t = (df::game_type)-1);
9090
91+ DFHACK_EXPORT std::string getWorldName (bool in_english = false );
9192 DFHACK_EXPORT df::unit * getAdventurer ();
9293
9394 DFHACK_EXPORT int32_t GetCurrentSiteId ();
Original file line number Diff line number Diff 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);
Original file line number Diff line number Diff line change @@ -166,6 +166,13 @@ string World::ReadWorldFolder()
166166 return world->cur_savegame .save_dir ;
167167}
168168
169+ string World::getWorldName (bool in_english)
170+ {
171+ if (!world || !world->world_data )
172+ return " " ;
173+ return Translation::TranslateName (&world->world_data ->name , in_english);
174+ }
175+
169176bool World::isFortressMode (df::game_type t)
170177{
171178 if (t == -1 && df::global::gametype)
You can’t perform that action at this time.
0 commit comments