Inventory system is mostly working and I can pick up everything and use it.

This commit is contained in:
Zed A. Shaw 2025-01-04 13:32:26 -05:00
parent aaa6d9f9f3
commit 14b3ea7676
8 changed files with 56 additions and 47 deletions

View file

@ -37,7 +37,7 @@ TEST_CASE("basic inventory test", "[inventory]") {
System::pickup(world, player, sword);
REQUIRE(inventory.count() == 1);
// get the item and confirm there is 1
auto &item1 = inventory.get("SWORD_RUSTY");
auto &item1 = inventory.get(0);
REQUIRE(item1.count == 1);
System::pickup(world, player, sword);
@ -46,16 +46,16 @@ TEST_CASE("basic inventory test", "[inventory]") {
REQUIRE(inventory.count() == 1);
REQUIRE(item1.count == 4);
inventory.decrease("SWORD_RUSTY", 1);
inventory.decrease(0, 1);
REQUIRE(item1.count == 3);
inventory.decrease("SWORD_RUSTY", 2);
inventory.decrease(0, 2);
REQUIRE(item1.count == 1);
bool active = inventory.decrease("SWORD_RUSTY", 1);
bool active = inventory.decrease(0, 1);
REQUIRE(item1.count == 0);
REQUIRE(active == false);
inventory.remove_all("SWORD_RUSTY");
inventory.erase_item(0);
REQUIRE(inventory.count() == 0);
}