aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities.cpp')
-rw-r--r--src/entities.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index 14048a0..9fe05c7 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -66,8 +66,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