- Support probabilies from ammo scheme in engine
- Remove shoppa probabilities hack
--- a/QTfrontend/hwconsts.cpp.in Thu Sep 10 12:16:11 2009 +0000
+++ b/QTfrontend/hwconsts.cpp.in Thu Sep 10 12:23:02 2009 +0000
@@ -38,11 +38,21 @@
QList< QPair<QString, QString> > cDefaultAmmos =
QList< QPair<QString, QString> >()
<< qMakePair(QString("Default"), *cDefaultAmmoStore)
- << qMakePair(QString("Crazy"), QString("999999999999999999299999999999999929999"))
- << qMakePair(QString("Pro mode"), QString("909000900000000000000900000000000000000"))
- << qMakePair(QString("Shoppa"), QString("000000990000000000000000000000000000000"))
- << qMakePair(QString("Basketball"),QString("000000900000090000000000000000000000000"))
- << qMakePair(QString("Minefield"), QString("000000990009000000030000000000000000000"))
+ << qMakePair(QString("Crazy"), QString(
+ "999999999999999999299999999999999929999"
+ "111111111111111111111111111111111111111"))
+ << qMakePair(QString("Pro mode"), QString(
+ "000000000000000000000000000000000000000"
+ "000000000000000000000000000000000000000"))
+ << qMakePair(QString("Shoppa"), QString(
+ "000000990000000000000000000000000000000"
+ "111111111111111111111111111111111111111")) //FIXME: dunno what should be here
+ << qMakePair(QString("Basketball"),QString(
+ "000000900000090000000000000000000000000"
+ "111111111111111111111111111111111111111")) //FIXME: dunno what should be here
+ << qMakePair(QString("Minefield"), QString(
+ "000000990009000000030000000000000000000"
+ "111111111111111111111111111111111111111")) //FIXME: dunno what should be here
;
QColor * color1 = new QColor(221, 0, 0);
--- a/hedgewars/uAmmos.pas Thu Sep 10 12:16:11 2009 +0000
+++ b/hedgewars/uAmmos.pas Thu Sep 10 12:23:02 2009 +0000
@@ -58,21 +58,13 @@
end;
procedure AddAmmoStore(s: shortstring);
-// [0,20,30,60,100,150,200,400,600]
+const probability: array [0..8] of LongWord = (0,20,30,60,100,150,200,400,600);
var cnt: Longword;
a: TAmmoType;
ammos: TAmmoCounts;
- substr: shortstring; // TEMPORARY
begin
-TryDo(byte(s[0]) = byte(ord(High(TAmmoType))), 'Invalid ammo scheme (incompatible frontend)', true);
+TryDo(byte(s[0]) = byte(ord(High(TAmmoType))) * 2, 'Invalid ammo scheme (incompatible frontend)', true);
-// FIXME - TEMPORARY hardcoded check on shoppa pending creation of probability editor
-substr:= Copy(s,1,15);
-if (substr = '000000990000009') or
- (substr = '000000990000000') then
- shoppa:= true;
-for a:= Low(TAmmoType) to High(TAmmoType) do
- if (ord(a) > 14) and (s[ord(a)] <> '0') then shoppa:= false; // TEMPORARY etc - this just avoids updating every time new wep is added
inc(StoreCnt);
TryDo(StoreCnt <= cMaxHHs, 'Ammo stores overflow', true);
@@ -82,34 +74,26 @@
begin
if a <> amNothing then
begin
+ Ammoz[a].Probability:= probability[byte(s[ord(a) + ord(High(TAmmoType))]) - byte('0')];
cnt:= byte(s[ord(a)]) - byte('0');
+ // avoid things we already have infinite number
if cnt = 9 then
begin
cnt:= AMMO_INFINITE;
- Ammoz[a].Probability:= 0
+ Ammoz[a].Probability:= 0
end;
+ // avoid things we already have by scheme
if ((a = amLowGravity) and ((GameFlags and gfLowGravity) <> 0)) or
((a = amInvulnerable) and ((GameFlags and gfInvulnerable) <> 0)) or
((a = amLaserSight) and ((GameFlags and gfLaserSight) <> 0)) or
((a = amVampiric) and ((GameFlags and gfVampiric) <> 0)) then
begin
cnt:= 0;
- Ammoz[a].Probability:= 0
- end
- else if shoppa then // FIXME - TEMPORARY REMOVE WHEN CRATE PROBABILITY IS ADDED
- if cnt <> AMMO_INFINITE then
- begin
- if a = amGirder then
- Ammoz[a].Probability:= 0
- else
- begin
- Ammoz[a].Probability:= 100;
- Ammoz[a].NumberInCase:= 1;
- end
- end;
+ Ammoz[a].Probability:= 0
+ end;
ammos[a]:= cnt
end else
- ammos[a]:= AMMO_INFINITE
+ ammos[a]:= AMMO_INFINITE
end;
FillAmmoStore(StoresList[Pred(StoreCnt)], ammos)