From e58ddac0cc42ac213ecf79a5ccae77ec293644df Mon Sep 17 00:00:00 2001 From: Tyfon Date: Tue, 2 Jul 2024 22:05:32 +0000 Subject: [PATCH] Fix InventoryHelper.canPlaceItemInContainer being backwards (!367) For whatever reason, `InventoryHelper.canPlaceItemInContainer()` currently returns: `true` if the item CANNOT be placed in the container `undefined` if the item CAN be placed `false` if the function thought it could but then failed when trying to (never happens?) This didn't cause problems because the only two places that call it also treat the return value backwards - both of which are also fixed in this PR. Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/367 Co-authored-by: Tyfon Co-committed-by: Tyfon --- project/src/helpers/InventoryHelper.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project/src/helpers/InventoryHelper.ts b/project/src/helpers/InventoryHelper.ts index 358f1a2b..7d799b13 100644 --- a/project/src/helpers/InventoryHelper.ts +++ b/project/src/helpers/InventoryHelper.ts @@ -232,7 +232,7 @@ export class InventoryHelper const stashFS2D = this.cloner.clone(this.getStashSlotMap(pmcData, sessionId)); for (const itemWithChildren of itemsWithChildren) { - if (this.canPlaceItemInContainer(stashFS2D, itemWithChildren)) + if (!this.canPlaceItemInContainer(stashFS2D, itemWithChildren)) { return false; } @@ -251,7 +251,7 @@ export class InventoryHelper { for (const itemWithChildren of itemsWithChildren) { - if (this.canPlaceItemInContainer(containerFS2D, itemWithChildren)) + if (!this.canPlaceItemInContainer(containerFS2D, itemWithChildren)) { return false; } @@ -296,10 +296,10 @@ export class InventoryHelper } // Success! exit - return; + return true; } - return true; + return false; } /**