hedgewars/uAmmos.pas
changeset 4143 eb7981f34800
parent 4141 2bd5ecf7b4fb
child 4148 eaff5615f976
equal deleted inserted replaced
4142:980ec01b98e1 4143:eb7981f34800
    42 procedure DisableSomeWeapons;
    42 procedure DisableSomeWeapons;
    43 procedure ResetWeapons;
    43 procedure ResetWeapons;
    44 function  GetAmmoByNum(num: Longword): PHHAmmo;
    44 function  GetAmmoByNum(num: Longword): PHHAmmo;
    45 function  GetAmmoEntry(var Hedgehog: THedgehog): PAmmo;
    45 function  GetAmmoEntry(var Hedgehog: THedgehog): PAmmo;
    46 
    46 
    47 var shoppa: boolean;
    47 var StoreCnt: Longword;
    48     StoreCnt: Longword;
       
    49 
    48 
    50 implementation
    49 implementation
    51 uses uMisc, uGears, uWorld, uLocale, uConsole, uMobile;
    50 uses uMisc, uGears, uWorld, uLocale, uConsole, uMobile;
    52 
    51 
    53 type TAmmoCounts = array[TAmmoType] of Longword;
    52 type TAmmoCounts = array[TAmmoType] of Longword;
    94     a: TAmmoType;
    93     a: TAmmoType;
    95     ammos: TAmmoCounts;
    94     ammos: TAmmoCounts;
    96     substr: shortstring; // TEMPORARY
    95     substr: shortstring; // TEMPORARY
    97 begin
    96 begin
    98 TryDo((byte(ammoLoadout[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoProbability[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoDelay[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoReinforcement[0]) = byte(ord(High(TAmmoType)))), 'Incomplete or missing ammo scheme set (incompatible frontend or demo/save?)', true);
    97 TryDo((byte(ammoLoadout[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoProbability[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoDelay[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoReinforcement[0]) = byte(ord(High(TAmmoType)))), 'Incomplete or missing ammo scheme set (incompatible frontend or demo/save?)', true);
    99 
       
   100 // FIXME - TEMPORARY hardcoded check on shoppa pending creation of crate *type* probability editor
       
   101 substr:= Copy(ammoLoadout,1,42);
       
   102 if (substr = '000000990000009000000000000000000000000000') or  // ropes + parachute
       
   103    (substr = '000000900000000000000000000000000000009000') or  // saucer
       
   104    (substr = '000000900000000000000000000000000000000009') or  // portal
       
   105    (substr = '000000990000000000000000000000000000000000')     // ropes
       
   106    then shoppa:= true;
       
   107 
    98 
   108 inc(StoreCnt);
    99 inc(StoreCnt);
   109 TryDo(StoreCnt <= cMaxHHs, 'Ammo stores overflow', true);
   100 TryDo(StoreCnt <= cMaxHHs, 'Ammo stores overflow', true);
   110 
   101 
   111 new(StoresList[Pred(StoreCnt)]);
   102 new(StoresList[Pred(StoreCnt)]);
   430     if Ammoz[a].SkipTurns >= 10000 then dec(Ammoz[a].SkipTurns,10000)
   421     if Ammoz[a].SkipTurns >= 10000 then dec(Ammoz[a].SkipTurns,10000)
   431 end;
   422 end;
   432 
   423 
   433 procedure initModule;
   424 procedure initModule;
   434 begin
   425 begin
   435     shoppa:= false;
       
   436     StoreCnt:= 0;
   426     StoreCnt:= 0;
   437     ammoLoadout:= '';
   427     ammoLoadout:= '';
   438     ammoProbability:= '';
   428     ammoProbability:= '';
   439     ammoDelay:= '';
   429     ammoDelay:= '';
   440     ammoReinforcement:= '';
   430     ammoReinforcement:= '';