MCPcopy Create free account
hub / github.com/LARG/HFO / doPreprocess

Method doPreprocess

src/agent.cpp:630–741  ·  view source on GitHub ↗

-------------------------------------------------------------------*/ ! */

Source from the content-addressed store, hash-verified

628/*!
629*/
630bool
631Agent::doPreprocess()
632{
633 // check tackle expires
634 // check self position accuracy
635 // ball search
636 // check queued intention
637 // check simultaneous kick
638
639 const WorldModel & wm = this->world();
640
641 dlog.addText( Logger::TEAM,
642 __FILE__": (doPreProcess)" );
643
644 //
645 // freezed by tackle effect
646 //
647 if ( wm.self().isFrozen() )
648 {
649 dlog.addText( Logger::TEAM,
650 __FILE__": tackle wait. expires= %d",
651 wm.self().tackleExpires() );
652 // face neck to ball
653 this->setViewAction( new View_Tactical() );
654 this->setNeckAction( new Neck_TurnToBallOrScan() );
655 return true;
656 }
657
658 //
659 // BeforeKickOff or AfterGoal. jump to the initial position
660 //
661 if ( wm.gameMode().type() == GameMode::BeforeKickOff
662 || wm.gameMode().type() == GameMode::AfterGoal_ )
663 {
664 dlog.addText( Logger::TEAM,
665 __FILE__": before_kick_off" );
666 Vector2D move_point = Strategy::i().getPosition( wm.self().unum() );
667 Bhv_CustomBeforeKickOff( move_point ).execute( this );
668 this->setViewAction( new View_Tactical() );
669 return true;
670 }
671
672 //
673 // self localization error
674 //
675 if ( ! wm.self().posValid() )
676 {
677 dlog.addText( Logger::TEAM,
678 __FILE__": invalid my pos" );
679 Bhv_Emergency().execute( this ); // includes change view
680 return true;
681 }
682
683 //
684 // ball localization error
685 //
686 const int count_thr = ( wm.self().goalie()
687 ? 10

Callers

nothing calls this directly

Calls 3

getPositionMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected