- Fix infinite loop when selecting weapon with ammo menu
authorunc0rr
Sat, 18 Nov 2006 14:47:50 +0000
changeset 247 07605d2a2024
parent 246 107f7e826a83
child 248 aab204fe5061
- Fix infinite loop when selecting weapon with ammo menu - Play demo with doubleclick - Fix saving team binds :)
QTfrontend/game.cpp
QTfrontend/hwform.cpp
QTfrontend/team.cpp
hedgewars/uTeams.pas
--- a/QTfrontend/game.cpp	Fri Nov 17 13:36:58 2006 +0000
+++ b/QTfrontend/game.cpp	Sat Nov 18 14:47:50 2006 +0000
@@ -277,6 +277,7 @@
 {
 	QByteArray teamcfg;
 	HWTeam team(teamname);
+	team.LoadFromFile();
 	RawSendIPC(HWProto::addStringListToBuffer(teamcfg, team.TeamGameConfig(16776960, 4)));
 }
 
--- a/QTfrontend/hwform.cpp	Fri Nov 17 13:36:58 2006 +0000
+++ b/QTfrontend/hwform.cpp	Sat Nov 18 14:47:50 2006 +0000
@@ -63,6 +63,7 @@
 
 	connect(ui.pagePlayDemo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
 	connect(ui.pagePlayDemo->BtnPlayDemo,	SIGNAL(clicked()),	this, SLOT(PlayDemo()));
+	connect(ui.pagePlayDemo->DemosList,	SIGNAL(doubleClicked (const QModelIndex &)),	this, SLOT(PlayDemo()));
 
 	connect(ui.pageOptions->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
 	connect(ui.pageOptions->BtnNewTeam,	SIGNAL(clicked()),	this, SLOT(NewTeam()));
--- a/QTfrontend/team.cpp	Fri Nov 17 13:36:58 2006 +0000
+++ b/QTfrontend/team.cpp	Sat Nov 18 14:47:50 2006 +0000
@@ -182,7 +182,7 @@
 
 	Grave = hwform->ui.pageEditTeam->CBGrave->currentText();
 	Fort = hwform->ui.pageEditTeam->CBFort->currentText();
-	for(int i = 0; i < 8; i++)
+	for(int i = 0; i < BINDS_NUMBER; i++)
 	{
 		binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->currentText();
 	}
@@ -194,7 +194,7 @@
 	sl.push_back("eaddteam");
 	sl.push_back(QString("ecolor %1").arg(color));
 	sl.push_back("ename team " + TeamName);
-	for (int i = 0; i < 8; i++)
+	for (int i = 0; i < hedgehogs; i++)
 		sl.push_back(QString("ename hh%1 ").arg(i).append(HHName[i]));
 	sl.push_back(QString("egrave " + Grave));
 	sl.push_back(QString("efort " + Fort));
--- a/hedgewars/uTeams.pas	Fri Nov 17 13:36:58 2006 +0000
+++ b/hedgewars/uTeams.pas	Sat Nov 18 14:47:50 2006 +0000
@@ -349,11 +349,16 @@
 end;
 
 procedure SetWeapon(weap: TAmmoType);
+var t: integer;
 begin
+t:= cMaxSlotAmmoIndex;
 with CurrentTeam^ do
      with Hedgehogs[CurrHedgehog] do
-          while Ammo[CurSlot, CurAmmo].AmmoType <> weap do
+          while (Ammo[CurSlot, CurAmmo].AmmoType <> weap) and (t > 0) do
+                begin
                 ParseCommand('/slot ' + chr(49 + Ammoz[TAmmoType(weap)].Slot));
+                dec(t)
+                end
 end;
 
 initialization