Allow star names to be specified in .stc files
parent
c5d068c356
commit
c17cc8d5cb
|
@ -543,6 +543,32 @@ bool StarDatabase::load(istream& in)
|
|||
stars = newStars;
|
||||
}
|
||||
stars[nStars++] = *star;
|
||||
|
||||
string name;
|
||||
if (starData->getString("Name", name))
|
||||
{
|
||||
if (names != NULL)
|
||||
{
|
||||
// Iterate through the string for names delimited
|
||||
// by ':', and insert them into the star database.
|
||||
// Note that db->add() will skip empty names.
|
||||
string::size_type startPos = 0;
|
||||
while (startPos != string::npos)
|
||||
{
|
||||
string::size_type next = name.find(':', startPos);
|
||||
string::size_type length = string::npos;
|
||||
if (next != string::npos)
|
||||
{
|
||||
length = next - startPos;
|
||||
next++;
|
||||
}
|
||||
names->add(catalogNumber,
|
||||
name.substr(startPos, length));
|
||||
cout << "Star name: " << name.substr(startPos, length) << '\n';
|
||||
startPos = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3009,6 +3009,8 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg)
|
|||
return false;
|
||||
}
|
||||
|
||||
starDB->setNameDatabase(starNameDB);
|
||||
|
||||
// Now, read supplemental star files from the extras directories
|
||||
for (vector<string>::const_iterator iter = config->extrasDirs.begin();
|
||||
iter != config->extrasDirs.end(); iter++)
|
||||
|
@ -3027,8 +3029,6 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg)
|
|||
|
||||
starDB->finish();
|
||||
|
||||
starDB->setNameDatabase(starNameDB);
|
||||
|
||||
universe->setStarCatalog(starDB);
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue