hedgewars/uScript.pas
changeset 14500 4e5280a9e782
parent 14498 4b678aad50e9
child 14505 764ba6182389
--- a/hedgewars/uScript.pas	Wed Dec 19 20:27:35 2018 +0100
+++ b/hedgewars/uScript.pas	Wed Dec 19 20:34:07 2018 +0100
@@ -2298,13 +2298,13 @@
         ParseCommand('fort ' + lua_tostring(L, 4), true, true);
         ParseCommand('voicepack ' + lua_tostring(L, 5), true, true);
         if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true, true);
-        CurrentTeam^.Binds:= DefaultBinds
-        // fails on x64
-        //lua_pushnumber(L, LongInt(CurrentTeam));
-        end;
-    //else
-        //lua_pushnil(L)
-    lc_addteam:= 0;//1;
+        CurrentTeam^.Binds:= DefaultBinds;
+        // push team index
+        lua_pushnumber(L, TeamsCount - 1);
+        end
+    else
+        lua_pushnil(L);
+    lc_addteam:= 1;
 end;
 
 function lc_addmissionteam(L : Plua_State) : LongInt; Cdecl;
@@ -2339,9 +2339,13 @@
         ParseCommand('fort ' + MissionTeam^.FortName, true, true);
         ParseCommand('voicepack ' + MissionTeam^.Voicepack^.name, true, true);
         ParseCommand('flag ' + MissionTeam^.Flag, true, true);
-        CurrentTeam^.Binds:= DefaultBinds
-        end;
-    lc_addmissionteam:= 0;
+        CurrentTeam^.Binds:= DefaultBinds;
+        // push team index
+        lua_pushnumber(L, TeamsCount - 1);
+        end
+    else
+        lua_pushnil(L);
+    lc_addmissionteam:= 1;
 end;
 
 function lc_setteamlabel(L : Plua_State) : LongInt; Cdecl;