hedgewars/ArgParsers.inc
changeset 3858 e40e5dfe9d5b
parent 3709 c7849b74748d
child 4004 b1c2c2f6fc5e
--- a/hedgewars/ArgParsers.inc	Mon Sep 13 12:29:02 2010 -0400
+++ b/hedgewars/ArgParsers.inc	Mon Sep 13 18:53:50 2010 -0400
@@ -4,7 +4,7 @@
     val(ParamStr(2), ipcPort);
     GameType:= gmtLandPreview;
     if ParamStr(3) <> 'landpreview' then
-        GameType:= gmtSyntax;
+        GameType:= gmtSyntax
 end;
 
 procedure internalStartGameWithParameters();
@@ -23,15 +23,14 @@
     cAltDamage:= ParamStr(13) = '1';
     UserNick:= DecodeBase64(ParamStr(14));
     val(ParamStr(15), cReducedQuality);
-    cLocaleFName:= ParamStr(16);
-
+    cLocaleFName:= ParamStr(16)
 end;
 
 procedure setVideo(screenWidth: LongInt; screenHeight: LongInt; bitsStr: LongInt);
 begin
     cScreenWidth:= screenWidth;
     cScreenHeight:= screenHeight;
-    cBits:= bitsStr;
+    cBits:= bitsStr
 end;
 
 procedure setVideoWithParameters(screenWidthParam: string; screenHeightParam: string; bitsParam: string);
@@ -40,18 +39,18 @@
     val(screenWidthParam, screenWidthAsInt);
     val(screenHeightParam, screenHeightAsInt);
     val(bitsParam, bitsStrAsInt);
-    setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt);
+    setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt)
 end;
 
 procedure setOtherOptions(languageFile: string; fullScreen: boolean);
 begin
     cLocaleFName:= languageFile;
-    cFullScreen:= fullScreen;
+    cFullScreen:= fullScreen
 end;
 
 procedure setShowFPS(showFPS: boolean);
 begin
-    cShowFPS:= showFPS;
+    cShowFPS:= showFPS
 end;
 
 procedure setOtherOptionsWithParameters(languageFileParam: string; fullScreenParam: string; showFPSParam: string);
@@ -60,14 +59,14 @@
     fullScreen:= fullScreenParam = '1';
     showFPS:= showFPSParam = '1';
     setOtherOptions(languageFileParam,fullScreen);
-    setShowFPS(showFPS);
+    setShowFPS(showFPS)
 end;
 
 procedure setAudio(initialVolume: LongInt; musicEnabled: boolean; soundEnabled: boolean);
 begin
     cInitVolume:= initialVolume;
     isMusicEnabled:= musicEnabled;
-    isSoundEnabled:= soundEnabled; 
+    isSoundEnabled:= soundEnabled
 end;
 
 procedure setAudioWithParameters(initialVolumeParam: string; musicEnabledParam: string; soundEnabledParam: string);
@@ -77,7 +76,7 @@
     val(initialVolumeParam, initialVolumeAsInt);
     musicEnabled:= musicEnabledParam = '1';
     soundEnabled:= soundEnabledParam = '1';
-    setAudio(initialVolumeAsInt,musicEnabled, soundEnabled);
+    setAudio(initialVolumeAsInt,musicEnabled, soundEnabled)
 end;
 
 procedure setMultimediaOptionsWithParameters(screenWidthParam, screenHeightParam, bitsParam: string;
@@ -86,7 +85,7 @@
 begin
     setVideoWithParameters(screenWidthParam,screenHeightParam, bitsParam);
     setAudioWithParameters(initialVolumeParam,musicEnabledParam,soundEnabledParam);
-    setOtherOptions(languageFileParam,fullScreenParam = '1');
+    setOtherOptions(languageFileParam,fullScreenParam = '1')
 end;
 
 procedure setAltDamageTimerValueAndQuality(altDamage: boolean; timeIterval: LongInt; reducedQuality: boolean);
@@ -99,21 +98,21 @@
 
 procedure setAllOptionsWithParameters(screenWidthParam:string; screenHeightParam:string; bitsParam:string;
                                       initialVolumeParam:string; musicEnabledParam:string; soundEnabledParam:string;
-                                      languageFileParam:string; fullScreenParam:string; showFPSParam:string; 
+                                      languageFileParam:string; fullScreenParam:string; showFPSParam:string;
                                       altDamageParam:string; timeItervalParam:string; reducedQualityParam: string);
 var showFPS, altDamage, reducedQuality: boolean;
     timeIterval: LongInt;
 begin
     setMultimediaOptionsWithParameters(screenWidthParam,screenHeightParam, bitsParam,
                                        initialVolumeParam,musicEnabledParam,soundEnabledParam,
-                                       languageFileParam,fullScreenParam);                       
+                                       languageFileParam,fullScreenParam);
     showFPS := showFPSParam = '1';
     setShowFPS(showFPS);
-    
+
     altDamage:= altDamageParam = '1';
     val(timeItervalParam, timeIterval);
     reducedQuality:= reducedQualityParam = '1';
