Avoid problems with exoplanets names that include whitespaces

This commit is contained in:
Emma Broman
2020-08-31 09:18:00 +02:00
parent cef3fb69f4
commit acbf670bc4
+4 -1
View File
@@ -121,7 +121,6 @@ int addExoplanetSystem(lua_State* L) {
// If user have given name as in EOD, change it to speck-name
std::string starNameSpeck = getSpeckStarName(starName);
std::replace(starNameSpeck.begin(), starNameSpeck.end(), ' ', '_');
std::ifstream data(
absPath("${MODULE_EXOPLANETS}/expl_data.bin"),
@@ -214,6 +213,7 @@ int addExoplanetSystem(lua_State* L) {
starToSunVec.z
);
// Avoid whitespaces in identifiers
std::replace(starNameSpeck.begin(), starNameSpeck.end(), ' ', '_');
const std::string starParent = "{"
@@ -371,6 +371,9 @@ int addExoplanetSystem(lua_State* L) {
const float semiMajorAxisInMeter = planet.A * distanceconstants::AstronomicalUnit;
const float semiMajorAxisInKm = semiMajorAxisInMeter * 0.001f;
// Avoid whitespace in identifier
std::replace(planetName.begin(), planetName.end(), ' ', '_');
const std::string planetNode = "{"
"Identifier = '" + planetName + "',"
"Parent = '" + starNameSpeck + "',"