Implement Solid Land checkbox
authorunc0rr
Fri, 05 Dec 2008 16:49:04 +0000
changeset 1530 3b8d723661b2
parent 1529 3bc916b419cd
child 1531 f404233b6d9b
Implement Solid Land checkbox
QTfrontend/gamecfgwidget.cpp
QTfrontend/gamecfgwidget.h
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
hedgewars/uMisc.pas
--- a/QTfrontend/gamecfgwidget.cpp	Fri Dec 05 13:48:29 2008 +0000
+++ b/QTfrontend/gamecfgwidget.cpp	Fri Dec 05 16:49:04 2008 +0000
@@ -51,11 +51,15 @@
 	CB_teamsDivide->setText(QCheckBox::tr("Divide teams"));
 	GBoxOptionsLayout->addWidget(CB_teamsDivide, 1, 0, 1, 2);
 
+	CB_solid = new QCheckBox(GBoxOptions);
+	CB_solid->setText(QCheckBox::tr("Solid land"));
+	GBoxOptionsLayout->addWidget(CB_solid, 2, 0, 1, 2);
+
 	L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions);
 	L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions);
-	GBoxOptionsLayout->addWidget(L_TurnTime, 2, 0);
-	GBoxOptionsLayout->addWidget(L_InitHealth, 3, 0);
-	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 4, 0);
+	GBoxOptionsLayout->addWidget(L_TurnTime, 3, 0);
+	GBoxOptionsLayout->addWidget(L_InitHealth, 4, 0);
+	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 5, 0);
 
 	SB_TurnTime = new QSpinBox(GBoxOptions);
 	SB_TurnTime->setRange(1, 99);
@@ -66,16 +70,17 @@
 	SB_InitHealth->setRange(50, 200);
 	SB_InitHealth->setValue(100);
 	SB_InitHealth->setSingleStep(25);
-	GBoxOptionsLayout->addWidget(SB_TurnTime, 2, 1);
-	GBoxOptionsLayout->addWidget(SB_InitHealth, 3, 1);
+	GBoxOptionsLayout->addWidget(SB_TurnTime, 3, 1);
+	GBoxOptionsLayout->addWidget(SB_InitHealth, 4, 1);
 	
 	WeaponsName = new QComboBox(GBoxOptions);
-	GBoxOptionsLayout->addWidget(WeaponsName, 4, 1);
+	GBoxOptionsLayout->addWidget(WeaponsName, 5, 1);
 
 	connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
 	connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
 	connect(CB_mode_Forts, SIGNAL(toggled(bool)), this, SIGNAL(fortsModeChanged(bool)));
 	connect(CB_teamsDivide, SIGNAL(toggled(bool)), this, SIGNAL(teamsDivideChanged(bool)));
+	connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
 	connect(WeaponsName, SIGNAL(activated(const QString&)), this, SIGNAL(newWeaponsName(const QString&)));
 
 	connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SIGNAL(seedChanged(const QString &)));
@@ -91,6 +96,8 @@
 		result |= 0x01;
 	if (CB_teamsDivide->isChecked())
 		result |= 0x10;
+	if (CB_solid->isChecked())
+		result |= 0x04;
 
 	return result;
 }
@@ -168,6 +175,11 @@
 	CB_teamsDivide->setChecked(value);
 }
 
+void GameCFGWidget::setSolid(bool value)
+{
+	CB_solid->setChecked(value);
+}
+
 void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo)
 {
 	if (ammo.size() != cDefaultAmmoStore->size() - 10)
@@ -181,4 +193,4 @@
 		WeaponsName->setItemData(pos, ammo);
 		WeaponsName->setCurrentIndex(pos);
 	}
-	}
+}
--- a/QTfrontend/gamecfgwidget.h	Fri Dec 05 13:48:29 2008 +0000
+++ b/QTfrontend/gamecfgwidget.h	Fri Dec 05 16:49:04 2008 +0000
@@ -54,6 +54,7 @@
 	void setTurnTime(int time);
 	void setFortsMode(bool value);
 	void setTeamsDivide(bool value);
