diff options
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 48 |
1 files changed, 48 insertions, 0 deletions
@@ -0,0 +1,48 @@ +#ifndef COP_H +#define COP_H + +// Programmer: Brett Weiland +// Date: 4/30/23 +// File: cop.h +// Assignment: SP-B-finalProject +// Purpose: defines cop npc which arrests robbers and takes money on contact. +// cops will also release robbers if bribed (see robbers.h). + +template <class T> +class robber; + +template <class T> +class cop : public npc<T> { + private: + unsigned int robbers_caught = 0; + public: + //overrides; see relevant files for descriptions + void move() override; //npc.h + char getIcon() const override; //gameObject.h + unsigned int get_drawPriority() const override; //gameObject.h + + //getters and setters + unsigned int get_robbersCaught() const; + + //Desc: notifies all previously arrested robbers are now active, set robbers_caught to 0. + //Pre: none + //Post: none + void robbersReleased(); + + //Desc: arrests robber, calls robbers getArrested() function. + // takes all robbers inventory for self. + //Pre: active robber is passed + //Post: robber is arrested + void arrest(robber<T> &offender); + + //Desc: robber calls this when they want to give us a bribe. + // Take an inventory item for ourselves, release all robbers. + //Pre: Item is passed as bribe + //Post: bribe is put into inventory, all robbers released. Robber not arrested as a result. + void takeBribe(T *bribe); + +}; + +#include "cop.hpp" + +#endif |