share/hedgewars/Data/Scripts/Tracker.lua
changeset 11738 67049c8dedd1
parent 6438 b3a8718ac2a0
child 14235 8edbdd3a1fe7
equal deleted inserted replaced
11737:e28b534188d3 11738:67049c8dedd1
   241     for k, gear in ipairs(gears) do
   241     for k, gear in ipairs(gears) do
   242         func(gear)
   242         func(gear)
   243     end
   243     end
   244 end
   244 end
   245 
   245 
       
   246 -- Returns the first hog (alive or not) in the given clan
       
   247 function getFirstHogOfClan(clan)
       
   248     for k, hogs in pairs(teams) do
       
   249         for m, hog in ipairs(hogs) do
       
   250             if GetHogClan(hog) == clan then
       
   251                 return hog
       
   252             end
       
   253         end
       
   254     end
       
   255     return nil
       
   256 end
       
   257 
   246 -- Run a function on all tracked hogs
   258 -- Run a function on all tracked hogs
   247 function runOnHogs(func)
   259 function runOnHogs(func)
   248     for k, hogs in pairs(teams) do
   260     for k, hogs in pairs(teams) do
   249         for m, hog in ipairs(hogs) do
   261         for m, hog in ipairs(hogs) do
   250             func(hog)
   262             func(hog)