X-Git-Url: https://ruin.nu/git/?p=popboot.git;a=blobdiff_plain;f=node.cpp;h=ed72a7f60c5a5e289c33fe36592a715d4ec29cc1;hp=a9cb4539431d6d1f959339f9e042d867ba68fb74;hb=498b277372ebab0008b97399d387285b36d88826;hpb=066d3c3659f52a73a0344c3e08989cc73a15164b diff --git a/node.cpp b/node.cpp index a9cb453..ed72a7f 100644 --- a/node.cpp +++ b/node.cpp @@ -1,6 +1,24 @@ #include "node.h" +using namespace std; -Node::Node(Action action, std::vector children){ +Node::Node(Action action){ _action = action; - _children = children; +} + +Action Node::action(){ + return _action; +} + + +void Node::addChild(Node* node){ + _children.push_back(node); +} + + +void Node::execute(){ + _action.execute(); + + for(vector::iterator child = _children.begin(); child != _children.end(); ++child){ + (*child)->execute(); + } }