diff --git a/src/HOI4World/Map/HoI4ProvinceDefinitionImporter.cpp b/src/HOI4World/Map/HoI4ProvinceDefinitionImporter.cpp index a491ae0ec..e8a9f2000 100644 --- a/src/HOI4World/Map/HoI4ProvinceDefinitionImporter.cpp +++ b/src/HOI4World/Map/HoI4ProvinceDefinitionImporter.cpp @@ -34,7 +34,7 @@ Maps::ProvinceDefinitions HoI4::importProvinceDefinitions(const std::string& pat auto pos = line.find_first_of(';'); if (pos == std::string::npos) { - break; + continue; } auto provNum = stoi(line.substr(0, pos)); if (provNum == 0) @@ -47,7 +47,7 @@ Maps::ProvinceDefinitions HoI4::importProvinceDefinitions(const std::string& pat pos = line.find_first_of(';'); if (pos == std::string::npos) { - break; + continue; } const int red(stoi(line.substr(0, pos))); line = line.substr(pos + 1, line.length()); @@ -56,7 +56,7 @@ Maps::ProvinceDefinitions HoI4::importProvinceDefinitions(const std::string& pat pos = line.find_first_of(';'); if (pos == std::string::npos) { - break; + continue; } const int green(stoi(line.substr(0, pos))); line = line.substr(pos + 1, line.length()); @@ -65,7 +65,7 @@ Maps::ProvinceDefinitions HoI4::importProvinceDefinitions(const std::string& pat pos = line.find_first_of(';'); if (pos == std::string::npos) { - break; + continue; } const int blue(stoi(line.substr(0, pos))); line = line.substr(pos + 1, line.length()); @@ -77,7 +77,7 @@ Maps::ProvinceDefinitions HoI4::importProvinceDefinitions(const std::string& pat pos = line.find_first_of(';'); if (pos == std::string::npos) { - break; + continue; } const std::string landOrSea = line.substr(0, pos); line = line.substr(pos + 1, line.length()); @@ -94,7 +94,7 @@ Maps::ProvinceDefinitions HoI4::importProvinceDefinitions(const std::string& pat pos = line.find_first_of(';'); if (pos == std::string::npos) { - break; + continue; } line = line.substr(pos + 1, line.length()); @@ -102,7 +102,7 @@ Maps::ProvinceDefinitions HoI4::importProvinceDefinitions(const std::string& pat pos = line.find_first_of(';'); if (pos == std::string::npos) { - break; + continue; } const std::string terrain = line.substr(0, pos); line = line.substr(pos + 1, line.length()); diff --git a/src/HOI4World/Map/HoI4Provinces.cpp b/src/HOI4World/Map/HoI4Provinces.cpp index 91deaff36..30014e729 100644 --- a/src/HOI4World/Map/HoI4Provinces.cpp +++ b/src/HOI4World/Map/HoI4Provinces.cpp @@ -25,6 +25,10 @@ std::map HoI4::importProvinces(const Configuration& theConf } auto IDSeparator = line.find_first_of(';'); + if (IDSeparator == std::string::npos) + { + continue; + } auto ID = stoi(line.substr(0, IDSeparator)); if (ID == 0) { diff --git a/src/Mappers/Provinces/ProvinceMapperFactory.cpp b/src/Mappers/Provinces/ProvinceMapperFactory.cpp index 620e425fd..89b810be1 100644 --- a/src/Mappers/Provinces/ProvinceMapperFactory.cpp +++ b/src/Mappers/Provinces/ProvinceMapperFactory.cpp @@ -58,10 +58,14 @@ void checkAllHoI4ProvincesMapped(const Mappers::VersionedMappings& versionedMapp while (true) { + if (definitions.eof()) + { + break; + } auto provNum = getNextProvinceNumFromFile(definitions); if (!provNum) { - break; + continue; } if (*provNum == 0) {