Apply nemo's patch polished by me:
authorunc0rr
Sun, 01 Feb 2009 15:58:44 +0000
changeset 1784 dfe9bafb4590
parent 1783 169ebeefd7ab
child 1785 26c28fa8f56c
Apply nemo's patch polished by me: - Upto 48 hhs in game - Option for border - Disable some weapons on cavern maps
QTfrontend/frameTeam.cpp
QTfrontend/gamecfgwidget.cpp
QTfrontend/gamecfgwidget.h
QTfrontend/hedgehogerWidget.cpp
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
hedgewars/GSHandlers.inc
hedgewars/hwengine.dpr
hedgewars/uAmmos.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uLand.pas
hedgewars/uLandTemplates.pas
hedgewars/uMisc.pas
netserver/HWProto.hs
--- a/QTfrontend/frameTeam.cpp	Sat Jan 31 15:44:07 2009 +0000
+++ b/QTfrontend/frameTeam.cpp	Sun Feb 01 15:58:44 2009 +0000
@@ -25,7 +25,7 @@
 #include "hwconsts.h"
 
 FrameTeams::FrameTeams(QWidget* parent) :
-  QFrame(parent), maxHedgehogsPerGame(18), overallHedgehogs(0), mainLayout(this), nonInteractive(false)
+  QFrame(parent), maxHedgehogsPerGame(48), overallHedgehogs(0), mainLayout(this), nonInteractive(false)
 {
 	QPalette newPalette = palette();
 	newPalette.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
--- a/QTfrontend/gamecfgwidget.cpp	Sat Jan 31 15:44:07 2009 +0000
+++ b/QTfrontend/gamecfgwidget.cpp	Sun Feb 01 15:58:44 2009 +0000
@@ -55,15 +55,19 @@
 	CB_solid->setText(QCheckBox::tr("Solid land"));
 	GBoxOptionsLayout->addWidget(CB_solid, 2, 0, 1, 2);
 
+	CB_border = new QCheckBox(GBoxOptions);
+	CB_border->setText(QCheckBox::tr("Add Border"));
+	GBoxOptionsLayout->addWidget(CB_border, 3, 0, 1, 2);
+
 	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);
-	GBoxOptionsLayout->addWidget(L_TurnTime, 3, 0);
-	GBoxOptionsLayout->addWidget(L_InitHealth, 4, 0);
-	GBoxOptionsLayout->addWidget(L_SuddenDeath, 5, 0);
-	GBoxOptionsLayout->addWidget(L_CaseProb, 6, 0);
-	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 7, 0);
+	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);
 
 	SB_TurnTime = new QSpinBox(GBoxOptions);
 	SB_TurnTime->setRange(1, 99);
@@ -84,13 +88,13 @@
 	SB_CaseProb->setRange(0, 9);
 	SB_CaseProb->setValue(5);
 
-	GBoxOptionsLayout->addWidget(SB_TurnTime, 3, 1);
-	GBoxOptionsLayout->addWidget(SB_InitHealth, 4, 1);
-	GBoxOptionsLayout->addWidget(SB_SuddenDeath, 5, 1);
-	GBoxOptionsLayout->addWidget(SB_CaseProb, 6, 1);
+	GBoxOptionsLayout->addWidget(SB_TurnTime, 4, 1);
+	GBoxOptionsLayout->addWidget(SB_InitHealth, 5, 1);
+	GBoxOptionsLayout->addWidget(SB_SuddenDeath, 6, 1);
+	GBoxOptionsLayout->addWidget(SB_CaseProb, 7, 1);
 	
 	WeaponsName = new QComboBox(GBoxOptions);
-	GBoxOptionsLayout->addWidget(WeaponsName, 7, 1);
+	GBoxOptionsLayout->addWidget(WeaponsName, 8, 1);
 
 	connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
 	connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
@@ -99,6 +103,7 @@
 	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(CB_border, SIGNAL(toggled(bool)), this, SIGNAL(borderChanged(bool)));
 	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
 
 	connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SIGNAL(seedChanged(const QString &)));
