本文整理汇总了C++中WorldModel::teamName方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldModel::teamName方法的具体用法?C++ WorldModel::teamName怎么用?C++ WorldModel::teamName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldModel
的用法示例。
在下文中一共展示了WorldModel::teamName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: s_update_time
/*!
*/
void
Strategy::updatePosition( const WorldModel & wm )
{
static GameTime s_update_time( 0, 0 );
if ( s_update_time == wm.time() )
{
return;
}
s_update_time = wm.time();
Formation::Ptr f = getFormation( wm );
if ( ! f )
{
std::cerr << wm.teamName() << ':' << wm.self().unum() << ": "
<< wm.time()
<< " ***ERROR*** could not get the current formation" << std::endl;
return;
}
int ball_step = 0;
if ( wm.gameMode().type() == GameMode::PlayOn
|| wm.gameMode().type() == GameMode::GoalKick_ )
{
ball_step = std::min( 1000, wm.interceptTable()->teammateReachCycle() );
ball_step = std::min( ball_step, wm.interceptTable()->opponentReachCycle() );
ball_step = std::min( ball_step, wm.interceptTable()->selfReachCycle() );
}
Vector2D ball_pos = wm.ball().inertiaPoint( ball_step );
dlog.addText( Logger::TEAM,
__FILE__": HOME POSITION: ball pos=(%.1f %.1f) step=%d",
ball_pos.x, ball_pos.y,
ball_step );
M_positions.clear();
f->getPositions( ball_pos, M_positions );
if ( ServerParam::i().useOffside() )
{
double max_x = wm.offsideLineX();
if ( ServerParam::i().kickoffOffside()
&& ( wm.gameMode().type() == GameMode::BeforeKickOff
|| wm.gameMode().type() == GameMode::AfterGoal_ ) )
{
max_x = 0.0;
}
else
{
int mate_step = wm.interceptTable()->teammateReachCycle();
if ( mate_step < 50 )
{
Vector2D trap_pos = wm.ball().inertiaPoint( mate_step );
if ( trap_pos.x > max_x ) max_x = trap_pos.x;
}
max_x -= 1.0;
}
for ( int unum = 1; unum <= 11; ++unum )
{
if ( M_positions[unum-1].x > max_x )
{
dlog.addText( Logger::TEAM,
"____ %d offside. home_pos_x %.2f -> %.2f",
unum,
M_positions[unum-1].x, max_x );
M_positions[unum-1].x = max_x;
}
}
}
M_position_types.clear();
for ( int unum = 1; unum <= 11; ++unum )
{
PositionType type = Position_Center;
if ( f->isSideType( unum ) )
{
type = Position_Left;
}
else if ( f->isSymmetryType( unum ) )
{
type = Position_Right;
}
M_position_types.push_back( type );
dlog.addText( Logger::TEAM,
"__ %d home pos (%.2f %.2f) type=%d",
unum,
M_positions[unum-1].x, M_positions[unum-1].y,
type );
dlog.addCircle( Logger::TEAM,
M_positions[unum-1], 0.5,
"#000000" );
}
}