# HG changeset patch # User Ritor1 # Date 1384538544 -21600 # Node ID bb0da61e4a7e96915da25d8d434e05943043b983 # Parent beb97b20c3eda0d91a333c23ca7d9a6e9f849e93 substract item and AddItem for Alexis fix diff -r beb97b20c3ed -r bb0da61e4a7e Events.cpp --- a/Events.cpp Thu Nov 14 17:25:09 2013 +0600 +++ b/Events.cpp Sat Nov 16 00:02:24 2013 +0600 @@ -954,19 +954,23 @@ v4 = v124; break; } - v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix.data(); + //v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix.data(); for ( v65 = 0; v65 < 126; ++v65 ) { - if ( (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v67] == pValue ) + v67 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&pPlayers[uActiveCharacter]->pInventoryMatrix[v65]); + if (v67) + { + if ( pPlayers[uActiveCharacter]->pInventoryItemList[v67 - 1].uItemID == pValue ) { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pPlayers[uActiveCharacter]->pInventoryMatrix[v65]); ++curr_seq_num; v4 = v124; - break; + goto substract; } - v67 += 4; + } + //v67 += 4; } - while ( (signed int)v65 < 126 ); + //while ( (signed int)v65 < 126 ); v69 = (int)&pPlayers[uActiveCharacter]->pEquipment; for ( v68 = 0; v68 < 16; ++v68 ) { @@ -981,15 +985,19 @@ } for (int i = 1; i < 5; i++) { - v72 = (int)pPlayers[i]->pInventoryMatrix.data(); + //v72 = (int)pPlayers[i]->pInventoryMatrix.data(); for ( int v71 = 0; v71 < 126; ++v71 ) { - if ( (int)&pPlayers[i]->pInventoryItemList[v72] == pValue ) + v72 = pPlayers[i]->GetItemIDAtInventoryIndex(&pPlayers[i]->pInventoryMatrix[v71]); + if (v72) + { + if ( pPlayers[i]->pInventoryItemList[v72 - 1].uItemID == pValue ) { - pPlayers[i]->RemoveItemAtInventoryIndex(v71); - break; + pPlayers[i]->RemoveItemAtInventoryIndex(pPlayers[i]->pInventoryMatrix[v71]); + goto substract; } - v72 += 4; + } + //v72 += 4; } v73 = 0; v74 = (int)&pPlayers[i]->pEquipment; @@ -1031,6 +1039,7 @@ pPlayer = &pParty->pPlayers[player_choose]; pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); } +substract: ++curr_seq_num; v4 = v124; break; diff -r beb97b20c3ed -r bb0da61e4a7e Party.cpp --- a/Party.cpp Thu Nov 14 17:25:09 2013 +0600 +++ b/Party.cpp Sat Nov 16 00:02:24 2013 +0600 @@ -1120,9 +1120,13 @@ v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); v21 = areWeLoadingTexture; v8 = 0; + uint current_player = uActiveCharacter; for (int i = 0; i < 4; i++) { - v9 = ::pPlayers[(uActiveCharacter + i) % 4]; //start with current active player, then cycle right if item won't fit + current_player = current_player + i; + if ( current_player > 4 ) + current_player = current_player - 4; + v9 = ::pPlayers[current_player]; v10 = v9->AddItem(-1, pItem->uItemID); if ( v10 ) {