From 52b869d908aa55410db0574610e64f69bb5502b6 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 14 Apr 2023 01:22:12 -0700 Subject: [PATCH 1/2] don't read cur_savegame.save_dir when invalid --- library/Core.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/Core.cpp b/library/Core.cpp index b1fe2d389..e9463ec51 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -2083,7 +2083,9 @@ void Core::handleLoadAndUnloadScripts(color_ostream& out, state_change_event eve if (!df::global::world) return; - std::string rawFolder = "save/" + (df::global::world->cur_savegame.save_dir) + "/init"; + + std::string rawFolder = !isWorldLoaded() ? "" : + "save/" + (df::global::world->cur_savegame.save_dir) + "/init"; auto i = table.find(event); if ( i != table.end() ) { From 5ace09fad0addc0fa02ff26bd27affa573fd39b1 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 14 Apr 2023 01:38:38 -0700 Subject: [PATCH 2/2] use the World module for the data read --- library/Core.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index e9463ec51..c3c7bb7f2 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -2084,8 +2084,7 @@ void Core::handleLoadAndUnloadScripts(color_ostream& out, state_change_event eve if (!df::global::world) return; - std::string rawFolder = !isWorldLoaded() ? "" : - "save/" + (df::global::world->cur_savegame.save_dir) + "/init"; + std::string rawFolder = !isWorldLoaded() ? "" : "save/" + World::ReadWorldFolder() + "/init"; auto i = table.find(event); if ( i != table.end() ) {