# HG changeset patch # User unc0rr # Date 1269198123 0 # Node ID 4e48c276a46839fd0f46f098277d78186e90f9d5 # Parent ab6e949eb5cb26ab2bc1393a32257ef29d81e211 In pascal unit is a namespace diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/hwengine.pas Sun Mar 21 19:02:03 2010 +0000 @@ -310,72 +310,72 @@ procedure initEverything; begin - init_uConsts(); - init_uMisc(); - init_uConsole(); // MUST happen after uMisc + uConsts.initModule; + uMisc.initModule; + uConsole.initModule; // MUST happen after uMisc - init_uAI(); + uAI.initModule; //uAIActions does not need initialization //uAIAmmoTests does not need initialization - init_uAIMisc(); - init_uAmmos(); - init_uChat(); - init_uCollisions(); + uAIMisc.initModule; + uAmmos.initModule; + uChat.initModule; + uCollisions.initModule; //uFloat does not need initialization //uGame does not need initialization - init_uGears(); - init_uIO(); - init_uKeys(); - init_uLand(); + uGears.initModule; + uIO.initModule; + uKeys.initModule; + uLand.initModule; //uLandGraphics does not need initialization //uLandObjects does not need initialization //uLandTemplates does not need initialization //uLandTexture does not need initialization //uLocale does not need initialization - init_uRandom(); + uRandom.initModule; //uSHA does not need initialization - init_uSound(); - init_uStats(); - init_uStore(); - init_uTeams(); - init_uVisualGears(); - init_uWorld(); - init_uScript(); + uSound.initModule; + uStats.initModule; + uStore.initModule; + uTeams.initModule; + uVisualGears.initModule; + uWorld.initModule; + uScript.initModule; end; procedure freeEverything; begin - free_uWorld(); - free_uVisualGears(); //stub - free_uTeams(); - free_uStore(); - free_uStats(); //stub - free_uSound(); //stub + uWorld.freeModule; + uVisualGears.freeModule; //stub + uTeams.freeModule; + uStore.freeModule; + uStats.freeModule; //stub + uSound.freeModule; //stub //uSHA does not need to be freed - free_uRandom(); //stub + uRandom.freeModule; //stub //uLocale does not need to be freed //uLandTemplates does not need to be freed //uLandTexture does not need to be freed //uLandObjects does not need to be freed //uLandGraphics does not need to be freed - free_uLand(); - free_uKeys(); //stub - free_uIO(); - free_uGears(); + uLand.freeModule; + uKeys.freeModule; //stub + uIO.freeModule; + uGears.freeModule; //uGame does not need to be freed //uFloat does not need to be freed - free_uCollisions(); - free_uChat(); - free_uAmmos(); - free_uAIMisc(); //stub + uCollisions.freeModule; + uChat.freeModule; + uAmmos.freeModule; + uAIMisc.freeModule; //stub //uAIAmmoTests does not need to be freed //uAIActions does not need to be freed - free_uAI(); //stub + uAI.freeModule; //stub - free_uConsole(); - free_uMisc(); - free_uConsts(); //stub - free_uScript(); + uConsole.freeModule; + uMisc.freeModule; + uConsts.freeModule; //stub + uScript.freeModule; end; ///////////////////////// diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uAI.pas --- a/hedgewars/uAI.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uAI.pas Sun Mar 21 19:02:03 2010 +0000 @@ -22,8 +22,8 @@ interface uses uFloat; -procedure init_uAI; -procedure free_uAI; +procedure initModule; +procedure freeModule; procedure ProcessBot; procedure FreeActionsList; @@ -345,12 +345,12 @@ or (TurnTimeLeft <= cStopThinkTime) then StopThinking:= true end; -procedure init_uAI; +procedure initModule; begin hasThread:= 0; end; -procedure free_uAI; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uAIMisc.pas Sun Mar 21 19:02:03 2010 +0000 @@ -37,8 +37,8 @@ JumpType: TJumpType; end; -procedure init_uAIMisc; -procedure free_uAIMisc; +procedure initModule; +procedure freeModule; procedure FillTargets; procedure FillBonuses(isAfterAttack: boolean); @@ -467,7 +467,7 @@ else AIrndSign:= - num end; -procedure init_uAIMisc; +procedure initModule; begin friendlyfactor:= 300; KnownExplosion.X:= 0; @@ -475,7 +475,7 @@ KnownExplosion.Radius:= 0; end; -procedure free_uAIMisc; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uAmmos.pas Sun Mar 21 19:02:03 2010 +0000 @@ -22,8 +22,8 @@ interface uses uConsts, uTeams, uStats; -procedure init_uAmmos; -procedure free_uAmmos; +procedure initModule; +procedure freeModule; procedure AddAmmoStore(s: shortstring); procedure AssignStores; @@ -368,13 +368,13 @@ if Ammoz[t].SkipTurns >= 10000 then dec(Ammoz[t].SkipTurns,10000); end; -procedure init_uAmmos; +procedure initModule; begin shoppa:= false; StoreCnt:= 0 end; -procedure free_uAmmos; +procedure freeModule; var i: LongWord; begin if StoreCnt > 0 then diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uChat.pas Sun Mar 21 19:02:03 2010 +0000 @@ -22,8 +22,8 @@ interface -procedure init_uChat; -procedure free_uChat; +procedure initModule; +procedure freeModule; procedure AddChatString(s: shortstring); procedure DrawChat; @@ -284,7 +284,7 @@ end end; -procedure init_uChat; +procedure initModule; begin lastStr:= 0; visibleCount:= 0; @@ -292,7 +292,7 @@ showAll:= false; end; -procedure free_uChat; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uCollisions.pas --- a/hedgewars/uCollisions.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uCollisions.pas Sun Mar 21 19:02:03 2010 +0000 @@ -30,8 +30,8 @@ Count: Longword end; -procedure init_uCollisions; -procedure free_uCollisions; +procedure initModule; +procedure freeModule; procedure AddGearCI(Gear: PGear); procedure DeleteCI(Gear: PGear); @@ -312,12 +312,12 @@ Gear^.Y:= Gear^.Y - int2hwFloat(ShiftY) end; -procedure init_uCollisions; +procedure initModule; begin Count:= 0; end; -procedure free_uCollisions; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uConsole.pas Sun Mar 21 19:02:03 2010 +0000 @@ -26,8 +26,8 @@ type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean); TCommandHandler = procedure (var params: shortstring); -procedure init_uConsole; -procedure free_uConsole; +procedure initModule; +procedure freeModule; procedure WriteToConsole(s: shortstring); procedure WriteLnToConsole(s: shortstring); procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); @@ -211,7 +211,7 @@ end; {$INCLUDE "CCHandlers.inc"} -procedure init_uConsole; +procedure initModule; var i: LongInt; begin CurrLine:= 0; @@ -309,7 +309,7 @@ RegisterVariable('script' , vtCommand, @chScript , false); end; -procedure free_uConsole; +procedure freeModule; begin FreeVariablesList(); end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uConsts.pas Sun Mar 21 19:02:03 2010 +0000 @@ -1756,12 +1756,12 @@ ); -procedure init_uConsts; -procedure free_uConsts; +procedure initModule; +procedure freeModule; implementation -procedure init_uConsts; +procedure initModule; var cPathz: array[TPathType] of shortstring = ( '', // ptNone '', // ptData @@ -1788,7 +1788,7 @@ Pathz:= cPathz; end; -procedure free_uConsts; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uGears.pas Sun Mar 21 19:02:03 2010 +0000 @@ -74,8 +74,8 @@ StepSoundTimer: LongInt; StepSoundChannel: LongInt; -procedure init_uGears; -procedure free_uGears; +procedure initModule; +procedure freeModule; function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; procedure ProcessGears; procedure ResetUtilities; @@ -2254,7 +2254,7 @@ end end; -procedure init_uGears; +procedure initModule; begin CurAmmoGear:= nil; GearsList:= nil; @@ -2268,7 +2268,7 @@ PrvInactive:= false; end; -procedure free_uGears; +procedure freeModule; begin FreeGearsList(); end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uIO.pas Sun Mar 21 19:02:03 2010 +0000 @@ -25,8 +25,8 @@ var ipcPort: Word; hiTicks: Word; -procedure init_uIO; -procedure free_uIO; +procedure initModule; +procedure freeModule; procedure SendIPC(s: shortstring); procedure SendIPCXY(cmd: char; X, Y: SmallInt); @@ -347,7 +347,7 @@ if isInLag then fastUntilLag:= false end; -procedure init_uIO; +procedure initModule; begin IPCSock:= nil; @@ -360,7 +360,7 @@ ipcPort:= 0; end; -procedure free_uIO; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uKeys.pas Sun Mar 21 19:02:03 2010 +0000 @@ -25,8 +25,8 @@ type TBinds = array[0..cKeyMaxIndex] of shortstring; type TKeyboardState = array[0..cKeyMaxIndex] of Byte; -procedure init_uKeys; -procedure free_uKeys; +procedure initModule; +procedure freeModule; function KeyNameToCode(name: shortstring): word; procedure ProcessKbd; @@ -488,7 +488,7 @@ else ControllerButtons[joy][button]:= 0; end; -procedure init_uKeys; +procedure initModule; begin wheelUp:= false; wheelDown:= false; @@ -514,7 +514,7 @@ {$ENDIF} end; -procedure free_uKeys; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uLand.pas Sun Mar 21 19:02:03 2010 +0000 @@ -41,8 +41,8 @@ playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword; // idea is that a template can specify height/width. Or, a map, a height/width by the dimensions of the image. If the map has pixels near top of image, it triggers border. LandBackSurface: PSDL_Surface; -procedure init_uLand; -procedure free_uLand; +procedure initModule; +procedure freeModule; procedure GenMap; function GenPreview: TPreview; procedure CheckLandDigest(s: shortstring); @@ -342,7 +342,7 @@ end; SDL_FreeSurface(tmpsurf); - // freed in free_uLand() below + // freed in freeModule() below LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent); @@ -854,12 +854,12 @@ GenPreview:= Preview end; -procedure init_uLand; +procedure initModule; begin LandBackSurface:= nil; end; -procedure free_uLand; +procedure freeModule; begin FillChar(LandPixels, sizeof(TLandArray), 0); if LandBackSurface <> nil then diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uMisc.pas Sun Mar 21 19:02:03 2010 +0000 @@ -127,8 +127,8 @@ TextureList : PTexture; -procedure init_uMisc; -procedure free_uMisc; +procedure initModule; +procedure freeModule; procedure SplitBySpace(var a, b: shortstring); procedure SplitByChar(var a, b: ansistring; c: char); procedure movecursor(dx, dy: Integer); @@ -643,7 +643,7 @@ end; -procedure init_uMisc; +procedure initModule; {$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF} begin cDrownSpeed.QWordValue := 257698038; // 0.06 @@ -758,7 +758,7 @@ end; -procedure free_uMisc; +procedure freeModule; begin //uRandom.DumpBuffer; while TextureList <> nil do FreeTexture(TextureList); diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uRandom.pas --- a/hedgewars/uRandom.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uRandom.pas Sun Mar 21 19:02:03 2010 +0000 @@ -23,8 +23,8 @@ uses uFloat; {$INCLUDE "config.inc"} -procedure init_uRandom; -procedure free_uRandom; +procedure initModule; +procedure freeModule; procedure SetRandomSeed(Seed: shortstring); function GetRandom: hwFloat; overload; @@ -96,12 +96,12 @@ end; {$ENDIF} -procedure init_uRandom; +procedure initModule; begin n:= 54; end; -procedure free_uRandom; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uScript.pas Sun Mar 21 19:02:03 2010 +0000 @@ -34,8 +34,8 @@ function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt; function ScriptExists(fname : shortstring) : boolean; -procedure init_uScript; -procedure free_uScript; +procedure initModule; +procedure freeModule; implementation {$IFNDEF IPHONEOS} @@ -672,8 +672,8 @@ var i: ShortInt; begin // reset ammostore (quite unclean, but works?) -free_uAmmos; -init_uAmmos; +uAmmos.freeModule; +uAmmos.initModule; ScriptAmmoStore:= ''; for i:=1 to ord(High(TAmmoType)) do ScriptAmmoStore:= ScriptAmmoStore + '0000'; @@ -712,7 +712,7 @@ end; /////////////////// -procedure init_uScript; +procedure initModule; var at : TGearType; am : TAmmoType; st : TSound; @@ -794,7 +794,7 @@ ScriptLoaded:= false; end; -procedure free_uScript; +procedure freeModule; begin lua_close(luaState); end; @@ -845,11 +845,11 @@ ScriptExists:= false end; -procedure init_uScript; +procedure initModule; begin end; -procedure free_uScript; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uSound.pas Sun Mar 21 19:02:03 2010 +0000 @@ -30,8 +30,8 @@ var MusicFN: shortstring; -procedure init_uSound; -procedure free_uSound; +procedure initModule; +procedure freeModule; procedure InitSound; procedure ReleaseSound; @@ -249,12 +249,12 @@ Mix_ResumeMusic(Mus); end; -procedure init_uSound; +procedure initModule; begin MusicFN:=''; end; -procedure free_uSound; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uStats.pas --- a/hedgewars/uStats.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uStats.pas Sun Mar 21 19:02:03 2010 +0000 @@ -37,8 +37,8 @@ var TotalRounds: LongInt; FinishedTurnsTotal: LongInt; -procedure init_uStats; -procedure free_uStats; +procedure initModule; +procedure freeModule; procedure AmmoUsed(am: TAmmoType); procedure HedgehogDamaged(Gear: PGear); @@ -219,13 +219,13 @@ if KilledHHs > 0 then SendStat(siKilledHHs, inttostr(KilledHHs)); end; -procedure init_uStats; +procedure initModule; begin TotalRounds:= -1; FinishedTurnsTotal:= -1; end; -procedure free_uStats; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uStore.pas Sun Mar 21 19:02:03 2010 +0000 @@ -42,8 +42,8 @@ MissionIcons: PSDL_Surface; ropeIconTex: PTexture; -procedure init_uStore; -procedure free_uStore; +procedure initModule; +procedure freeModule; procedure StoreLoad; procedure StoreRelease; @@ -1520,7 +1520,7 @@ {$ENDIF} end; -procedure init_uStore; +procedure initModule; begin PixelFormat:= nil; SDLPrimSurface:= nil; @@ -1532,7 +1532,7 @@ ProgrTex:= nil; end; -procedure free_uStore; +procedure freeModule; begin end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uTeams.pas Sun Mar 21 19:02:03 2010 +0000 @@ -104,8 +104,8 @@ LocalAmmo: LongInt; // last non-bot, non-extdriven clan's first team's ammo index CurMinAngle, CurMaxAngle: Longword; -procedure init_uTeams; -procedure free_uTeams; +procedure initModule; +procedure freeModule; function AddTeam(TeamColor: Longword): PTeam; procedure SwitchHedgehog; procedure AfterSwitchHedgehog; @@ -462,7 +462,7 @@ end end; -procedure init_uTeams; +procedure initModule; begin CurrentTeam:= nil; PreviousTeam:= nil; @@ -473,7 +473,7 @@ LocalAmmo:= -1; end; -procedure free_uTeams; +procedure freeModule; var i: LongWord; begin if TeamsCount > 0 then diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uVisualGears.pas Sun Mar 21 19:02:03 2010 +0000 @@ -50,8 +50,8 @@ Text: shortstring end; -procedure init_uVisualGears; -procedure free_uVisualGears; +procedure initModule; +procedure freeModule; function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; procedure ProcessVisualGears(Steps: Longword); @@ -745,12 +745,12 @@ AddVisualGear( - cScreenWidth + i * ((cScreenWidth * 2 + (LAND_WIDTH+256)) div (cCloudsNumber + 1)), LAND_HEIGHT-1184, vgtCloud) end; -procedure init_uVisualGears; +procedure initModule; begin VisualGearsList:= nil; end; -procedure free_uVisualGears; +procedure freeModule; begin while VisualGearsList <> nil do DeleteVisualGear(VisualGearsList); end; diff -r ab6e949eb5cb -r 4e48c276a468 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Sun Mar 21 18:42:34 2010 +0000 +++ b/hedgewars/uWorld.pas Sun Mar 21 19:02:03 2010 +0000 @@ -36,8 +36,8 @@ cntTicks: LongWord; {$ENDIF} -procedure init_uWorld; -procedure free_uWorld; +procedure initModule; +procedure freeModule; procedure InitWorld; procedure DrawWorld(Lag: LongInt); @@ -933,7 +933,7 @@ WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2)); end; -procedure init_uWorld; +procedure initModule; begin fpsTexture:= nil; FollowGear:= nil; @@ -955,7 +955,7 @@ FillChar(Captions, sizeof(Captions), 0) end; -procedure free_uWorld; +procedure freeModule; begin if missionTex <> nil then FreeTexture(missionTex); end;