+	void setSolid(bool value);
 	void setNetAmmo(const QString& name, const QString& ammo);
 
 signals:
@@ -64,11 +65,13 @@
 	void turnTimeChanged(int time);
 	void fortsModeChanged(bool value);
 	void teamsDivideChanged(bool value);
+	void solidChanged(bool value);
 	void newWeaponsName(const QString& weapon);
 
 private:
 	QCheckBox * CB_mode_Forts;
 	QCheckBox * CB_teamsDivide;
+	QCheckBox * CB_solid;
 	QGridLayout mainLayout;
 	HWMapContainer* pMapContainer;
 	QSpinBox * SB_TurnTime;
--- a/QTfrontend/hwform.cpp	Fri Dec 05 13:48:29 2008 +0000
+++ b/QTfrontend/hwform.cpp	Fri Dec 05 16:49:04 2008 +0000
@@ -501,6 +501,7 @@
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(turnTimeChanged(int)), hwnet, SLOT(onTurnTimeChanged(int)));
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(fortsModeChanged(bool)), hwnet, SLOT(onFortsModeChanged(bool)));
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(teamsDivideChanged(bool)), hwnet, SLOT(onTeamsDivideChanged(bool)));
+	connect(ui.pageNetGame->pGameCFG, SIGNAL(solidChanged(bool)), hwnet, SLOT(onSolidChanged(bool)));
 
 	connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()));
 	connect(hwnet, SIGNAL(seedChanged(const QString &)), ui.pageNetGame->pGameCFG, SLOT(setSeed(const QString &)));
@@ -510,6 +511,7 @@
 	connect(hwnet, SIGNAL(turnTimeChanged(int)), ui.pageNetGame->pGameCFG, SLOT(setTurnTime(int)));
 	connect(hwnet, SIGNAL(fortsModeChanged(bool)), ui.pageNetGame->pGameCFG, SLOT(setFortsMode(bool)));
 	connect(hwnet, SIGNAL(teamsDivideChanged(bool)), ui.pageNetGame->pGameCFG, SLOT(setTeamsDivide(bool)));
+	connect(hwnet, SIGNAL(solidChanged(bool)), ui.pageNetGame->pGameCFG, SLOT(setSolid(bool)));
 	connect(hwnet, SIGNAL(hhnumChanged(const HWTeam&)),
 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&)));
 	connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
--- a/QTfrontend/newnetclient.cpp	Fri Dec 05 13:48:29 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Fri Dec 05 16:49:04 2008 +0000
@@ -405,6 +405,10 @@
 			emit teamsDivideChanged(lst[2].toInt() != 0);
 			return;
 		}
+		if (lst[1] == "SOLIDLAND") {
+			emit solidChanged(lst[2].toInt() != 0);
+			return;
+		}
 		if (lst[1] == "AMMO") {
 			if(lst.size() < 4) return;
 			emit ammoChanged(lst[3], lst[2]);
@@ -475,6 +479,7 @@
 	onTurnTimeChanged(m_pGameCFGWidget->getTurnTime());
 	onFortsModeChanged(m_pGameCFGWidget->getGameFlags() & 0x1);
 	onTeamsDivideChanged(m_pGameCFGWidget->getGameFlags() & 0x10);
+	onSolidChanged(m_pGameCFGWidget->getGameFlags() & 0x04);
 	// always initialize with default ammo (also avoiding complicated cross-class dependencies)
 	onWeaponsNameChanged("Default", cDefaultAmmoStore->mid(10));
 }