@@ -116,6 +121,8 @@
 		result |= 0x10;
 	if (CB_solid->isChecked())
 		result |= 0x04;
+	if (CB_border->isChecked())
+		result |= 0x08;
 
 	return result;
 }
@@ -221,6 +228,11 @@
 	CB_solid->setChecked(value);
 }
 
+void GameCFGWidget::setBorder(bool value)
+{
+	CB_border->setChecked(value);
+}
+
 void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo)
 {
 	if (ammo.size() != cDefaultAmmoStore->size())
--- a/QTfrontend/gamecfgwidget.h	Sat Jan 31 15:44:07 2009 +0000
+++ b/QTfrontend/gamecfgwidget.h	Sun Feb 01 15:58:44 2009 +0000
@@ -81,6 +81,7 @@
 	void setFortsMode(bool value);
 	void setTeamsDivide(bool value);
 	void setSolid(bool value);
+	void setBorder(bool value);
 	void setNetAmmo(const QString& name, const QString& ammo);
 
 signals:
@@ -94,6 +95,7 @@
 	void fortsModeChanged(bool value);
 	void teamsDivideChanged(bool value);
 	void solidChanged(bool value);
+	void borderChanged(bool value);
 	void newWeaponScheme(const QString & name, const QString & ammo);
 
 private slots:
@@ -103,6 +105,7 @@
 	QCheckBox * CB_mode_Forts;
 	QCheckBox * CB_teamsDivide;
 	QCheckBox * CB_solid;
+	QCheckBox * CB_border;
 	QGridLayout mainLayout;
 	HWMapContainer* pMapContainer;
 	QSpinBox * SB_TurnTime;
--- a/QTfrontend/hedgehogerWidget.cpp	Sat Jan 31 15:44:07 2009 +0000
+++ b/QTfrontend/hedgehogerWidget.cpp	Sun Feb 01 15:58:44 2009 +0000
@@ -34,7 +34,7 @@
 
 void CHedgehogerWidget::incItems()
 {
-  if (pOurFrameTeams->overallHedgehogs < 18) {
+  if (pOurFrameTeams->overallHedgehogs < pOurFrameTeams->maxHedgehogsPerGame) {
     numItems++;
     pOurFrameTeams->overallHedgehogs++;
     emit hedgehogsNumChanged();
--- a/QTfrontend/hwform.cpp	Sat Jan 31 15:44:07 2009 +0000
+++ b/QTfrontend/hwform.cpp	Sun Feb 01 15:58:44 2009 +0000
@@ -528,6 +528,7 @@
 	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(ui.pageNetGame->pGameCFG, SIGNAL(borderChanged(bool)), hwnet, SLOT(onBorderChanged(bool)));
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(newWeaponScheme(const QString &, const QString &)),
 			hwnet, SLOT(onWeaponsNameChanged(const QString &, const QString &)));
 
@@ -542,6 +543,7 @@
 	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(borderChanged(bool)), ui.pageNetGame->pGameCFG, SLOT(setBorder(bool)));
 	connect(hwnet, SIGNAL(hhnumChanged(const HWTeam&)),
 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&)));
 	connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
--- a/QTfrontend/newnetclient.cpp	Sat Jan 31 15:44:07 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Sun Feb 01 15:58:44 2009 +0000
@@ -488,6 +488,10 @@
 			emit solidChanged(lst[2].toInt() != 0);
 			return;
 		}
