parent
50f15ff5cd
commit
6eaa915873
|
@ -426,17 +426,21 @@ string StarDatabase::getStarNameList(const Star& star, const unsigned int maxNam
|
|||
{
|
||||
string starNames;
|
||||
unsigned int catalogNumber = star.getCatalogNumber();
|
||||
StarNameDatabase::NumberIndex::const_iterator iter = namesDB->getFirstNameIter(catalogNumber);
|
||||
|
||||
unsigned int count = 0;
|
||||
while (iter != namesDB->getFinalNameIter() && iter->first == catalogNumber && count < maxNames)
|
||||
{
|
||||
if (count != 0)
|
||||
starNames += " / ";
|
||||
|
||||
starNames += iter->second;
|
||||
++iter;
|
||||
++count;
|
||||
if (namesDB != nullptr)
|
||||
{
|
||||
StarNameDatabase::NumberIndex::const_iterator iter = namesDB->getFirstNameIter(catalogNumber);
|
||||
|
||||
while (iter != namesDB->getFinalNameIter() && iter->first == catalogNumber && count < maxNames)
|
||||
{
|
||||
if (count != 0)
|
||||
starNames += " / ";
|
||||
|
||||
starNames += iter->second;
|
||||
++iter;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t hip = catalogNumber;
|
||||
|
|
|
@ -3902,18 +3902,17 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
|
|||
{
|
||||
StarDetails::SetStarTextures(cfg.starTextures);
|
||||
|
||||
StarNameDatabase* starNameDB = nullptr;
|
||||
ifstream starNamesFile(cfg.starNamesFile.string(), ios::in);
|
||||
if (!starNamesFile.good())
|
||||
if (starNamesFile.good())
|
||||
{
|
||||
starNameDB = StarNameDatabase::readNames(starNamesFile);
|
||||
if (starNameDB == nullptr)
|
||||
cerr << _("Error reading star names file\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::fprintf(cerr, _("Error opening %s\n"), cfg.starNamesFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
StarNameDatabase* starNameDB = StarNameDatabase::readNames(starNamesFile);
|
||||
if (starNameDB == nullptr)
|
||||
{
|
||||
cerr << _("Error reading star names file\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// First load the binary star database file. The majority of stars
|
||||
|
@ -3942,6 +3941,8 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
|
|||
}
|
||||
}
|
||||
|
||||
if (starNameDB == nullptr)
|
||||
starNameDB = new StarNameDatabase();
|
||||
starDB->setNameDatabase(starNameDB);
|
||||
|
||||
loadCrossIndex(starDB, StarDatabase::HenryDraper, cfg.HDCrossIndexFile);
|
||||
|
|
Loading…
Reference in New Issue