hedgewars/uGears.pas
changeset 2790 83630d5f94db
parent 2786 85f6425a4d74
child 2792 a3efbf1c4500
--- a/hedgewars/uGears.pas	Wed Feb 10 02:03:41 2010 +0000
+++ b/hedgewars/uGears.pas	Wed Feb 10 09:52:00 2010 +0000
@@ -84,6 +84,7 @@
 procedure FreeGearsList;
 procedure AddMiscGears;
 procedure AssignHHCoords;
+function GearByUID(uid : Longword) : PGear;
 procedure InsertGearToList(Gear: PGear);
 procedure RemoveGearFromList(Gear: PGear);
 function ModifyDamage(dmg: Longword; Gear: PGear): Longword;
@@ -2093,6 +2094,22 @@
    ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent)
 end;
 
+function GearByUID(uid : Longword) : PGear;
+var gear: PGear;
+begin
+GearByUID:= nil;
+gear:= GearsList;
+while gear <> nil do
+	begin
+	if gear^.uid = uid then
+		begin
+			GearByUID:= gear;
+			exit
+		end;
+	gear:= gear^.NextGear
+	end
+end;
+
 procedure init_uGears;
 begin
 	CurAmmoGear:= nil;