# HG changeset patch # User nemo # Date 1330278300 18000 # Node ID 864bf0f52a8ce13ebf89f3f82d3de921f6c48ad2 # Parent 0acfa8202a291061077816563f03a23f69d2c2d6 make onAmmoStoreInit optional in the case of onNewAmmoStore diff -r 0acfa8202a29 -r 864bf0f52a8c hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sun Feb 26 12:32:48 2012 -0500 +++ b/hedgewars/uScript.pas Sun Feb 26 12:45:00 2012 -0500 @@ -1773,13 +1773,16 @@ if StoreCnt-1 < k then AddAmmoStore; inc(k) end; -if ScriptExists('onAmmoStoreInit') then +if ScriptExists('onAmmoStoreInit') or ScriptExists('onNewAmmoStore') then begin // reset ammostore (quite unclean, but works?) uAmmos.freeModule; uAmmos.initModule; - ScriptPrepareAmmoStore; - ScriptCall('onAmmoStoreInit'); + if ScriptExists('onAmmoStoreInit') then + begin + ScriptCall('onAmmoStoreInit'); + ScriptPrepareAmmoStore + end; ScriptApplyAmmoStore end; @@ -1966,7 +1969,7 @@ if ScriptExists('onNewAmmoStore') then begin ScriptPrepareAmmoStore; - ScriptCall('onNewAmmoStore',i,-1); + ScriptCall('onNewAmmoStore',i,-1) end; AddAmmoStore; for j:= 0 to Pred(ClansArray[i]^.TeamsNumber) do @@ -1980,8 +1983,7 @@ if ScriptExists('onNewAmmoStore') then begin ScriptPrepareAmmoStore; - ScriptCall('onNewAmmoStore'); - ScriptCall('onNewAmmoStore',i,j); + ScriptCall('onNewAmmoStore',i,j) end; AddAmmoStore; TeamsArray[i]^.Hedgehogs[j].AmmoStore:= StoreCnt - 1 @@ -1992,7 +1994,7 @@ if ScriptExists('onNewAmmoStore') then begin ScriptPrepareAmmoStore; - ScriptCall('onNewAmmoStore',i,-1); + ScriptCall('onNewAmmoStore',i,-1) end; AddAmmoStore; for j:= 0 to Pred(TeamsArray[i]^.HedgehogsNumber) do