+		if (lst[1] == "BORDER") {
+			emit borderChanged(lst[2].toInt() != 0);
+			return;
+		}
 		if (lst[1] == "AMMO") {
 			if(lst.size() < 4) return;
 			emit ammoChanged(lst[3], lst[2]);
@@ -562,6 +566,7 @@
 	onFortsModeChanged(m_pGameCFGWidget->getGameFlags() & 0x1);
 	onTeamsDivideChanged(m_pGameCFGWidget->getGameFlags() & 0x10);
 	onSolidChanged(m_pGameCFGWidget->getGameFlags() & 0x04);
+	onBorderChanged(m_pGameCFGWidget->getGameFlags() & 0x08);
 	// always initialize with default ammo (also avoiding complicated cross-class dependencies)
 	QString name = m_pGameCFGWidget->WeaponsName->currentText();
 	QString ammo = m_pGameCFGWidget->WeaponsName->itemData(
@@ -643,6 +648,11 @@
 	if (isChief) RawSendNet(QString("CONFIG_PARAM%1SOLIDLAND%1%2").arg(delimeter).arg(value));
 }
 
+void HWNewNet::onBorderChanged(bool value)
+{
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1BORDER%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));
--- a/QTfrontend/newnetclient.h	Sat Jan 31 15:44:07 2009 +0000
+++ b/QTfrontend/newnetclient.h	Sun Feb 01 15:58:44 2009 +0000
@@ -111,6 +111,7 @@
   void fortsModeChanged(bool value);
   void teamsDivideChanged(bool value);
   void solidChanged(bool value);
+  void borderChanged(bool value);
   void hhnumChanged(const HWTeam&);
   void teamColorChanged(const HWTeam&);
   void chatStringLobby(const QString&);
@@ -143,6 +144,7 @@
   void onFortsModeChanged(bool value);
   void onTeamsDivideChanged(bool value);
   void onSolidChanged(bool value);
+  void onBorderChanged(bool value);
   void onHedgehogsNumChanged(const HWTeam& team);
   void onTeamColorChanged(const HWTeam& team);
   void onWeaponsNameChanged(const QString& name, const QString& ammo);
--- a/hedgewars/GSHandlers.inc	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Feb 01 15:58:44 2009 +0000
@@ -616,7 +616,7 @@
               Gear^.dX, Gear^.dY,
               cHHRadius * 5, cHHRadius * 2 + 7);
 
-if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) then
+if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) or (Land[hwRound(HHGear^.Y), hwRound(HHGear^.X + Gear^.dX * 32)] = COLOR_INDESTRUCTIBLE) then
 	begin
 	HHGear^.Message:= 0;
 	HHGear^.State:= HHGear^.State and (not gstNotKickable);
@@ -1379,7 +1379,7 @@
 	Gear^.X:= int2hwFloat(LAND_WIDTH + 1024);
 	end;
 
-Gear^.Y:= -_300;  // TODO - consider making this proportional to topY to reduce spread on low maps
+Gear^.Y:= int2hwFloat(topY-300);
 Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15);
 
 if int2hwFloat(TargetPoint.Y) - Gear^.Y > _0 then
@@ -1930,7 +1930,8 @@
 if (Gear^.Timer = 0)
 or (t^.Count <> 0)
 or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
-and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then
+and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))
+or (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] = COLOR_INDESTRUCTIBLE) then
 	begin //out of time or exited ground
 	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
 	DeleteGear(Gear);
--- a/hedgewars/hwengine.dpr	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/hwengine.dpr	Sun Feb 01 15:58:44 2009 +0000
@@ -76,6 +76,7 @@
 			GameState:= gsStart;
 			end;
 	gsStart: begin
+			if HasBorder then DisableSomeWeapons;
 			AddClouds;
 			AssignHHCoords;
 			AddMiscGears;
--- a/hedgewars/uAmmos.pas	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/uAmmos.pas	Sun Feb 01 15:58:44 2009 +0000
@@ -30,6 +30,7 @@
 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
 procedure SwitchNotHoldedAmmo(var Hedgehog: THedgehog);
 procedure SetWeapon(weap: TAmmoType);
+procedure DisableSomeWeapons;
 
 implementation
 uses uMisc, uGears, uWorld, uLocale, uConsole;
@@ -227,4 +228,22 @@
 ParseCommand('/setweap ' + char(weap), true)
 end;
 
