hedgewars/uScript.pas
branchflibqtfrontend
changeset 8224 48bb7adc42fe
parent 8145 6408c0ba4ba1
child 8330 aaefa587e277
child 8366 67c7ba2b82a3
equal deleted inserted replaced
8222:d3dc08500fc0 8224:48bb7adc42fe
   688     if lua_gettop(L) <> 1 then
   688     if lua_gettop(L) <> 1 then
   689         LuaError('Lua: Wrong number of parameters passed to GetHogLevel!')
   689         LuaError('Lua: Wrong number of parameters passed to GetHogLevel!')
   690     else
   690     else
   691         begin
   691         begin
   692         gear := GearByUID(lua_tointeger(L, 1));
   692         gear := GearByUID(lua_tointeger(L, 1));
   693         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   693         if (gear <> nil) and ((gear^.Kind = gtHedgehog) or (gear^.Kind = gtGrave)) and (gear^.Hedgehog <> nil) then
   694             lua_pushinteger(L, gear^.Hedgehog^.BotLevel)
   694             lua_pushinteger(L, gear^.Hedgehog^.BotLevel)
   695         else
   695         else
   696             lua_pushnil(L);
   696             lua_pushnil(L);
   697     end;
   697     end;
   698     lc_gethoglevel := 1;
   698     lc_gethoglevel := 1;
   721         lua_pushnil(L); // return value on stack (nil)
   721         lua_pushnil(L); // return value on stack (nil)
   722         end
   722         end
   723     else
   723     else
   724         begin
   724         begin
   725         gear:= GearByUID(lua_tointeger(L, 1));
   725         gear:= GearByUID(lua_tointeger(L, 1));
   726         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   726         if (gear <> nil) and ((gear^.Kind = gtHedgehog) or (gear^.Kind = gtGrave)) and (gear^.Hedgehog <> nil) then
   727             begin
   727             begin
   728             lua_pushinteger(L, gear^.Hedgehog^.Team^.Clan^.ClanIndex)
   728             lua_pushinteger(L, gear^.Hedgehog^.Team^.Clan^.ClanIndex)
   729             end
   729             end
   730         else
   730         else
   731             lua_pushnil(L);
   731             lua_pushnil(L);
   803         lua_pushnil(L); // return value on stack (nil)
   803         lua_pushnil(L); // return value on stack (nil)
   804         end
   804         end
   805     else
   805     else
   806         begin
   806         begin
   807         gear:= GearByUID(lua_tointeger(L, 1));
   807         gear:= GearByUID(lua_tointeger(L, 1));
   808         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   808         if (gear <> nil) and ((gear^.Kind = gtHedgehog) or (gear^.Kind = gtGrave)) and (gear^.Hedgehog <> nil) then
   809             begin
   809             begin
   810             lua_pushstring(L, str2pchar(gear^.Hedgehog^.Team^.TeamName))
   810             lua_pushstring(L, str2pchar(gear^.Hedgehog^.Team^.TeamName))
   811             end
   811             end
   812         else
   812         else
   813             lua_pushnil(L);
   813             lua_pushnil(L);
   824         lua_pushnil(L); // return value on stack (nil)
   824         lua_pushnil(L); // return value on stack (nil)
   825         end
   825         end
   826     else
   826     else
   827         begin
   827         begin
   828         gear:= GearByUID(lua_tointeger(L, 1));
   828         gear:= GearByUID(lua_tointeger(L, 1));
   829         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   829         if (gear <> nil) and ((gear^.Kind = gtHedgehog) or (gear^.Kind = gtGrave)) and (gear^.Hedgehog <> nil) then
   830             begin
   830             begin
   831             lua_pushstring(L, str2pchar(gear^.Hedgehog^.Name))
   831             lua_pushstring(L, str2pchar(gear^.Hedgehog^.Name))
   832             end
   832             end
   833         else
   833         else
   834             lua_pushnil(L);
   834             lua_pushnil(L);
  1646 begin
  1646 begin
  1647     if lua_gettop(L) <> 1 then
  1647     if lua_gettop(L) <> 1 then
  1648         LuaError('Lua: Wrong number of parameters passed to GetHogHat!')
  1648         LuaError('Lua: Wrong number of parameters passed to GetHogHat!')
  1649     else begin
  1649     else begin
  1650         gear := GearByUID(lua_tointeger(L, 1));
  1650         gear := GearByUID(lua_tointeger(L, 1));
  1651         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
  1651         if (gear <> nil) and ((gear^.Kind = gtHedgehog) or (gear^.Kind = gtGrave)) and (gear^.Hedgehog <> nil) then
  1652             lua_pushstring(L, str2pchar(gear^.Hedgehog^.Hat))
  1652             lua_pushstring(L, str2pchar(gear^.Hedgehog^.Hat))
  1653         else
  1653         else
  1654             lua_pushnil(L);
  1654             lua_pushnil(L);
  1655     end;
  1655     end;
  1656     lc_gethoghat := 1;
  1656     lc_gethoghat := 1;