-    setAltDamageTimerValueAndQuality(altDamage,timeIterval,reducedQuality);    
+    setAltDamageTimerValueAndQuality(altDamage,timeIterval,reducedQuality);
 end;
 
 procedure playReplayFileWithParameters();
@@ -125,76 +124,76 @@
     paramIndex:= 3;
     wrongParameter:= false;
     while (paramIndex <= ParamCount) and not wrongParameter do
-    begin
-        //--set-video [screen width] [screen height] [color dept]
-        if(ParamStr(paramIndex) = '--set-video') then
         begin
-	    if(ParamCount-paramIndex < 3) then
-	    begin
-	        wrongParameter:= true;
-	        GameType:= gmtSyntax;
-	    end;
-	    setVideoWithParameters(ParamStr(paramIndex+1), ParamStr(paramIndex+2), ParamStr(paramIndex+3));
-	    paramIndex:= paramIndex + 4;
-        end 
-        else 
-        //--set-audio [volume] [enable music] [enable sounds]
-        if(ParamStr(paramIndex) = '--set-audio') then
-        begin
-    	    if(ParamCount-paramIndex < 3) then
-	    begin
-	        wrongParameter := true;
-	        GameType:= gmtSyntax;
-	    end;
-	    setAudioWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
-	    paramIndex:= paramIndex + 4;
-        end 
-        else 
-        // --set-other [language file] [full screen] [show FPS]
-        if(ParamStr(paramIndex) = '--set-other') then
-        begin
+        if ParamStr(paramIndex) = '--set-video'  then
+//--set-video [screen width] [screen height] [color dept]
+            begin
             if(ParamCount-paramIndex < 3) then
-            begin
+                begin
                 wrongParameter:= true;
-                GameType:= gmtSyntax;
-	    end;
-	    setOtherOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
-	    paramIndex:= paramIndex + 4;
-	end 
-	else 
-	//--set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]
-	if(ParamStr(paramIndex) = '--set-multimedia') then
-	begin
-	    if(ParamCount-paramIndex < 8) then
-	    begin
-	        wrongParameter:= true;
-	        GameType:= gmtSyntax;
-	    end;
-	    setMultimediaOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
-		   			       ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
-					       ParamStr(paramIndex+7),ParamStr(paramIndex+8));
-	    paramIndex:= paramIndex + 9;
-        end 
+                GameType:= gmtSyntax
+                end;
+            setVideoWithParameters(ParamStr(paramIndex+1), ParamStr(paramIndex+2), ParamStr(paramIndex+3));
+            paramIndex:= paramIndex + 4
+            end
         else
-        //--set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]
-        if(ParamStr(paramIndex) = '--set-everything') then
-        begin
-	    if(ParamCount-paramIndex < 12) then
-	    begin
-	        wrongParameter:= true;
-	        GameType:= gmtSyntax;
-	    end;
-	    setAllOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
-				        ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
-				        ParamStr(paramIndex+7),ParamStr(paramIndex+8),ParamStr(paramIndex+9),
-				        ParamStr(paramIndex+10),ParamStr(paramIndex+11),ParamStr(paramIndex+12));
-	    paramIndex:= paramIndex + 13;
-        end 
-        else
-        begin
-	    wrongParameter:= true;
-	    GameType:= gmtSyntax;
-        end;
-    end;
+//--set-audio [volume] [enable music] [enable sounds]
+            if ParamStr(paramIndex) = '--set-audio'  then
+                begin
+                if(ParamCount-paramIndex < 3) then
+                    begin
+                    wrongParameter := true;
+                    GameType:= gmtSyntax
+                    end;
+                setAudioWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
+                paramIndex:= paramIndex + 4
+                end
+            else
+// --set-other [language file] [full screen] [show FPS]
+                if ParamStr(paramIndex) = '--set-other'  then
+                    begin
+                    if(ParamCount-paramIndex < 3) then
+                        begin
+                        wrongParameter:= true;
+                        GameType:= gmtSyntax
+                        end;
+                    setOtherOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
+                    paramIndex:= paramIndex + 4
+                    end
+                else
+//--set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]
+                    if ParamStr(paramIndex) = '--set-multimedia'  then
+                        begin
+                        if ParamCount-paramIndex < 8  then
+                            begin
+                            wrongParameter:= true;
+                            GameType:= gmtSyntax
+                            end;
+                        setMultimediaOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
+                                                           ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
+                                                           ParamStr(paramIndex+7),ParamStr(paramIndex+8));
+                        paramIndex:= paramIndex + 9
+                        end
+                    else
+//--set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]
+                        if ParamStr(paramIndex) = '--set-everything'  then
+                            begin
+                            if ParamCount-paramIndex < 12  then
+                                begin
+                                wrongParameter:= true;
+                                GameType:= gmtSyntax
+                                end;
+                            setAllOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
+                                                        ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
+                                                        ParamStr(paramIndex+7),ParamStr(paramIndex+8),ParamStr(paramIndex+9),
+                                                        ParamStr(paramIndex+10),ParamStr(paramIndex+11),ParamStr(paramIndex+12));
+                            paramIndex:= paramIndex + 13
+                            end
+                        else
+                            begin
+                            wrongParameter:= true;
+                            GameType:= gmtSyntax
+                            end
+    end
 end;