QtBiomeVisualiser: Seed is read properly.
This commit is contained in:
parent
bdb8d916c0
commit
f424a0ec60
@ -171,7 +171,7 @@ void BioGenSource::getChunkBiomes(int a_ChunkX, int a_ChunkZ, ChunkPtr a_DestChu
|
|||||||
|
|
||||||
void BioGenSource::reload()
|
void BioGenSource::reload()
|
||||||
{
|
{
|
||||||
int seed = m_IniFile->GetValueSetI("Generator", "Seed", 0);
|
int seed = m_IniFile->GetValueSetI("Seed", "Seed", 0);
|
||||||
bool unused = false;
|
bool unused = false;
|
||||||
QMutexLocker lock(&m_Mtx);
|
QMutexLocker lock(&m_Mtx);
|
||||||
m_BiomeGen.reset(cBiomeGen::CreateBiomeGen(*m_IniFile, seed, unused));
|
m_BiomeGen.reset(cBiomeGen::CreateBiomeGen(*m_IniFile, seed, unused));
|
||||||
|
@ -31,6 +31,7 @@ GeneratorSetup::GeneratorSetup(const AString & a_IniFileName, QWidget * a_Parent
|
|||||||
m_eSeed = new QLineEdit();
|
m_eSeed = new QLineEdit();
|
||||||
m_eSeed->setValidator(new QIntValidator());
|
m_eSeed->setValidator(new QIntValidator());
|
||||||
m_eSeed->setText("0");
|
m_eSeed->setText("0");
|
||||||
|
m_eSeed->setProperty("INI.SectionName", QVariant("Seed"));
|
||||||
m_eSeed->setProperty("INI.ItemName", QVariant("Seed"));
|
m_eSeed->setProperty("INI.ItemName", QVariant("Seed"));
|
||||||
m_cbGenerator = new QComboBox();
|
m_cbGenerator = new QComboBox();
|
||||||
m_cbGenerator->setMinimumWidth(120);
|
m_cbGenerator->setMinimumWidth(120);
|
||||||
@ -53,12 +54,7 @@ GeneratorSetup::GeneratorSetup(const AString & a_IniFileName, QWidget * a_Parent
|
|||||||
setLayout(m_MainLayout);
|
setLayout(m_MainLayout);
|
||||||
|
|
||||||
// Load the INI file, if specified, otherwise set defaults:
|
// Load the INI file, if specified, otherwise set defaults:
|
||||||
if (!a_IniFileName.empty() && m_IniFile->ReadFile(a_IniFileName))
|
if (a_IniFileName.empty() || !m_IniFile->ReadFile(a_IniFileName))
|
||||||
{
|
|
||||||
m_cbGenerator->setCurrentText(QString::fromStdString(m_IniFile->GetValue("Generator", "BiomeGen")));
|
|
||||||
m_eSeed->setText(QString::number(m_IniFile->GetValueI("Generator", "Seed")));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
m_IniFile->SetValue("Generator", "Generator", "Composable");
|
m_IniFile->SetValue("Generator", "Generator", "Composable");
|
||||||
m_IniFile->SetValue("Generator", "BiomeGen", m_cbGenerator->currentText().toStdString());
|
m_IniFile->SetValue("Generator", "BiomeGen", m_cbGenerator->currentText().toStdString());
|
||||||
@ -110,8 +106,9 @@ void GeneratorSetup::generatorChanged(const QString & a_NewName)
|
|||||||
|
|
||||||
void GeneratorSetup::editChanged(const QString & a_NewValue)
|
void GeneratorSetup::editChanged(const QString & a_NewValue)
|
||||||
{
|
{
|
||||||
|
QString sectionName = sender()->property("INI.SectionName").toString();
|
||||||
QString itemName = sender()->property("INI.ItemName").toString();
|
QString itemName = sender()->property("INI.ItemName").toString();
|
||||||
m_IniFile->SetValue("Generator", itemName.toStdString(), a_NewValue.toStdString());
|
m_IniFile->SetValue(sectionName.toStdString(), itemName.toStdString(), a_NewValue.toStdString());
|
||||||
emit generatorUpdated();
|
emit generatorUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +118,7 @@ void GeneratorSetup::editChanged(const QString & a_NewValue)
|
|||||||
|
|
||||||
void GeneratorSetup::updateFromIni()
|
void GeneratorSetup::updateFromIni()
|
||||||
{
|
{
|
||||||
|
m_eSeed->setText(QString::number(m_IniFile->GetValueI("Seed", "Seed", 0)));
|
||||||
int keyID = m_IniFile->FindKey("Generator");
|
int keyID = m_IniFile->FindKey("Generator");
|
||||||
if (keyID <= -1)
|
if (keyID <= -1)
|
||||||
{
|
{
|
||||||
@ -141,6 +139,7 @@ void GeneratorSetup::updateFromIni()
|
|||||||
|
|
||||||
QLineEdit * edit = new QLineEdit();
|
QLineEdit * edit = new QLineEdit();
|
||||||
edit->setText(QString::fromStdString(itemValue));
|
edit->setText(QString::fromStdString(itemValue));
|
||||||
|
edit->setProperty("INI.SectionName", QVariant("Generator"));
|
||||||
edit->setProperty("INI.ItemName", QVariant(QString::fromStdString(itemName)));
|
edit->setProperty("INI.ItemName", QVariant(QString::fromStdString(itemName)));
|
||||||
|
|
||||||
// Remove the generator name prefix from the item name, for clarity purposes:
|
// Remove the generator name prefix from the item name, for clarity purposes:
|
||||||
|
Loading…
Reference in New Issue
Block a user