hedgewars/uScript.pas
changeset 7312 d1db8aaa8edc
parent 7307 f830a65d6a6d
child 7337 c224cd2d32f3
--- a/hedgewars/uScript.pas	Wed Jun 27 18:02:45 2012 +0200
+++ b/hedgewars/uScript.pas	Wed Jun 27 18:04:17 2012 +0200
@@ -184,10 +184,19 @@
 end;
 
 function lc_parsecommand(L : Plua_State) : LongInt; Cdecl;
+var t: PChar;
+    i,c: LongWord;
+    s: shortstring;
 begin
     if lua_gettop(L) = 1 then
         begin
-        ParseCommand(lua_tostring(L ,1), true);
+        t:= lua_tolstring(L,1,@c);
+
+        for i:= 1 to c do s[i]:= t[i-1];
+        s[0]:= char(c);
+
+        ParseCommand(s, true);
+
         end
     else
         LuaError('Lua: Wrong number of parameters passed to ParseCommand!');
@@ -973,10 +982,9 @@
             prevgear^.Z := cHHZ;
             RemoveGearFromList(prevgear);
             InsertGearToList(prevgear);
-
-            CurrentHedgehog := gear^.Hedgehog;
-// yes, this will muck up turn sequence
-            CurrentTeam := gear^.Hedgehog^.Team;
+            
+            SwitchCurrentHedgehog(gear^.Hedgehog);
+            CurrentTeam:= CurrentHedgehog^.Team;
 
             gear^.State:= gear^.State or gstHHDriven;
             gear^.Active := true;