]> ruin.nu Git - popboot.git/commitdiff
moved addNode
authorMichael Andreen <harv@ruin.nu>
Mon, 9 May 2005 10:44:55 +0000 (10:44 +0000)
committerMichael Andreen <harv@ruin.nu>
Mon, 9 May 2005 10:44:55 +0000 (10:44 +0000)
planner.cpp

index 6d70ae40df2114d32e6cf4f3ab611155e96b6aa6..1210d0479309df2ed3af1a2fe0b8f783fa5d1a33 100644 (file)
@@ -7,7 +7,6 @@ using namespace __gnu_cxx;
 Planner::Planner(std::vector<Action> actions, literals init, literals goal){
 
        _start = new Node(Action("start",literals(), init));
-       addNode(_start);
        Node* finish = new Node(Action("finish",goal,literals()));
 
        for(vector<Action>::iterator action = actions.begin(); action != actions.end(); ++action){
@@ -33,6 +32,8 @@ void Planner::makePlan(Node* node){
        const literals& preconds = node->action().preconditions();
        cerr << "done" << endl;
 
+       addNode(node);
+
        if (preconds.size() == 0){
                cerr << "Found no preconds" << endl;
                _start->addChild(node);
@@ -49,7 +50,6 @@ void Planner::makePlan(Node* node){
                                        cerr << "Adding new node" << endl;
                                        Node* newnode = new Node(action->second);
                                        newnode->addChild(node);
-                                       addNode(newnode);
                                        makePlan(newnode);
                                }else{
                                        cerr << "Action with effect: " << *precond << " not found!" << endl;