- Set bamboo plinko hedgehogs limit to 48
authorunc0rr
Sat, 14 Feb 2009 16:54:28 +0000
changeset 1795 2457fcc0dcd9
parent 1794 8ae48e3b02d9
child 1796 4bcdf0bf58b8
- Set bamboo plinko hedgehogs limit to 48 - Better limit reading code
hedgewars/uGears.pas
hedgewars/uLand.pas
share/hedgewars/Data/Maps/BambooPlinko/map.cfg
--- a/hedgewars/uGears.pas	Sat Feb 14 16:51:10 2009 +0000
+++ b/hedgewars/uGears.pas	Sat Feb 14 16:54:28 2009 +0000
@@ -1380,7 +1380,7 @@
     // unC0Rr, while it is true user can watch value on map screen, IMO this (and check above) should be enforced in UI
     // - is there a good place to put values for the different widgets to check?  Right now they are kind of disconnected.
     //it'd be nice if divide teams, forts mode and hh per map could all be checked by the team widget, or maybe disable start button
-	TryDo(Count <= MaxHedgehogs, 'Too many hedgehogs for this map!', true);
+	TryDo(Count <= MaxHedgehogs, 'Too many hedgehogs for this map! (max # is ' + inttostr(MaxHedgehogs) + ')', true);
 	while (Count > 0) do
 		begin
 		i:= GetRandom(Count);
--- a/hedgewars/uLand.pas	Sat Feb 14 16:51:10 2009 +0000
+++ b/hedgewars/uLand.pas	Sat Feb 14 16:54:28 2009 +0000
@@ -640,11 +640,8 @@
 
 procedure LoadMap;
 var tmpsurf: PSDL_Surface;
-    s: string;
-    a,b: shortstring;
-    f: textfile;
-    tn: Longint;
-
+	s: string;
+	f: textfile;
 begin
 WriteLnToConsole('Loading land from file...');
 AddProgress;
@@ -656,9 +653,9 @@
 WriteLnToConsole('Fetching map HH limit');
 Assign(f, s);
 Reset(f);
-Readln(f, a);
-SplitBySpace(a,b);
-Val(b,MaxHedgehogs,tn);
+Readln(f);
+if not eof(f) then Readln(f, MaxHedgehogs);
+
 if(MaxHedgehogs = 0) then MaxHedgehogs:= 18;
 
 playHeight:= tmpsurf^.h;
--- a/share/hedgewars/Data/Maps/BambooPlinko/map.cfg	Sat Feb 14 16:51:10 2009 +0000
+++ b/share/hedgewars/Data/Maps/BambooPlinko/map.cfg	Sat Feb 14 16:54:28 2009 +0000
@@ -1,1 +1,2 @@
-Bamboo
\ No newline at end of file
+Bamboo
+48