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

Method doPreprocess

src/sample_player.cpp:507–618  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

505/*!
506*/
507bool
508SamplePlayer::doPreprocess()
509{
510 // check tackle expires
511 // check self position accuracy
512 // ball search
513 // check queued intention
514 // check simultaneous kick
515
516 const WorldModel & wm = this->world();
517
518 dlog.addText( Logger::TEAM,
519 __FILE__": (doPreProcess)" );
520
521 //
522 // freezed by tackle effect
523 //
524 if ( wm.self().isFrozen() )
525 {
526 dlog.addText( Logger::TEAM,
527 __FILE__": tackle wait. expires= %d",
528 wm.self().tackleExpires() );
529 // face neck to ball
530 this->setViewAction( new View_Tactical() );
531 this->setNeckAction( new Neck_TurnToBallOrScan() );
532 return true;
533 }
534
535 //
536 // BeforeKickOff or AfterGoal. jump to the initial position
537 //
538 if ( wm.gameMode().type() == GameMode::BeforeKickOff
539 || wm.gameMode().type() == GameMode::AfterGoal_ )
540 {
541 dlog.addText( Logger::TEAM,
542 __FILE__": before_kick_off" );
543 Vector2D move_point = Strategy::i().getPosition( wm.self().unum() );
544 Bhv_CustomBeforeKickOff( move_point ).execute( this );
545 this->setViewAction( new View_Tactical() );
546 return true;
547 }
548
549 //
550 // self localization error
551 //
552 if ( ! wm.self().posValid() )
553 {
554 dlog.addText( Logger::TEAM,
555 __FILE__": invalid my pos" );
556 Bhv_Emergency().execute( this ); // includes change view
557 return true;
558 }
559
560 //
561 // ball localization error
562 //
563 const int count_thr = ( wm.self().goalie()
564 ? 10

Callers

nothing calls this directly

Calls 3

getPositionMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected