hedgewars/uFLTeams.pas
branchqmlfrontend
changeset 10446 7ae44f42a689
parent 10442 c58db813240b
child 10448 4cb727e029fa
--- a/hedgewars/uFLTeams.pas	Sat Oct 25 00:31:10 2014 +0400
+++ b/hedgewars/uFLTeams.pas	Fri Oct 31 00:36:08 2014 +0300
@@ -8,6 +8,8 @@
 function getTeamsList: PPChar; cdecl;
 procedure freeTeamsList;
 
+function teamByName(s: shortstring): PTeam;
+
 implementation
 uses uFLUtils, uFLIPC, uPhysFSLayer;
 
@@ -156,6 +158,20 @@
     getTeamsList:= listOfTeamNames
 end;
 
+function teamByName(s: shortstring): PTeam;
+var i: Longword;
+    team: PTeam;
+begin
+    team:= teamsList;
+    i:= 0;
+    while (i < teamsNumber) and (team^.teamName <> s) do
+    begin
+        inc(team);
+        inc(i)
+    end;
+
+    if i < teamsNumber then teamByName:= team else teamByName:= nil
+end;
 
 procedure freeTeamsList;
 begin