Fix some issues when loading new-format scenarios

- Carriage returns misinterpreted as map features
- Error code returned by CopyFiles
- Confusing error message when a file is missing in the archive
This commit is contained in:
2017-01-20 23:11:40 -05:00
parent 07e5907818
commit 380b64aa7a
4 changed files with 12 additions and 3 deletions

View File

@@ -296,6 +296,7 @@ bool load_scenario_v1(fs::path file_to_load, cScenario& scenario, bool only_head
}
ticpp::Document xmlDocFromStream(std::istream& stream, std::string name) {
if(!stream) throw std::string("Error loading scenario file: ") + name;
std::string contents;
stream.seekg(0, std::ios::end);
contents.reserve(stream.tellg());

View File

@@ -30,7 +30,7 @@ map_data load_map(std::istream& fin, bool isTown, std::string name) {
bool vehicle_owned;
for(char c : line) {
if(c == '#') break; // Found a comment
if(c == ' ' || c == '\t') continue;
if(isspace(c)) continue;
if(isdigit(c)) {
n *= 10;
n += c - '0';