hedgewars/uAmmos.pas
changeset 2017 7845c77c8d31
parent 1966 31e449e1d9dd
child 2061 0f99aa28b9f4
equal deleted inserted replaced
2016:73b0bcc4396d 2017:7845c77c8d31
    59 
    59 
    60 procedure AddAmmoStore(s: shortstring);
    60 procedure AddAmmoStore(s: shortstring);
    61 var cnt: Longword;
    61 var cnt: Longword;
    62     a: TAmmoType;
    62     a: TAmmoType;
    63     ammos: TAmmoCounts;
    63     ammos: TAmmoCounts;
       
    64     substr: shortstring; // TEMPORARY
    64 begin
    65 begin
    65 TryDo(byte(s[0]) = byte(ord(High(TAmmoType)) + 1), 'Invalid ammo scheme (incompatible frontend)', true);
    66 TryDo(byte(s[0]) = byte(ord(High(TAmmoType)) + 1), 'Invalid ammo scheme (incompatible frontend)', true);
    66 
    67 
    67 // TEMPORARY hardcoded check on shoppa pending creation of probability editor
    68 // TEMPORARY hardcoded check on shoppa pending creation of probability editor
    68 if (s = '000000990000009000000000000000000000') or (s = '000000990000000000000000000000000000') then
    69 substr:= Copy(s,1,15);
       
    70 if (substr = '000000990000009') or 
       
    71    (substr = '000000990000000') then
    69     shoppa:= true;
    72     shoppa:= true;
       
    73 for a:= Low(TAmmoType) to High(TAmmoType) do
       
    74     if (ord(a) > 14) and (s[ord(a)+1] <> '0') then shoppa:= false;  // TEMPORARY etc - this just avoids updating every time new wep is added
    70 inc(StoreCnt);
    75 inc(StoreCnt);
    71 TryDo(StoreCnt <= cMaxHHs, 'Ammo stores overflow', true);
    76 TryDo(StoreCnt <= cMaxHHs, 'Ammo stores overflow', true);
    72 
    77 
    73 new(StoresList[Pred(StoreCnt)]);
    78 new(StoresList[Pred(StoreCnt)]);
    74 
    79 
    80         cnt:= AMMO_INFINITE;
    85         cnt:= AMMO_INFINITE;
    81         Ammoz[a].Probability:= 0 
    86         Ammoz[a].Probability:= 0 
    82         end;
    87         end;
    83     if ((a = amLowGravity) and ((GameFlags and gfLowGravity) <> 0)) or
    88     if ((a = amLowGravity) and ((GameFlags and gfLowGravity) <> 0)) or
    84        ((a = amInvulnerable) and ((GameFlags and gfInvulnerable) <> 0)) or
    89        ((a = amInvulnerable) and ((GameFlags and gfInvulnerable) <> 0)) or
    85        ((a = amLaserSight) and ((GameFlags and gfLaserSight) <> 0)) then
    90        ((a = amLaserSight) and ((GameFlags and gfLaserSight) <> 0)) or
       
    91        ((a = amVampiric) and ((GameFlags and gfVampiric) <> 0)) then
    86         begin
    92         begin
    87         cnt:= 0;
    93         cnt:= 0;
    88         Ammoz[a].Probability:= 0 
    94         Ammoz[a].Probability:= 0 
    89         end
    95         end
    90     else if shoppa then      // TEMPORARY REMOVE WHEN CRATE PROBABILITY IS ADDED
    96     else if shoppa then      // TEMPORARY REMOVE WHEN CRATE PROBABILITY IS ADDED