rendered paste bodysigned int __thiscall CTradeWnd__DropItemIntoTrade(void *this)
{
void *v1; // edi@1
signed int result; // eax@2
signed int v3; // esi@6
int v4; // edi@7
int v5; // ecx@8
signed int v6; // esi@15
int v7; // edi@16
char *v8; // eax@22
void *v9; // [sp+8h] [bp-Ch]@1
signed int v10; // [sp+Ch] [bp-8h]@1
signed int v11; // [sp+10h] [bp-4h]@3
v10 = -1;
v1 = this;
v9 = this;
if ( *(_BYTE *)(dword_766640 + 308) )
{
v11 = 4;
}
else
{
result = CanDrop(*(_DWORD *)(dword_766660 + 5980), 1);
if ( !result )
return result;
v11 = 8;
}
if ( Combine(*(_DWORD *)(dword_766660 + 5980)) )
{
v3 = 0;
if ( v11 > 0 )
{
v4 = (int)((char *)v1 + 464);
do
{
v5 = *(_DWORD *)(dword_766660 + 5980);
if ( !v5 )
break;
if ( *(_DWORD *)v4 )
{
if ( *(_DWORD *)(v5 + 236) == *(_DWORD *)(*(_DWORD *)v4 + 236) )
{
if ( SwapCombine(dword_766660 + 5980, v4, 30, v3 + 3000) )
v10 = v3;
}
}
++v3;
v4 += 4;
}
while ( v3 < v11 );
}
}
if ( *(_DWORD *)(dword_766660 + 5980) )
{
v6 = 0;
if ( v11 > 0 )
{
v7 = (int)((char *)v9 + 464);
do
{
if ( !*(_DWORD *)(dword_766660 + 5980) )
break;
if ( !*(_DWORD *)v7 )
{
CInvSlotMgr__MoveItem(30, v6 + 3000, 0, 1);
v10 = v6;
}
++v6;
v7 += 4;
}
while ( v6 < v11 );
}
}
if ( v10 == -1 )
{
v8 = (char *)StringTable__getString(12319, 0);
CEverQuest__dsp_chat(v8, 10, 1);
}
else
{
CTradeWnd__SetHisReadyTrade(0);
}
result = LODWORD(dword_766688);
if ( *(_DWORD *)(dword_766660 + 5980) )
*(_BYTE *)(LODWORD(dword_766688) + 24) = 1;
else
*(_BYTE *)(LODWORD(dword_766688) + 24) = 0;
return result;
}