Make ammo scheme work qmlfrontend
authorunc0rr
Sat, 11 Apr 2015 22:39:29 +0300
branchqmlfrontend
changeset 10892 83a99e2f8b00
parent 10890 24e68c7d2e79
child 10894 6157d057f04e
Make ammo scheme work
hedgewars/uFLAmmo.pas
hedgewars/uFLGameConfig.pas
hedgewars/uFLTypes.pas
--- a/hedgewars/uFLAmmo.pas	Sat Apr 11 17:23:56 2015 +0300
+++ b/hedgewars/uFLAmmo.pas	Sat Apr 11 22:39:29 2015 +0300
@@ -58,7 +58,11 @@
                 ammo^.ammoName:= copy(s, 1, i - 1);
                 delete(s, 1, i);
                 // TODO: split into 4 shortstrings
-                ammo^.ammoStr:= s;
+                i:= length(s) div 4;
+                ammo^.a:= copy(s, 1, i);
+                ammo^.b:= copy(s, i + 1, i);
+                ammo^.c:= copy(s, i * 2 + 1, i);
+                ammo^.d:= copy(s, i * 3 + 1, i);
                 inc(ammo)
             end;
         end;
@@ -121,8 +125,10 @@
 begin
     with ammo do
     begin
-        //ipcToEngine('e$turntime ' + inttostr(ammo.turntime * 1000));
-        //ipcToEngine('e$minesnum ' + inttostr(ammo.minesnum));
+        ipcToEngine('eammloadt ' + ammo.a);
+        ipcToEngine('eammprob '  + ammo.b);
+        ipcToEngine('eammdelay ' + ammo.c);
+        ipcToEngine('eammreinf ' + ammo.d);
     end
 end;
 
--- a/hedgewars/uFLGameConfig.pas	Sat Apr 11 17:23:56 2015 +0300
+++ b/hedgewars/uFLGameConfig.pas	Sat Apr 11 22:39:29 2015 +0300
@@ -36,7 +36,7 @@
             theme: shortstring;
             script: shortstring;
             scheme: TScheme;
-            ammo: ansistring;
+            ammo: TAmmo;
             mapgen: Longint;
             gameType: TGameType;
             teams: array[0..7] of TTeam;
@@ -74,10 +74,7 @@
             i:= 0;
             while (i < 8) and (teams[i].hogsNumber > 0) do
                 begin
-                    ipcToEngine('eammloadt 93919294221991210322351110012000000002111001010111110001');
-                    ipcToEngine('eammprob 04050405416006555465544647765766666661555101011154111111');
-                    ipcToEngine('eammdelay 00000000000002055000000400070040000000002200000006000200');
-                    ipcToEngine('eammreinf 13111103121111111231141111111111111112111111011111111111');
+                    sendAmmoConfig(config^.ammo);
                     ipcToEngine('eammstore');
                     sendTeamConfig(teams[i]);
                     inc(i)
@@ -344,7 +341,7 @@
     ammo:= ammoByName(ammoName);
 
     if ammo <> nil then
-        currentConfig.ammo:= ammo^.ammoStr
+        currentConfig.ammo:= ammo^
 end;
 
 end.
--- a/hedgewars/uFLTypes.pas	Sat Apr 11 17:23:56 2015 +0300
+++ b/hedgewars/uFLTypes.pas	Sat Apr 11 22:39:29 2015 +0300
@@ -77,7 +77,7 @@
     PScheme = ^TScheme;
     TAmmo = record
             ammoName: shortstring;
-            ammoStr: shortstring;
+            a, b, c, d: shortstring;
         end;
     PAmmo = ^TAmmo;