+procedure DisableSomeWeapons;
+var i, slot, a: Longword;
+	t: TAmmoType;
+begin
+for i:= 0 to Pred(StoreCnt) do
+	for slot:= 0 to cMaxSlotIndex do
+		begin
+		for a:= 0 to cMaxSlotAmmoIndex do
+			with StoresList[i]^[slot, a] do
+				if (Propz and ammoprop_NotBorder) <> 0 then Count:= 0;
+
+		PackAmmo(StoresList[i], slot)
+		end;
+
+for t:= Low(TAmmoType) to High(TAmmoType) do
+	if (Ammoz[t].Ammo.Propz and ammoprop_NotBorder) <> 0 then Ammoz[t].Probability:= 0
+end;
+
 end.
--- a/hedgewars/uConsts.pas	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/uConsts.pas	Sun Feb 01 15:58:44 2009 +0000
@@ -157,7 +157,7 @@
 
 	cMaxTeams        = 6;
 	cMaxHHIndex      = 7;
-	cMaxHHs          = 30;
+	cMaxHHs          = 48;
 	cMaxSpawnPoints  = 1024;
 
 	cMaxEdgePoints = 16384;
@@ -181,6 +181,7 @@
 	gfForts       = $00000001;
 	gfMultiWeapon = $00000002;
 	gfSolidLand   = $00000004;
+	gfBorder      = $00000008;
 	gfDivideTeams = $00000010;
 	gfOneClanMode = $10000000;
 
@@ -231,6 +232,7 @@
 	ammoprop_DontHold     = $00000100;
 	ammoprop_AltAttack    = $00000200;
 	ammoprop_AltUse       = $00000400;
+	ammoprop_NotBorder    = $00000800;
 
 	AMMO_INFINITE = 9;
 
