share/hedgewars/Data/Scripts/Tracker.lua
branchqmlfrontend
changeset 11828 a69124eb7ce7
parent 11733 67049c8dedd1
child 14230 8edbdd3a1fe7
--- a/share/hedgewars/Data/Scripts/Tracker.lua	Tue May 17 23:18:08 2016 +0300
+++ b/share/hedgewars/Data/Scripts/Tracker.lua	Tue May 17 23:29:49 2016 +0300
@@ -243,6 +243,18 @@
     end
 end
 
+-- Returns the first hog (alive or not) in the given clan
+function getFirstHogOfClan(clan)
+    for k, hogs in pairs(teams) do
+        for m, hog in ipairs(hogs) do
+            if GetHogClan(hog) == clan then
+                return hog
+            end
+        end
+    end
+    return nil
+end
+
 -- Run a function on all tracked hogs
 function runOnHogs(func)
     for k, hogs in pairs(teams) do