0x4E3200 bool8 __thiscall Hero_ArtAdd_InBackPack(_Hero_ *hero, _Art_ *art, int slot_in_backpack)
// slot_in_backpack =-1 - to Any
if ( hero->ArtsCount_inBackpack >= 64 )
return 0;
v3 = art->id;
if ( art->id == 3 || v3 == 4 || v3 == 5 || v3 == 6 )
return 0;
slot = slot_in_backpack;
if ( slot_in_backpack < 0 )
{
slot = 0;
art_in_slot = hero->Arts_inBackpack; // _Artifact_ backpack_art[64]
do
{
if ( art_in_slot->id == -1 )
break;
++slot;
++art_in_slot;
}
while ( slot < 64 );
}
if ( hero->Arts_inBackpack[slot].id != -1 )
{
k = 63;
last_slot = &hero->Arts_inBackpack[63]; // last slot art in backpack
while ( last_slot->id == -1 )
{
v8 = k--;
--last_slot;
if ( !v8 )
{
k = -1;
break;
}
}
if ( k >= slot )
{
next_art = &hero->Arts_inBackpack[k + 1];
j = k - slot + 1;
do
{
next_art->id = next_art[-1].id;
next_art->Mod = next_art[-1].Mod;
--next_art;
--j;
}
while ( j );
}
}
hero->Arts_inBackpack[slot] = *art;
++hero->ArtsCount_inBackpack;
return 1;
}