]> ruin.nu Git - popboot.git/blobdiff - action.cpp
some done, need parser
[popboot.git] / action.cpp
index 7b7a58807f5536e436e615a82ac19b2a2373831d..87947ca054bb6684bfe9e23e006a16ff94df7c6c 100644 (file)
@@ -3,13 +3,13 @@
 using namespace std;
 using namespace __gnu_cxx;
 
-const literals Action::_empty;
+const Literals Action::_empty;
 
-Action::Action(std::string name, preconditionsVector preconditions, effectsMap effects){
+Action::Action(std::string name,const Preconditions& preconditions, std::string executable,const EffectsMap& effects){
        _name = name;
+       _executable = executable;
        _preconditions = preconditions;
        _effects = effects;
-       _currentPrecondition = _preconditions.begin();
 }
 
 Action::Action(const Action& action){
@@ -18,32 +18,22 @@ Action::Action(const Action& action){
        _effects = action._effects;
 }
 
-const literals& Action::effects(int value) const{
-       effectsMap::const_iterator effects = _effects.find(value);
+const Literals& Action::effects(int value) const{
+       EffectsMap::const_iterator effects = _effects.find(value);
        if (effects != _effects.end())
                return effects->second;
        return _empty;
 }
 
-const literals& Action::preconditions() const{
-       return _currentPrecondition->second;
+const Preconditions& Action::preconditions() const{
+       return _preconditions;
 }
 
 int Action::execute() const{
-       cout << "Executing: " << _currentPrecondition->first << endl;
+       cout << "Executing: " << _executable << endl;
        return 0;
 }
 
 const string& Action::name() const{
        return _name;
 }
-
-bool Action::nextExecutable(){
-       if (++_currentPrecondition != _preconditions.end())
-               return true;
-       return false;
-}
-
-void Action::reset(){
-       _currentPrecondition = _preconditions.begin();
-}