diff options
Diffstat (limited to 'src/entities.cpp')
-rw-r--r-- | src/entities.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index af4b45f..cff971f 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -60,8 +60,19 @@ NPC::NPC(){ //sets all of the NPC specific traits on object creation canMove = true; } +void NPC::addAIFunc(int (*func)(NPC *)){ + aiFunc.push_back(func); +} + void NPC::interact(){ //have the npc's interact back to the player + int (*func)(NPC *); loc.y += 5; + if(aiFunc.size()){ + func=aiFunc.front(); + if(!func(this)){ + aiFunc.erase(aiFunc.begin()); + } + } } Structures::Structures(){ //sets the structure type |