Code: Select all
i = 0;
for ( Inv=PawnOwner.Inventory; Inv!=None; Inv=Inv.Inventory )
{
if ( Inv.IsA('Weapon') && (Inv != PawnOwner.Weapon) )
{
W = Weapon(Inv);
if ( WeaponSlot[W.InventoryGroup] == None )
WeaponSlot[W.InventoryGroup] = W;
else if ( (WeaponSlot[W.InventoryGroup] != PawnOwner.Weapon)
&& ((W == PawnOwner.PendingWeapon) || (WeaponSlot[W.InventoryGroup].AutoSwitchPriority < W.AutoSwitchPriority)) )
WeaponSlot[W.InventoryGroup] = W;
}
i++;
if ( i > 100 )
break; // can occasionally get temporary loops in netplay
}
Code: Select all
ArmorAmount = 0;
CurAbs = 0;
i = 0;
BestArmor=None;
for( Inv=PawnOwner.Inventory; Inv!=None; Inv=Inv.Inventory )
{
if (Inv.bIsAnArmor)
{
if ( Inv.IsA('UT_Shieldbelt') )
bShieldbelt = true;
else if ( Inv.IsA('Thighpads') )
{
ThighAmount += Inv.Charge;
bThighArmor = true;
}
else
{
bChestArmor = true;
ChestAmount += Inv.Charge;
}
ArmorAmount += Inv.Charge;
}
else if ( Inv.IsA('UT_JumpBoots') )
bJumpBoots = true;
else
{
i++;
if ( i > 100 )
break; // can occasionally get temporary loops in netplay
}
}
I can confirm, this loops really happens. I can get it few times when want leave MH server and fast drop all my weapons to another player via ThrowWeapon key.
UT crash in my code in PostRender HUD, where exists loop:
Code: Select all
for( Inv=me.Inventory; Inv!=None; Inv=Inv.Inventory ) {
Code: Select all
ForEach me.AllActors(class'Weapon', weap) {
In any case, if you have some loops which similar, better implement similar check for avoid UT crash on some cases.