This is definitely wrong - sd->equip_index can be - 1 and we can't use unsigned for it...