hedgewars/uFLGameConfig.pas
branchqmlfrontend
changeset 11437 6e641b5453f9
parent 11434 23912c93935a
child 11438 1a6148b4de3b
--- a/hedgewars/uFLGameConfig.pas	Tue Dec 01 19:49:59 2015 +0300
+++ b/hedgewars/uFLGameConfig.pas	Tue Dec 01 23:37:10 2015 +0300
@@ -26,6 +26,7 @@
 procedure netSetMap(map: shortstring);
 procedure netSetMazeSize(mazesize: LongInt);
 procedure netSetTemplate(template: LongInt);
+procedure netSetAmmo(name: shortstring; definition: ansistring);
 procedure updatePreviewIfNeeded;
 
 procedure sendConfig(config: PGameConfig);
@@ -70,9 +71,8 @@
             i:= 0;
             while (i < 8) and (teams[i].hogsNumber > 0) do
                 begin
+                    sendTeamConfig(teams[i]);
                     sendAmmoConfig(config^.ammo);
-                    ipcToEngine('eammstore');
-                    sendTeamConfig(teams[i]);
                     inc(i)
                 end;
         end;
@@ -257,7 +257,7 @@
 procedure changeTeamColor(teamName: PChar; dir: LongInt); cdecl;
 var i, dc: Longword;
     tn: shortstring;
-    msg: ansistring;
+    msg:  ansistring;
 begin
     with currentConfig do
     begin
@@ -393,4 +393,19 @@
         getPreview
 end;
 
+procedure netSetAmmo(name: shortstring; definition: ansistring);
+var ammo: TAmmo;
+    i: LongInt;
+begin
+    ammo.ammoName:= name;
+    i:= length(definition) div 4;
+    ammo.a:= copy(definition, 1, i);
+    ammo.b:= copy(definition, i + 1, i);
+    ammo.c:= copy(definition, i * 2 + 1, i);
+    ammo.d:= copy(definition, i * 3 + 1, i);
+
+    currentConfig.ammo:= ammo;
+    sendUI(mtAmmo, @name[1], length(name))
+end;
+
 end.