hedgewars/uScript.pas
changeset 5553 4bb542350a18
parent 5552 8694688ccc1c
child 5554 b27ed6c6f538
equal deleted inserted replaced
5552:8694688ccc1c 5553:4bb542350a18
  1113     lc_playsound:= 0;
  1113     lc_playsound:= 0;
  1114 end;
  1114 end;
  1115 
  1115 
  1116 function lc_addteam(L : Plua_State) : LongInt; Cdecl;
  1116 function lc_addteam(L : Plua_State) : LongInt; Cdecl;
  1117 var np: LongInt;
  1117 var np: LongInt;
  1118     voice: shortstring;
  1118     color, name, grave, fort, voice, flag: shortstring;
  1119 begin
  1119 begin
  1120     np:= lua_gettop(L);
  1120     np:= lua_gettop(L);
  1121     if (np < 5) or (np > 6) then
  1121     if (np < 5) or (np > 6) then
  1122         begin
  1122         begin
  1123         LuaError('Lua: Wrong number of parameters passed to AddTeam!');
  1123         LuaError('Lua: Wrong number of parameters passed to AddTeam!');
  1126     else
  1126     else
  1127         begin
  1127         begin
  1128 (*
  1128 (*
  1129  FIXME FIXME FIXME FIXME
  1129  FIXME FIXME FIXME FIXME
  1130  Something is very wrong here.
  1130  Something is very wrong here.
  1131  For some reason, if I assign voice after the first ParseCommand, it is empty
  1131  For some reason, the lua_tostring after the first ParseCommand, are empty.  Is ParseCommand scribbling on stuff?
  1132 *)
  1132 *)
       
  1133         color:= lua_tostring(L, 1);
       
  1134         name := lua_tostring(L, 2);
       
  1135         grave:= lua_tostring(L, 3);
       
  1136         fort := lua_tostring(L, 4);
  1133         voice:= lua_tostring(L, 5);
  1137         voice:= lua_tostring(L, 5);
  1134         ParseCommand('addteam x ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 1), true);
  1138         if (np = 6) flag:= lua_tostring(L, 6);
  1135         ParseCommand('grave ' + lua_tostring(L, 3), true);
  1139         ParseCommand('addteam x ' + name + ' ' + color, true);
  1136         ParseCommand('fort ' + lua_tostring(L, 4), true);
  1140         ParseCommand('grave ' + grave, true);
       
  1141         ParseCommand('fort ' + fort, true);
  1137         ParseCommand('voicepack ' + voice, true);
  1142         ParseCommand('voicepack ' + voice, true);
  1138         if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true);
  1143         if (np = 6) then ParseCommand('flag ' + flag, true);
  1139         CurrentTeam^.Binds:= DefaultBinds
  1144         CurrentTeam^.Binds:= DefaultBinds
  1140         // fails on x64
  1145         // fails on x64
  1141         //lua_pushinteger(L, LongInt(CurrentTeam));
  1146         //lua_pushinteger(L, LongInt(CurrentTeam));
  1142         end;
  1147         end;
  1143     lc_addteam:= 0;//1;
  1148     lc_addteam:= 0;//1;