X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=action.cpp;h=87947ca054bb6684bfe9e23e006a16ff94df7c6c;hb=d69255d7d9263823c9d9bf850ffc88e1ab0e718e;hp=626eb37475bb5487756381dafcd823fd2188380f;hpb=e26fd7b3195576b25ffe51253a391b53f412a650;p=popboot.git diff --git a/action.cpp b/action.cpp index 626eb37..87947ca 100644 --- a/action.cpp +++ b/action.cpp @@ -1,24 +1,31 @@ #include "action.h" #include using namespace std; +using namespace __gnu_cxx; -Action::Action(std::string executable, literals preconditions, literals effects){ +const Literals Action::_empty; + +Action::Action(std::string name,const Preconditions& preconditions, std::string executable,const EffectsMap& effects){ + _name = name; _executable = executable; _preconditions = preconditions; _effects = effects; } Action::Action(const Action& action){ - _executable = action._executable; + _name = action._name; _preconditions = action._preconditions; _effects = action._effects; } -const literals& Action::effects() const{ - return _effects; +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{ +const Preconditions& Action::preconditions() const{ return _preconditions; } @@ -27,6 +34,6 @@ int Action::execute() const{ return 0; } -const string& Action::executable() const{ - return _executable; +const string& Action::name() const{ + return _name; }