Remove uAmmos dependaency from uCommands
authorunc0rr
Sun, 21 Nov 2010 19:07:43 +0300
changeset 4401 9cb6990af584
parent 4400 b190572290a0
child 4402 54a78ec6aac4
Remove uAmmos dependaency from uCommands
hedgewars/CCHandlers.inc
hedgewars/uAmmos.pas
hedgewars/uCommands.pas
hedgewars/uTeams.pas
--- a/hedgewars/CCHandlers.inc	Sun Nov 21 10:53:50 2010 -0500
+++ b/hedgewars/CCHandlers.inc	Sun Nov 21 19:07:43 2010 +0300
@@ -116,46 +116,6 @@
     end;
 end;
 
-procedure chSetAmmoLoadout(var descr: shortstring);
-begin
-SetAmmoLoadout(descr)
-end;
-
-procedure chSetAmmoDelay(var descr: shortstring);
-begin
-SetAmmoDelay(descr)
-end;
-
-procedure chSetAmmoProbability(var descr: shortstring);
-begin
-SetAmmoProbability(descr)
-end;
-
-procedure chSetAmmoReinforcement(var descr: shortstring);
-begin
-SetAmmoReinforcement(descr)
-end;
-
-procedure chAddAmmoStore(var descr: shortstring);
-begin
-descr:= ''; // avoid compiler hint
-AddAmmoStore
-end;
-
-procedure chBind(var id: shortstring);
-var s: shortstring;
-    b: LongInt;
-begin
-s:= '';
-if CurrentTeam = nil then exit;
-SplitBySpace(id, s);
-if s[1]='"' then Delete(s, 1, 1);
-if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
-b:= KeyNameToCode(id);
-if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"', false)
-        else CurrentTeam^.Binds[b]:= s
-end;
-
 procedure chCurU_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
--- a/hedgewars/uAmmos.pas	Sun Nov 21 10:53:50 2010 -0500
+++ b/hedgewars/uAmmos.pas	Sun Nov 21 19:07:43 2010 +0300
@@ -418,8 +418,22 @@
     if Ammoz[a].SkipTurns >= 10000 then dec(Ammoz[a].SkipTurns,10000)
 end;
 
+
+
+procedure chAddAmmoStore(var descr: shortstring);
+begin
+descr:= ''; // avoid compiler hint
+AddAmmoStore
+end;
+
 procedure initModule;
 begin
+    RegisterVariable('ammloadt', vtCommand, @SetAmmoLoadout, false);
+    RegisterVariable('ammdelay', vtCommand, @SetAmmoDelay, false);
+    RegisterVariable('ammprob',  vtCommand, @SetAmmoProbability, false);
+    RegisterVariable('ammreinf', vtCommand, @SetAmmoReinforcement, false);
+    RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
+
     StoreCnt:= 0;
     ammoLoadout:= '';
     ammoProbability:= '';
--- a/hedgewars/uCommands.pas	Sun Nov 21 10:53:50 2010 -0500
+++ b/hedgewars/uCommands.pas	Sun Nov 21 19:07:43 2010 +0300
@@ -16,8 +16,8 @@
 procedure doPut(putX, putY: LongInt; fromAI: boolean);
 
 implementation
-uses Types, uConsts, uIO, uKeys, uMobile,
-     uRandom, uAmmos, uChat, SDLh, uScript, uTypes,
+uses Types, uConsts, uIO, uMobile,
+     uRandom, uChat, SDLh, uScript, uTypes,
      uVariables, uConsole, uUtils;
 
 type  PVariable = ^TVariable;
@@ -146,7 +146,6 @@
     RegisterVariable('waterrise', vtLongInt, @cWaterRise    , false);
     RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
     RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
-    RegisterVariable('ropepct' , vtLongInt, @cRopePercent   , false);
     RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
     RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
     RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
@@ -156,13 +155,7 @@
     RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
     RegisterVariable('fort'    , vtCommand, @chFort         , false);
     RegisterVariable('grave'   , vtCommand, @chGrave        , false);
-    RegisterVariable('bind'    , vtCommand, @chBind         , true );
     RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
-    RegisterVariable('ammloadt', vtCommand, @chSetAmmoLoadout, false);
-    RegisterVariable('ammdelay', vtCommand, @chSetAmmoDelay, false);
-    RegisterVariable('ammprob',  vtCommand, @chSetAmmoProbability, false);
-    RegisterVariable('ammreinf', vtCommand, @chSetAmmoReinforcement, false);
-    RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
     RegisterVariable('quit'    , vtCommand, @chQuit         , true );
     RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
     RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
@@ -225,4 +218,4 @@
     end;
 end;
 
-end.
+end.
\ No newline at end of file
--- a/hedgewars/uTeams.pas	Sun Nov 21 10:53:50 2010 -0500
+++ b/hedgewars/uTeams.pas	Sun Nov 21 19:07:43 2010 +0300
@@ -501,11 +501,26 @@
 CurrentHedgehog^.Gear^.Y:= int2hwFloat(t)
 end;
 
+procedure chBind(var id: shortstring);
+var s: shortstring;
+    b: LongInt;
+begin
+s:= '';
+if CurrentTeam = nil then exit;
+SplitBySpace(id, s);
+if s[1]='"' then Delete(s, 1, 1);
+if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
+b:= KeyNameToCode(id);
+if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"', false)
+        else CurrentTeam^.Binds[b]:= s
+end;
+
 procedure initModule;
 begin
     RegisterVariable('addhh', vtCommand, @chAddHH, false);
     RegisterVariable('addteam', vtCommand, @chAddTeam, false);
-    RegisterVariable('hhcoords', vtCommand, @chSetHHCoords  , false);
+    RegisterVariable('hhcoords', vtCommand, @chSetHHCoords, false);
+    RegisterVariable('bind', vtCommand, @chBind, true );
 
     CurrentTeam:= nil;
     PreviousTeam:= nil;