Created
October 4, 2014 07:13
-
-
Save Zeno-/bdc7c26752443e9ef2df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2948579a866d0289d8296a18e2a3dab90b43846f Mon Sep 17 00:00:00 2001 | |
From: Craig Robbins <kde.psych@gmail.com> | |
Date: Sat, 4 Oct 2014 17:05:27 +1000 | |
Subject: [PATCH] Work-around ServerMap::loadMapMeta(): could not open for new worlds | |
--- | |
src/map.cpp | 9 ++++++++- | |
src/subgame.cpp | 1 + | |
2 files changed, 9 insertions(+), 1 deletion(-) | |
diff --git a/src/map.cpp b/src/map.cpp | |
index 1fe0ca9..10996af 100644 | |
--- a/src/map.cpp | |
+++ b/src/map.cpp | |
@@ -3069,10 +3069,17 @@ void ServerMap::loadMapMeta() | |
std::ifstream is(fullpath.c_str(), std::ios_base::binary); | |
if (!is.good()) { | |
errorstream << "ServerMap::loadMapMeta(): " | |
- << "could not open" << fullpath << std::endl; | |
+ << "could not open " << fullpath << std::endl; | |
throw FileNotGoodException("Cannot open map metadata"); | |
} | |
+ if (is.peek() == std::ifstream::traits_type::eof()) { | |
+ infostream << "ServerMap::loadMapMeta(): " | |
+ << "empty " << fullpath <<" (will save params on exit)" | |
+ << std::endl; | |
+ throw FileNotGoodException("Empty map metadata"); | |
+ } | |
+ | |
Settings params; | |
if (!params.parseConfigLines(is, "[end_of_params]")) { | |
diff --git a/src/subgame.cpp b/src/subgame.cpp | |
index f2465c9..98ff3a5 100644 | |
--- a/src/subgame.cpp | |
+++ b/src/subgame.cpp | |
@@ -244,6 +244,7 @@ bool initializeWorld(const std::string &path, const std::string &gameid) | |
std::ostringstream ss(std::ios_base::binary); | |
ss<<"gameid = "<<gameid<< "\nbackend = sqlite3\n"; | |
fs::safeWriteToFile(worldmt_path, ss.str()); | |
+ fs::safeWriteToFile(path + DIR_DELIM + "map_meta.txt", ""); | |
} | |
return true; | |
} | |
-- | |
1.9.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment