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:
@@ -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());
|
||||
|
@@ -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';
|
||||
|
Reference in New Issue
Block a user