# HG changeset patch # User unc0rr # Date 1390768422 -14400 # Node ID 8572d1f8b2f08a142911d06b14fc8d241a04971e # Parent ca67740f19b270c8cfec70a362e97d3b07ae5b78 Some love to pas2c diff -r ca67740f19b2 -r 8572d1f8b2f0 gameServer/NetRoutines.hs --- a/gameServer/NetRoutines.hs Sun Jan 26 10:20:42 2014 +0400 +++ b/gameServer/NetRoutines.hs Mon Jan 27 00:33:42 2014 +0400 @@ -30,7 +30,7 @@ sendChan' <- newChan uid <- newUnique - salt <- liftM (B.pack . Base64.encode . BW.unpack) $ hGetEntropy ch 16 + salt <- liftM (B.pack . Base64.encode . BW.unpack) $ hGetEntropy ch 18 let newClient = (ClientInfo diff -r ca67740f19b2 -r 8572d1f8b2f0 hedgewars/ArgParsers.pas --- a/hedgewars/ArgParsers.pas Sun Jan 26 10:20:42 2014 +0400 +++ b/hedgewars/ArgParsers.pas Mon Jan 27 00:33:42 2014 +0400 @@ -182,14 +182,14 @@ getstringParameter:= str; end; -procedure parseClassicParameter(cmdArray: array of string; size:LongInt; var paramIndex:LongInt); forward; +procedure parseClassicParameter(cmdarray: array of string; size:LongInt; var paramIndex:LongInt); forward; function parseParameter(cmd:string; arg:string; var paramIndex:LongInt): Boolean; -const videoArray: Array [1..5] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth'); - audioArray: Array [1..3] of string = ('--volume','--nomusic','--nosound'); - otherArray: Array [1..3] of string = ('--locale','--fullscreen','--showfps'); - mediaArray: Array [1..10] of string = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen'); - allArray: Array [1..18] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags'); +const videoarray: array [0..4] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth'); + audioarray: array [0..2] of string = ('--volume','--nomusic','--nosound'); + otherarray: array [0..2] of string = ('--locale','--fullscreen','--showfps'); + mediaarray: array [0..9] of string = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen'); + allarray: array [0..17] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags'); reallyAll: array[0..35] of shortstring = ( '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width', '--height', '--frame-interval', '--volume','--nomusic', '--nosound', @@ -227,11 +227,11 @@ {--nick} 17 : UserNick := parseNick( getstringParameter(arg, paramIndex, parseParameter) ); {deprecated options} {--depth} 18 : setDepth(paramIndex); - {--set-video} 19 : parseClassicParameter(videoArray,5,paramIndex); - {--set-audio} 20 : parseClassicParameter(audioArray,3,paramIndex); - {--set-other} 21 : parseClassicParameter(otherArray,3,paramIndex); - {--set-multimedia} 22 : parseClassicParameter(mediaArray,10,paramIndex); - {--set-everything} 23 : parseClassicParameter(allArray,14,paramIndex); + {--set-video} 19 : parseClassicParameter(videoarray,5,paramIndex); + {--set-audio} 20 : parseClassicParameter(audioarray,3,paramIndex); + {--set-other} 21 : parseClassicParameter(otherarray,3,paramIndex); + {--set-multimedia} 22 : parseClassicParameter(mediaarray,10,paramIndex); + {--set-everything} 23 : parseClassicParameter(allarray,14,paramIndex); {"internal" options} {--internal} 24 : {$IFDEF HWLIBRARY}isInternal:= true{$ENDIF}; {--port} 25 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter ); @@ -241,9 +241,9 @@ {--stats-only} 28 : statsOnlyGame(); {--gci} 29 : GciEasterEgg(); {--help} 30 : DisplayUsage(); - {--no-teamtag} 31 : cTagsMask := cTagsMask and not htTeamName; - {--no-hogtag} 32 : cTagsMask := cTagsMask and not htName; - {--no-healthtag} 33 : cTagsMask := cTagsMask and not htHealth; + {--no-teamtag} 31 : cTagsMask := cTagsMask and (not htTeamName); + {--no-hogtag} 32 : cTagsMask := cTagsMask and (not htName); + {--no-healthtag} 33 : cTagsMask := cTagsMask and (not htHealth); {--translucent-tags} 34 : cTagsMask := cTagsMask or htTransparent; {--lua-test} 35 : begin cTestLua := true; cScriptName := getstringParameter(arg, paramIndex, parseParameter); WriteLn(stdout, 'Lua test file specified: ' + cScriptName);end; else @@ -260,7 +260,7 @@ end; end; -procedure parseClassicParameter(cmdArray: array of string; size:LongInt; var paramIndex:LongInt); +procedure parseClassicParameter(cmdarray: array of string; size:LongInt; var paramIndex:LongInt); var index, tmpInt: LongInt; isBool, isValid: Boolean; cmd, arg, newSyntax: string; @@ -276,7 +276,7 @@ begin newSyntax:= ''; inc(paramIndex); - cmd:= cmdArray[index]; + cmd:= cmdarray[index]; arg:= ParamStr(paramIndex); isValid:= (cmd<>'--depth'); diff -r ca67740f19b2 -r 8572d1f8b2f0 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sun Jan 26 10:20:42 2014 +0400 +++ b/hedgewars/uGears.pas Mon Jan 27 00:33:42 2014 +0400 @@ -425,7 +425,7 @@ if CurrentHedgehog^.Gear <> nil then if (((CurrentHedgehog^.Gear^.State and gstAttacking) = 0) or (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerWhileAttacking <> 0)) - and not(isInMultiShoot and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerInMultiShoot) <> 0)) then + and (not(isInMultiShoot and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerInMultiShoot) <> 0))) then //(CurrentHedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle]) begin if (TurnTimeLeft = 5000) diff -r ca67740f19b2 -r 8572d1f8b2f0 hedgewars/uPhysFSLayer.pas --- a/hedgewars/uPhysFSLayer.pas Sun Jan 26 10:20:42 2014 +0400 +++ b/hedgewars/uPhysFSLayer.pas Mon Jan 27 00:33:42 2014 +0400 @@ -31,13 +31,16 @@ function pfsExists(fname: shortstring): boolean; +{$IFNDEF PAS2C} function physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhyslayerLibName; procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhyslayerLibName; procedure hedgewarsMountPackage(filename: PChar); cdecl; external PhyslayerLibName; +{$ENDIF} implementation uses uUtils, uVariables, sysutils; +{$IFNDEF PAS2C} function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external PhysfsLibName; function PHYSFS_deinit() : LongInt; cdecl; external PhysfsLibName; function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external PhyslayerLibName; @@ -52,6 +55,7 @@ function PHYSFS_getLastError(): PChar; cdecl; external PhysfsLibName; procedure hedgewarsMountPackages(); cdecl; external PhyslayerLibName; +{$ENDIF} function rwopsOpenRead(fname: shortstring): PSDL_RWops; begin diff -r ca67740f19b2 -r 8572d1f8b2f0 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sun Jan 26 10:20:42 2014 +0400 +++ b/hedgewars/uScript.pas Mon Jan 27 00:33:42 2014 +0400 @@ -270,7 +270,7 @@ else begin for i:= 1 to lua_gettop(L) do - GameFlags := GameFlags and not(LongWord(lua_tointeger(L, i))); + GameFlags := GameFlags and (not LongWord(lua_tointeger(L, i))); ScriptSetInteger('GameFlags', GameFlags); end; lc_disablegameflags:= 0; diff -r ca67740f19b2 -r 8572d1f8b2f0 hedgewars/uTextures.pas --- a/hedgewars/uTextures.pas Sun Jan 26 10:20:42 2014 +0400 +++ b/hedgewars/uTextures.pas Mon Jan 27 00:33:42 2014 +0400 @@ -146,13 +146,13 @@ // invisible pixels get colors from visible neighbors if cpi then begin - row1^[i]:= row1^[i-1] and not AMask; + row1^[i]:= row1^[i-1] and (not AMask); // as this pixel is invisible and already colored correctly now, no point in further comparing it lpi:= cpi; continue; end else - row1^[i-1]:= row1^[i] and not AMask; + row1^[i-1]:= row1^[i] and (not AMask); end; end; lpi:= cpi; @@ -163,9 +163,9 @@ if cpi <> bpi then begin if cpi then - row1^[i]:= row2^[i+ioffset] and not AMask + row1^[i]:= row2^[i+ioffset] and (not AMask) else - row2^[i+ioffset]:= row1^[i] and not AMask; + row2^[i+ioffset]:= row1^[i] and (not AMask); end; end; end;