Commit 1a421360 authored by drallensmith's avatar drallensmith

Further cleanup

parent 7e600ca6
...@@ -165,14 +165,6 @@ int Agent::getUnum() { ...@@ -165,14 +165,6 @@ int Agent::getUnum() {
return world().self().unum(); return world().self().unum();
} }
void Agent::setLastActionStatusCollision(bool may_fix, bool likely_success) {
if (likely_success || may_fix) {
last_action_status = true;
} else {
last_action_status = false;
}
}
bool Agent::initImpl(CmdLineParser & cmd_parser) { bool Agent::initImpl(CmdLineParser & cmd_parser) {
bool result = PlayerAgent::initImpl(cmd_parser); bool result = PlayerAgent::initImpl(cmd_parser);
...@@ -270,10 +262,12 @@ void Agent::actionImpl() { ...@@ -270,10 +262,12 @@ void Agent::actionImpl() {
switch(requested_action) { switch(requested_action) {
case DASH: case DASH:
setLastActionStatusCollision(may_fix, this->doDash(params[0], params[1])); last_action_status = this->doDash(params[0], params[1]);
last_action_status |= wm.self().collidesWithPost(); // Can sometimes get out of collision
break; break;
case TURN: case TURN:
setLastActionStatusCollision(may_fix, this->doTurn(params[0])); last_action_status = this->doTurn(params[0]);
last_action_status |= wm.self().collidesWithPost(); // ditto
break; break;
case TACKLE: case TACKLE:
last_action_status = this->doTackle(params[0], false); last_action_status = this->doTackle(params[0], false);
...@@ -290,22 +284,23 @@ void Agent::actionImpl() { ...@@ -290,22 +284,23 @@ void Agent::actionImpl() {
break; break;
case MOVE_TO: case MOVE_TO:
if (feature_extractor != NULL) { if (feature_extractor != NULL) {
setLastActionStatusCollision(may_fix, last_action_status = Body_GoToPoint(Vector2D(feature_extractor->absoluteXPos(params[0]),
Body_GoToPoint(Vector2D(feature_extractor->absoluteXPos(params[0]),
feature_extractor->absoluteYPos(params[1])), 0.25, feature_extractor->absoluteYPos(params[1])), 0.25,
ServerParam::i().maxDashPower()).execute(this)); ServerParam::i().maxDashPower()).execute(this);
last_action_status |= wm.self().collidesWithPost(); // can get out of collision w/post
} }
break; break;
case DRIBBLE_TO: case DRIBBLE_TO:
if (feature_extractor != NULL) { if (feature_extractor != NULL) {
setLastActionStatusCollision(may_fix, last_action_status = Body_Dribble(Vector2D(feature_extractor->absoluteXPos(params[0]),
Body_Dribble(Vector2D(feature_extractor->absoluteXPos(params[0]),
feature_extractor->absoluteYPos(params[1])), 1.0, feature_extractor->absoluteYPos(params[1])), 1.0,
ServerParam::i().maxDashPower(), 2).execute(this)); ServerParam::i().maxDashPower(), 2).execute(this);
last_action_status |= wm.self().collidesWithPost(); // ditto
} }
break; break;
case INTERCEPT: case INTERCEPT:
setLastActionStatusCollision(may_fix, Body_Intercept().execute(this)); last_action_status = Body_Intercept().execute(this);
last_action_status |= wm.self().collidesWithPost(); // ditto
break; break;
case MOVE: case MOVE:
last_action_status = this->doMove(); last_action_status = this->doMove();
...@@ -914,13 +909,13 @@ Agent::doDribble() ...@@ -914,13 +909,13 @@ Agent::doDribble()
M_action_generator = ActionGenerator::ConstPtr(g); M_action_generator = ActionGenerator::ConstPtr(g);
ActionChainHolder::instance().setFieldEvaluator( M_field_evaluator ); ActionChainHolder::instance().setFieldEvaluator( M_field_evaluator );
ActionChainHolder::instance().setActionGenerator( M_action_generator ); ActionChainHolder::instance().setActionGenerator( M_action_generator );
success = doPreprocess(); bool preprocess_success = doPreprocess();
ActionChainHolder::instance().update( world() ); ActionChainHolder::instance().update( world() );
if (Bhv_ChainAction(ActionChainHolder::instance().graph()).execute(this)) { if (Bhv_ChainAction(ActionChainHolder::instance().graph()).execute(this) ||
preprocess_success) {
return true; return true;
} else {
return success;
} }
return false;
} }
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
......
...@@ -99,7 +99,6 @@ protected: ...@@ -99,7 +99,6 @@ protected:
bool doDefendGoal(); bool doDefendGoal();
bool doGoToBall(); bool doGoToBall();
bool doNewAction1(); bool doNewAction1();
void setLastActionStatusCollision(bool may_fix, bool likely_success);
Communication::Ptr M_communication; Communication::Ptr M_communication;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment