summaryrefslogtreecommitdiffstats
path: root/Tools/QtBiomeVisualiser
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/QtBiomeVisualiser')
-rw-r--r--Tools/QtBiomeVisualiser/ChunkSource.cpp2
-rw-r--r--Tools/QtBiomeVisualiser/GeneratorSetup.cpp15
-rw-r--r--Tools/QtBiomeVisualiser/Globals.h11
3 files changed, 18 insertions, 10 deletions
diff --git a/Tools/QtBiomeVisualiser/ChunkSource.cpp b/Tools/QtBiomeVisualiser/ChunkSource.cpp
index bebf89a0a..2d180f00f 100644
--- a/Tools/QtBiomeVisualiser/ChunkSource.cpp
+++ b/Tools/QtBiomeVisualiser/ChunkSource.cpp
@@ -171,7 +171,7 @@ void BioGenSource::getChunkBiomes(int a_ChunkX, int a_ChunkZ, ChunkPtr a_DestChu
void BioGenSource::reload()
{
- int seed = m_IniFile->GetValueSetI("Generator", "Seed", 0);
+ int seed = m_IniFile->GetValueSetI("Seed", "Seed", 0);
bool unused = false;
QMutexLocker lock(&m_Mtx);
m_BiomeGen.reset(cBiomeGen::CreateBiomeGen(*m_IniFile, seed, unused));
diff --git a/Tools/QtBiomeVisualiser/GeneratorSetup.cpp b/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
index f5412404c..d6348ee00 100644
--- a/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
+++ b/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
@@ -31,6 +31,7 @@ GeneratorSetup::GeneratorSetup(const AString & a_IniFileName, QWidget * a_Parent
m_eSeed = new QLineEdit();
m_eSeed->setValidator(new QIntValidator());
m_eSeed->setText("0");
+ m_eSeed->setProperty("INI.SectionName", QVariant("Seed"));
m_eSeed->setProperty("INI.ItemName", QVariant("Seed"));
m_cbGenerator = new QComboBox();
m_cbGenerator->setMinimumWidth(120);
@@ -53,12 +54,7 @@ GeneratorSetup::GeneratorSetup(const AString & a_IniFileName, QWidget * a_Parent
setLayout(m_MainLayout);
// Load the INI file, if specified, otherwise set defaults:
- 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
+ if (a_IniFileName.empty() || !m_IniFile->ReadFile(a_IniFileName))
{
m_IniFile->SetValue("Generator", "Generator", "Composable");
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)
{
- QString itemName = sender()->property("INI.ItemName").toString();
- m_IniFile->SetValue("Generator", itemName.toStdString(), a_NewValue.toStdString());
+ QString sectionName = sender()->property("INI.SectionName").toString();
+ QString itemName = sender()->property("INI.ItemName").toString();
+ m_IniFile->SetValue(sectionName.toStdString(), itemName.toStdString(), a_NewValue.toStdString());
emit generatorUpdated();
}
@@ -121,6 +118,7 @@ void GeneratorSetup::editChanged(const QString & a_NewValue)
void GeneratorSetup::updateFromIni()
{
+ m_eSeed->setText(QString::number(m_IniFile->GetValueI("Seed", "Seed", 0)));
int keyID = m_IniFile->FindKey("Generator");
if (keyID <= -1)
{
@@ -141,6 +139,7 @@ void GeneratorSetup::updateFromIni()
QLineEdit * edit = new QLineEdit();
edit->setText(QString::fromStdString(itemValue));
+ edit->setProperty("INI.SectionName", QVariant("Generator"));
edit->setProperty("INI.ItemName", QVariant(QString::fromStdString(itemName)));
// Remove the generator name prefix from the item name, for clarity purposes:
diff --git a/Tools/QtBiomeVisualiser/Globals.h b/Tools/QtBiomeVisualiser/Globals.h
index 8d2e913b7..e2e9a9970 100644
--- a/Tools/QtBiomeVisualiser/Globals.h
+++ b/Tools/QtBiomeVisualiser/Globals.h
@@ -158,8 +158,17 @@ template class SizeChecker<UInt16, 2>;
TypeName(const TypeName &); \
void operator =(const TypeName &)
+// A macro that is used to mark unused local variables, to avoid pedantic warnings in gcc / clang / MSVC
+// Note that in MSVC it requires the full type of X to be known
+#define UNUSED_VAR(X) (void)(X)
+
// A macro that is used to mark unused function parameters, to avoid pedantic warnings in gcc
-#define UNUSED(X) (void)(X)
+// Written so that the full type of param needn't be known
+#ifdef _MSC_VER
+ #define UNUSED(X)
+#else
+ #define UNUSED UNUSED_VAR
+#endif