diff options
author | root <root@bpcserver.bpcserver> | 2024-02-27 21:53:44 -0600 |
---|---|---|
committer | root <root@bpcserver.bpcserver> | 2024-02-27 21:53:44 -0600 |
commit | afa02f645056c5823b0d8a29d37c1ff10aedce7a (patch) | |
tree | 0bc89e7909c17d8f33538ac9f31a641872b89f40 /npc.hpp |
Diffstat (limited to 'npc.hpp')
-rw-r--r-- | npc.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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 <class T> npc<T>::npc() { id = id_counter++; } +template <class T> bool npc<T>::is_active() const { return active; } +template <class T> int npc<T>::get_id() const { return id; } + +template <class T> unsigned int npc<T>::get_inventoryQty() const { return inventory_qty; } + +template <class T> unsigned int npc<T>::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; +} + |