QTfrontend/gamecfgwidget.cpp
changeset 1797 fedd8649fdd9
parent 1784 dfe9bafb4590
child 1802 dd148e2506e2
--- a/QTfrontend/gamecfgwidget.cpp	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/gamecfgwidget.cpp	Sun Feb 15 14:38:02 2009 +0000
@@ -62,12 +62,13 @@
 	L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions);
 	L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions);
 	L_SuddenDeath = new QLabel(QLabel::tr("Turns before SD"), GBoxOptions);
-	L_CaseProb = new QLabel(QLabel::tr("Bonus factor"), GBoxOptions);
+	L_CaseProb = new QLabel(QLabel::tr("Crate drops"), GBoxOptions);
 	GBoxOptionsLayout->addWidget(L_TurnTime, 4, 0);
 	GBoxOptionsLayout->addWidget(L_InitHealth, 5, 0);
 	GBoxOptionsLayout->addWidget(L_SuddenDeath, 6, 0);
 	GBoxOptionsLayout->addWidget(L_CaseProb, 7, 0);
 	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 8, 0);
+	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Generated Map Filter"), GBoxOptions), 9, 0);
 
 	SB_TurnTime = new QSpinBox(GBoxOptions);
 	SB_TurnTime->setRange(1, 99);
@@ -96,6 +97,15 @@
 	WeaponsName = new QComboBox(GBoxOptions);
 	GBoxOptionsLayout->addWidget(WeaponsName, 8, 1);
 
+	CB_TemplateFilter = new QComboBox(GBoxOptions);
+    CB_TemplateFilter->addItem(tr("All"), 0);
+    CB_TemplateFilter->addItem(tr("Small"), 1);
+    CB_TemplateFilter->addItem(tr("Medium"), 2);
+    CB_TemplateFilter->addItem(tr("Large"), 3);
+    CB_TemplateFilter->addItem(tr("Cavern"), 4);
+    CB_TemplateFilter->addItem(tr("Wacky"), 5);
+	GBoxOptionsLayout->addWidget(CB_TemplateFilter, 9, 1);
+
 	connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
 	connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
 	connect(SB_SuddenDeath, SIGNAL(valueChanged(int)), this, SIGNAL(suddenDeathTurnsChanged(int)));
@@ -105,6 +115,8 @@
 	connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
 	connect(CB_border, SIGNAL(toggled(bool)), this, SIGNAL(borderChanged(bool)));
 	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
+	connect(CB_TemplateFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(templateFilterChanged(int)));
+	connect(CB_TemplateFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(templateFilterChanged(int)));
 
 	connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SIGNAL(seedChanged(const QString &)));
 	connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SIGNAL(mapChanged(const QString &)));
@@ -162,6 +174,11 @@
 	return SB_CaseProb->value();
 }
 
+quint32 GameCFGWidget::getTemplateFilter() const
+{
+	return CB_TemplateFilter->itemData(CB_TemplateFilter->currentIndex()).toInt();
+}
+
 QStringList GameCFGWidget::getFullConfig() const
 {
 	QStringList sl;
@@ -170,6 +187,7 @@
 	sl.append(QString("e$turntime %1").arg(getTurnTime() * 1000));
 	sl.append(QString("e$sd_turns %1").arg(getSuddenDeathTurns()));
 	sl.append(QString("e$casefreq %1").arg(getCaseProbability()));
+	sl.append(QString("e$template_filter %1").arg(getTemplateFilter()));
 
 	QString currentMap = getCurrentMap();
 	if (currentMap.size() > 0)
@@ -248,6 +266,17 @@
 	}
 }
 
+void GameCFGWidget::setTemplateFilter(int filter)
+{
+	CB_TemplateFilter->setCurrentIndex(filter);
+}
+
+void GameCFGWidget::templateFilterChanged(int filter)
+{
+	pMapContainer->setTemplateFilter(filter);
+	emit newTemplateFilter(filter);
+}
+
 void GameCFGWidget::ammoChanged(int index)
 {
 	if (index >= 0)