@@ -504,42 +509,47 @@
 
 void HWNewNet::onSeedChanged(const QString & seed)
 {
-  if (isChief) RawSendNet(QString("CONFIG_PARAM%1SEED%1%2").arg(delimeter).arg(seed));
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1SEED%1%2").arg(delimeter).arg(seed));
 }
 
 void HWNewNet::onMapChanged(const QString & map)
 {
-  if (isChief) RawSendNet(QString("MAP%1%2").arg(delimeter).arg(map));
+	if (isChief) RawSendNet(QString("MAP%1%2").arg(delimeter).arg(map));
 }
 
 void HWNewNet::onThemeChanged(const QString & theme)
 {
-  if (isChief) RawSendNet(QString("CONFIG_PARAM%1THEME%1%2").arg(delimeter).arg(theme));
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1THEME%1%2").arg(delimeter).arg(theme));
 }
 
 void HWNewNet::onInitHealthChanged(int health)
 {
-  if (isChief) RawSendNet(QString("CONFIG_PARAM%1HEALTH%1%2").arg(delimeter).arg(health));
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1HEALTH%1%2").arg(delimeter).arg(health));
 }
 
 void HWNewNet::onTurnTimeChanged(int time)
 {
-  if (isChief) RawSendNet(QString("CONFIG_PARAM%1TURNTIME%1%2").arg(delimeter).arg(time));
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1TURNTIME%1%2").arg(delimeter).arg(time));
 }
 
 void HWNewNet::onFortsModeChanged(bool value)
 {
-  if (isChief) RawSendNet(QString("CONFIG_PARAM%1FORTSMODE%1%2").arg(delimeter).arg(value));
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1FORTSMODE%1%2").arg(delimeter).arg(value));
 }
 
 void HWNewNet::onTeamsDivideChanged(bool value)
 {
-  if (isChief) RawSendNet(QString("CONFIG_PARAM%1DIVIDETEAMS%1%2").arg(delimeter).arg(value));
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1DIVIDETEAMS%1%2").arg(delimeter).arg(value));
+}
+
+void HWNewNet::onSolidChanged(bool value)
+{
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1SOLIDLAND%1%2").arg(delimeter).arg(value));
 }
 
 void HWNewNet::onWeaponsNameChanged(const QString& name, const QString& ammo)
 {
-  if (isChief) RawSendNet(QString("CONFIG_PARAM%1AMMO%1%2%1%3").arg(delimeter).arg(ammo).arg(name));
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1AMMO%1%2%1%3").arg(delimeter).arg(ammo).arg(name));
 }
 
 void HWNewNet::chatLineToNet(const QString& str)
--- a/QTfrontend/newnetclient.h	Fri Dec 05 13:48:29 2008 +0000
+++ b/QTfrontend/newnetclient.h	Fri Dec 05 16:49:04 2008 +0000
@@ -104,6 +104,7 @@
   void turnTimeChanged(int time);
   void fortsModeChanged(bool value);
   void teamsDivideChanged(bool value);
+  void solidChanged(bool value);
   void hhnumChanged(const HWTeam&);
   void teamColorChanged(const HWTeam&);
   void chatStringFromNet(const QString&);
@@ -129,6 +130,7 @@
   void onTurnTimeChanged(int time);
   void onFortsModeChanged(bool value);
   void onTeamsDivideChanged(bool value);
+  void onSolidChanged(bool value);
   void onHedgehogsNumChanged(const HWTeam& team);
   void onTeamColorChanged(const HWTeam& team);
   void onWeaponsNameChanged(const QString& name, const QString& ammo);
--- a/hedgewars/uMisc.pas	Fri Dec 05 13:48:29 2008 +0000
+++ b/hedgewars/uMisc.pas	Fri Dec 05 16:49:04 2008 +0000
@@ -50,7 +50,7 @@
 	cWaterLine       : LongInt = 1024;
 	cVisibleWater    : LongInt = 128;
 	cGearScrEdgesDist: LongInt = 240;
-	cCursorEdgesDist : LongInt = 40;
+	cCursorEdgesDist : LongInt = 100;
 	cTeamHealthWidth : LongInt = 128;
 	cAltDamage       : boolean = true;