# HG changeset patch # User unc0rr # Date 1349078499 -14400 # Node ID 2b1ad418ba39ae9112c33a9caa6c8bd5e0242d4a # Parent 8e6b79a020f89483f55fb1e2d1baed48dc95b84d - Fix warnings and hints - Hide "Converting the operands to Int64 before doing the add could prevent overflow errors" kind of hints as pretty useless and annoying diff -r 8e6b79a020f8 -r 2b1ad418ba39 CMakeLists.txt --- a/CMakeLists.txt Mon Oct 01 00:31:38 2012 +0400 +++ b/CMakeLists.txt Mon Oct 01 12:01:39 2012 +0400 @@ -176,7 +176,7 @@ endif() endif() -set(pascal_flags ${fpflags_parsed} "-B" "-FE../bin" "-Cs2000000" "-vewn" "-dDEBUGFILE" ${pascal_flags}) +set(pascal_flags ${fpflags_parsed} "-vq" "-vm4079,4080,4081" "-B" "-FE../bin" "-Cs2000000" "-vewn" "-dDEBUGFILE" ${pascal_flags}) set(haskell_flags "-O2" ${ghflags_parsed} ${haskell_flags}) #get BUILD_TYPE and enable/disable optimisation diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/GSHandlers.inc Mon Oct 01 12:01:39 2012 +0400 @@ -716,8 +716,8 @@ exit end; Gear^.Pos:= 0; - Gear^.X:= int2hwFloat(GetRandom(snowRight-snowLeft)+snowLeft); - Gear^.Y:= int2hwFloat(LAND_HEIGHT-1300+(GetRandom(50)-25)); + Gear^.X:= int2hwFloat(LongInt(GetRandom(snowRight - snowLeft)) + snowLeft); + Gear^.Y:= int2hwFloat(LongInt(LAND_HEIGHT + GetRandom(50)) - 1325); Gear^.State:= Gear^.State or gstInvisible; end end; @@ -3724,7 +3724,7 @@ // calc gear offset in portal normal vector direction noffs:= (nx * ox + ny * oy); - if isBullet and (noffs.Round >= Gear^.Radius) then + if isBullet and (noffs.Round >= Longword(Gear^.Radius)) then continue; // avoid gravity related loops of not really moving gear @@ -4654,7 +4654,7 @@ if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then begin - if graves.size <= Gear^.Tag then Gear^.Tag:= 0; + if LongInt(graves.size) <= Gear^.Tag then Gear^.Tag:= 0; dec(hh^.Gear^.Health); if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then hh^.Gear^.Damage:= 1; diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uAIActions.pas --- a/hedgewars/uAIActions.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uAIActions.pas Mon Oct 01 12:01:39 2012 +0400 @@ -234,7 +234,7 @@ doPut(X, Y, true); aia_waitAngle: - if Me^.Angle <> Abs(Param) then exit; + if LongInt(Me^.Angle) <> Abs(Param) then exit; aia_waitAmmoXY: if (CurAmmoGear <> nil) and ((hwRound(CurAmmoGear^.X) <> X) or (hwRound(CurAmmoGear^.Y) <> Y)) then exit; diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uAIAmmoTests.pas Mon Oct 01 12:01:39 2012 +0400 @@ -1109,7 +1109,7 @@ ap.Time:= 0; ap.Power:= BadTurn; // use it as max score value in checkCakeWalk - FillChar(cake, sizeof(cake), 0); + //FillChar(cake, sizeof(cake), 0); cake.Radius:= 7; cake.CollisionMask:= $FF7F; diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uGears.pas Mon Oct 01 12:01:39 2012 +0400 @@ -653,8 +653,8 @@ snowLeft:= -(snowRight-LAND_WIDTH); if not hasBorder and ((Theme = 'Snow') or (Theme = 'Christmas')) then - for i:= vobCount * max(LAND_WIDTH,4096) div 2048 downto 1 do - AddGear(GetRandom(snowRight-snowLeft)+snowLeft, LAND_HEIGHT-1300+GetRandom(750), gtFlake, 0, _0, _0, 0); + for i:= vobCount * Longword(max(LAND_WIDTH,4096)) div 2048 downto 1 do + AddGear(LongInt(GetRandom(snowRight - snowLeft)) + snowLeft, LongInt(LAND_HEIGHT + GetRandom(750)) - 1300, gtFlake, 0, _0, _0, 0); end; diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uGearsHandlers.pas --- a/hedgewars/uGearsHandlers.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uGearsHandlers.pas Mon Oct 01 12:01:39 2012 +0400 @@ -35,12 +35,12 @@ procedure PrevAngle(Gear: PGear; dA: LongInt); inline; begin - Gear^.Angle := (Gear^.Angle - dA) and 3 + Gear^.Angle := (LongInt(Gear^.Angle) - dA) and 3 end; procedure NextAngle(Gear: PGear; dA: LongInt); inline; begin - Gear^.Angle := (Gear^.Angle + dA) and 3 + Gear^.Angle := (LongInt(Gear^.Angle) + dA) and 3 end; procedure cakeStep(Gear: PGear); @@ -51,8 +51,8 @@ dA := hwSign(Gear^.dX); xx := dirs[Gear^.Angle].x; yy := dirs[Gear^.Angle].y; - xxn := dirs[(Gear^.Angle + dA) and 3].x; - yyn := dirs[(Gear^.Angle + dA) and 3].y; + xxn := dirs[(LongInt(Gear^.Angle) + dA) and 3].x; + yyn := dirs[(LongInt(Gear^.Angle) + dA) and 3].y; if (xx = 0) then if TestCollisionYwithGear(Gear, yy) <> 0 then diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uGearsList.pas Mon Oct 01 12:01:39 2012 +0400 @@ -177,9 +177,9 @@ if State and gstTmpFlag = 0 then begin dx.isNegative:= GetRandom(2) = 0; - dx.QWordValue:= $40DA*GetRandom(10000)*8; + dx.QWordValue:= $40DA * GetRandom(10000) * 8; dy.isNegative:= false; - dy.QWordValue:= $3AD3*GetRandom(7000)*8; + dy.QWordValue:= $3AD3 * GetRandom(7000) * 8; if GetRandom(2) = 0 then dx := -dx end; diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uGearsRender.pas Mon Oct 01 12:01:39 2012 +0400 @@ -1018,7 +1018,7 @@ if Gear^.Timer < 1833 then begin DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0, - x, Gear^.Angle+WorldDy-16, 4+Gear^.Tag, 1, 32, 32, 270); + x, LongInt(Gear^.Angle) + WorldDy - 16, 4 + Gear^.Tag, 1, 32, 32, 270); end end; gtExplosives: begin @@ -1192,17 +1192,17 @@ HHGear := Gear^.Hedgehog^.Gear; if HHGear <> nil then begin - i:= hwRound(hwSqr(Gear^.X-HHGear^.X)+hwSqr(Gear^.Y-HHGear^.Y)); - if RealTicks mod max(1,50-(round(sqrt(i)) div 4)) = 0 then // experiment in "intensifying" might not get used + i:= hwRound(hwSqr(Gear^.X - HHGear^.X) + hwSqr(Gear^.Y - HHGear^.Y)); + if RealTicks mod max(1,50 - (round(sqrt(i)) div 4)) = 0 then // experiment in "intensifying" might not get used begin vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1); if vg <> nil then begin - i:= random(100)+155; - vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or ((random(200)+55)); + i:= random(100) + 155; + vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or Longword(random(200) + 55); vg^.Angle:= random(360); - vg^.dx:= 0.001 * (random(80)); - vg^.dy:= 0.001 * (random(80)) + vg^.dx:= 0.001 * random(80); + vg^.dy:= 0.001 * random(80) end end; if RealTicks mod 2 = 0 then diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uGearsUtils.pas Mon Oct 01 12:01:39 2012 +0400 @@ -110,7 +110,7 @@ // Run the calcs only once we know we have a type that will need damage tdX:= Gear^.X-fX; tdY:= Gear^.Y-fY; - if (tdX.Round + tdY.Round + 2) < dmgBase then + if LongInt(tdX.Round + tdY.Round + 2) < dmgBase then dmg:= dmgBase - hwRound(Distance(tdX, tdY)); if dmg > 1 then begin @@ -144,7 +144,7 @@ // Run the calcs only once we know we have a type that will need damage tdX:= Gear^.X-fX; tdY:= Gear^.Y-fY; - if (tdX.Round + tdY.Round + 2) < dmgBase then + if LongInt(tdX.Round + tdY.Round + 2) < dmgBase then dmg:= dmgBase - hwRound(Distance(tdX, tdY)); if dmg > 1 then begin diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uScript.pas Mon Oct 01 12:01:39 2012 +0400 @@ -1708,7 +1708,7 @@ i := 0; while (i < hiddenHedgehogsNumber) do begin - if hiddenHedgehogs[i]^.gearHidden^.uid = lua_tointeger(L, 1) then + if hiddenHedgehogs[i]^.gearHidden^.uid = LongWord(lua_tointeger(L, 1)) then begin hog := hiddenHedgehogs[i]; RestoreHog(hog); diff -r 8e6b79a020f8 -r 2b1ad418ba39 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Mon Oct 01 00:31:38 2012 +0400 +++ b/hedgewars/uWorld.pas Mon Oct 01 12:01:39 2012 +0400 @@ -43,25 +43,27 @@ implementation uses - uStore, - uMisc, - uIO, - uLocale, - uSound, - uAmmos, - uVisualGears, - uChat, - uLandTexture, - GLunit, - uVariables, - uUtils, - uTextures, - uRender, - uCaptions, - uCursor, - uCommands, - uMobile, - uVideoRec + uStore + , uMisc + , uIO + , uLocale + , uSound + , uAmmos + , uVisualGears + , uChat + , uLandTexture + , GLunit + , uVariables + , uUtils + , uTextures + , uRender + , uCaptions + , uCursor + , uCommands + , uMobile +{$IFDEF USE_VIDEO_RECORDING} + , uVideoRec +{$ENDIF} ; var cWaveWidth, cWaveHeight: LongInt;