From afa02f645056c5823b0d8a29d37c1ff10aedce7a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 27 Feb 2024 21:53:44 -0600 Subject: init --- npc.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 npc.hpp (limited to 'npc.hpp') diff --git a/npc.hpp b/npc.hpp new file mode 100644 index 0000000..0f0cba4 --- /dev/null +++ b/npc.hpp @@ -0,0 +1,21 @@ +// Programmer: Brett Weiland +// Date: 4/30/23 +// File: npc.hpp +// Assignment: SP-B-finalProject +// Purpose: contains the functions shared between all npc derived objects + +template npc::npc() { id = id_counter++; } +template bool npc::is_active() const { return active; } +template int npc::get_id() const { return id; } + +template unsigned int npc::get_inventoryQty() const { return inventory_qty; } + +template unsigned int npc::get_inventoryValue() const { + unsigned int value = 0; + for(size_t inventory_i = 0; + (inventory_i < inventory_qty) && (inventory[inventory_i] != NULL); inventory_i++) { + value += inventory[inventory_i]->value(); + } + return value; +} + -- cgit v1.2.3