@@ -852,7 +854,8 @@
 			Ammo: (Propz: ammoprop_NoCrosshair or
 							ammoprop_NeedTarget or
 							ammoprop_AttackingPut or
-							ammoprop_DontHold;
+							ammoprop_DontHold or
+							ammoprop_NotBorder;
 					Count: 1;
 					NumPerTurn: 0;
 					Timer: 0;
@@ -873,7 +876,8 @@
 			Ammo: (Propz: ammoprop_NoCrosshair or
 							ammoprop_NeedTarget or
 							ammoprop_AttackingPut or
-							ammoprop_DontHold;
+							ammoprop_DontHold or
+							ammoprop_NotBorder;
 					Count: 1;
 					NumPerTurn: 0;
 					Timer: 0;
@@ -1089,7 +1093,8 @@
 			Ammo: (Propz: ammoprop_NoCrosshair or
 							ammoprop_NeedTarget or
 							ammoprop_AttackingPut or
-							ammoprop_DontHold;
+							ammoprop_DontHold or
+							ammoprop_NotBorder;
 					Count: 1;
 					NumPerTurn: 0;
 					Timer: 0;
--- a/hedgewars/uGears.pas	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/uGears.pas	Sun Feb 01 15:58:44 2009 +0000
@@ -1347,7 +1347,7 @@
 								FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil
 								if Gear <> nil then
 									begin
-									Gear^.Pos:= GetRandom(19);
+									Gear^.Pos:= GetRandom(49);
 									Gear^.dX.isNegative:= p = 1;
 									end
 								end;
--- a/hedgewars/uLand.pas	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/uLand.pas	Sun Feb 01 15:58:44 2009 +0000
@@ -41,7 +41,7 @@
 procedure RealLandTexUpdate;
 
 implementation
-uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO;
+uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uAmmos;
 
 type TPixAr = record
               Count: Longword;
@@ -584,9 +584,9 @@
 procedure MakeFortsMap;
 var tmpsurf: PSDL_Surface;
 begin
-// For now, defining a fort's playable area as 4096x1536 - there are no tall forts.  The extra height is to avoid triggering border with current code, also if user turns on a border, it'll give a bit more maneuvering room.
-playHeight:= 1536;
-playWidth:= 4096;
+// For now, defining a fort's playable area as 3072x1200 - there are no tall forts.  The extra height is to avoid triggering border with current code, also if user turns on a border, it'll give a bit more maneuvering room.
+playHeight:= 1200;
+playWidth:= 3072;
 leftX:= (LAND_WIDTH - playWidth) div 2;
 rightX:= ((playWidth + (LAND_WIDTH - playWidth) div 2) - 1);
 topY:= LAND_HEIGHT - playHeight;
@@ -594,11 +594,11 @@
 WriteLnToConsole('Generating forts land...');
 
 tmpsurf:= LoadImage(Pathz[ptForts] + '/' + ClansArray[0]^.Teams[0]^.FortName + 'L', true, true, true);
-BlitImageAndGenerateCollisionInfo(0, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf);
+BlitImageAndGenerateCollisionInfo(leftX+150, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf);
 SDL_FreeSurface(tmpsurf);
 
 tmpsurf:= LoadImage(Pathz[ptForts] + '/' + ClansArray[1]^.Teams[0]^.FortName + 'R', true, true, true);
-BlitImageAndGenerateCollisionInfo(LAND_WIDTH - tmpsurf^.w, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf);
+BlitImageAndGenerateCollisionInfo(rightX - 150 - tmpsurf^.w, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf);
 SDL_FreeSurface(tmpsurf);
 end;
 
@@ -628,8 +628,7 @@
 end;
 
 procedure GenMap;
-var i, j, t: LongInt;
-	x, y, w, c: Longword;
+var x, y, w, c: Longword;
 begin
 hasBorder:= false;
 hasGirders:= true;
@@ -644,59 +643,54 @@
 {$IFDEF DEBUGFILE}LogLandDigest;{$ENDIF}
 
 // check for land near top
-for y:= topY to topY + 5 do
-    for x:= leftX to rightX do
-		if Land[y, x] <> 0 then
-			begin
-			hasBorder:= true;
-			break;
-			end;
+c:= 0;
+if (GameFlags and gfBorder) <> 0 then
+    hasBorder:= true
+else
+    for y:= topY to topY + 5 do
+        for x:= leftX to rightX do
+            if Land[y, x] <> 0 then
+                begin
+                inc(c);
+                if c > 200 then // avoid accidental triggering
+                    begin
+                    hasBorder:= true;
+                    break;
+                    end;
+                end;
 
 if hasBorder then
 	begin
-    for y:= 0 to LAND_HEIGHT - 1 do
-        for x:= 0 to LAND_WIDTH - 1 do
-            if (y < topY) or (x < leftX) or (x > rightX) then
-                Land[y, x]:= COLOR_INDESTRUCTIBLE;
+	for y:= 0 to LAND_HEIGHT - 1 do
+		for x:= 0 to LAND_WIDTH - 1 do
+			if (y < topY) or (x < leftX) or (x > rightX) then
+				Land[y, x]:= COLOR_INDESTRUCTIBLE;
 	// experiment hardcoding cave
-    // also try basing cave dimensions on map/template dimensions, if they exist
-    for w:= 0 to 5 do // width of 3 allowed worms to be knocked through with grenade
-        begin
-        for y:= topY to LAND_HEIGHT - 1 do
-            begin
-            Land[y, leftX + w]:= COLOR_INDESTRUCTIBLE;
-            Land[y, rightX - w]:= COLOR_INDESTRUCTIBLE;
-            if y mod 32 < 16 then c:= $FF000000
-            else c:= $FF00FFFF;
-            LandPixels[y, leftX + w]:= c;
-            LandPixels[y, rightX - w]:= c;
-            end;
+	// also try basing cave dimensions on map/template dimensions, if they exist
+	for w:= 0 to 5 do // width of 3 allowed worms to be knocked through with grenade
+		begin
+		for y:= topY to LAND_HEIGHT - 1 do
+			begin
+			Land[y, leftX + w]:= COLOR_INDESTRUCTIBLE;
+			Land[y, rightX - w]:= COLOR_INDESTRUCTIBLE;
+			if (y + w) mod 32 < 16 then
+				c:= $FF000000
+			else
+				c:= $FF00FFFF;
+			LandPixels[y, leftX + w]:= c;
+			LandPixels[y, rightX - w]:= c;
+			end;
 
-        for x:= leftX to rightX do
-            begin
-            Land[topY + w, x]:= COLOR_INDESTRUCTIBLE;
-            if x mod 32 < 16 then c:= $FF000000
-            else c:= $FF00FFFF;
-            LandPixels[topY + w, x]:= c;
-            end;
-        end;
-     // This is almost certainly not the right place to do this
-     // I just want it to be disabled after a border is added, which could by by map constraints as well as player desire
-     t:= 0;
-     while (t < cMaxTeams) and (TeamsArray[t] <> nil) do
-         begin
-         for i:= 0 to cMaxHHIndex do
-             if TeamsArray[t]^.Hedgehogs[i].Gear <> nil then
-                 begin
-                 for j:= 0 to cMaxSlotAmmoIndex do
-                     begin
-                     TeamsArray[t]^.Hedgehogs[i].Ammo^[Ammoz[amAirAttack].Slot, j].Count:= 0;
-                     TeamsArray[t]^.Hedgehogs[i].Ammo^[Ammoz[amMineStrike].Slot, j].Count:= 0;
-                     TeamsArray[t]^.Hedgehogs[i].Ammo^[Ammoz[amNapalm].Slot, j].Count:= 0;
-                     end;
-                 end;
-         inc(t);
-         end;
+		for x:= leftX to rightX do
+			begin
+			Land[topY + w, x]:= COLOR_INDESTRUCTIBLE;
+			if (x + w) mod 32 < 16 then
+				c:= $FF000000
+			else
+				c:= $FF00FFFF;
+			LandPixels[topY + w, x]:= c;
+			end;
+		end;
 	end;
 
 if ((GameFlags and gfForts) = 0) and (Pathz[ptMapCurrent] = '') then AddObjects;
--- a/hedgewars/uLandTemplates.pas	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/uLandTemplates.pas	Sun Feb 01 15:58:44 2009 +0000
@@ -35,6 +35,7 @@
                      TemplateHeight, TemplateWidth: Longword;
                      canMirror, canFlip, isNegative, canInvert: boolean;
                      hasGirders: boolean;
+                     MaxHedgeHogs: Longword;
                      end;
 
 //////////////////////////////////////////////////////////////////////////////
@@ -85,6 +86,7 @@
         TemplateHeight: 1024; TemplateWidth: 4096;
         canMirror: true; canFlip: false; isNegative: true; canInvert: false;
         hasGirders: false;  // this map, and some other caves, are cramped enough and have plenty of ceiling. Maybe not all caves though
+        MaxHedgehogs: 24;
        )
       );
 
--- a/hedgewars/uMisc.pas	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/uMisc.pas	Sun Feb 01 15:58:44 2009 +0000
@@ -37,7 +37,7 @@
 	GameType      : TGameType = gmtLocal;
 	GameFlags     : Longword = 0;
 	TurnTimeLeft  : Longword = 0;
-	cSuddenDTurns : Longword = 15;
+	cSuddenDTurns : LongInt = 15;
 	cHedgehogTurnTime: Longword = 45000;
 	cMaxAIThinkTime  : Longword = 9000;
 
--- a/netserver/HWProto.hs	Sat Jan 31 15:44:07 2009 +0000
+++ b/netserver/HWProto.hs	Sun Feb 01 15:58:44 2009 +0000
@@ -399,7 +399,7 @@
 		difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)
 		hhsList [] = []
 		hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
-		canAddNumber = 18 - (sum . map hhnum $ teams clRoom)
+		canAddNumber = 48 - (sum . map hhnum $ teams clRoom)
 		newTeamHHNum = min 4 canAddNumber
 
 handleCmd_inRoom client clients rooms ("ADD_TEAM" : name : color : grave : fort : difStr : hhsInfo) =
@@ -420,7 +420,7 @@
 		team = fromJust findTeam
 		findTeam = find (\t -> teamName == teamname t) $ teams clRoom
 		clRoom = roomByName (room client) rooms
-		canAddNumber = 18 - (sum . map hhnum $ teams clRoom)
+		canAddNumber = 48 - (sum . map hhnum $ teams clRoom)
 
 handleCmd_inRoom client _ rooms ["TEAM_COLOR", teamName, newColor] =
 	if not $ isMaster client then