const ServerParam & SP = ServerParam::i(); const int self_min = wm.interceptTable()->selfReachCycle(); const int mate_min = wm.interceptTable()->teammateReachCycle(); int opp_min = wm.interceptTable()->opponentReachCycle(); const PlayerObject * opp_fastest = wm.interceptTable()->fastestOpponent(); if ( opp_fastest && opp_fastest->goalie() && wm.gameMode().isPenaltyKickMode() && opp_fastest->pos().dist( wm.ball().pos() ) >= 3.0 ) // MAGIC NUMBER { M_tackle_situation = false; M_opponent_ball = false; dlog.addText( Logger::TEAM, __FILE__":(update) penalty shootouts. not a tackle situation" ); return; } if ( opp_fastest && wm.gameMode().isPenaltyKickMode() && ! opp_fastest->goalie() ) { const AbstractPlayerObject * opponent_goalie = wm.getTheirGoalie(); if ( opponent_goalie ) { /* //yz del std::map< const AbstractPlayerObject*, int >::const_iterator player_map_it = wm.interceptTable()->playerMap().find( opponent_goalie ); if ( player_map_it != wm.interceptTable()->playerMap().end() ) { // considering only opponent goalie in penalty-kick mode opp_min = player_map_it->second; dlog.addText( Logger::TEAM, __FILE__":(update) replaced min_opp with goalie's reach cycle (%d).", opp_min ); } else { opp_min = 1000000; // practically canceling the fastest non-goalie opponent player dlog.addText( Logger::TEAM, __FILE__":%d: (update) set opp_min as 1000000 so as not to consider the fastest opponent.", __LINE__ ); } */ } else { opp_min = 1000000; // practically canceling the fastest non-goalie opponent player dlog.addText( Logger::TEAM, __FILE__":%d (update) set opp_min as 1000000 so as not to consider the fastest opponent.", __LINE__); } }
时间: 2024-02-10 10:31:23 浏览: 69
HTTP-Status-Const:HTTP-Status-Const 的只读发布历史
这段代码中,我们首先创建了一个常量引用 `SP`,表示 `ServerParam::i()` 返回的 `ServerParam` 对象。
接下来,我们使用 `wm.interceptTable()` 对象的方法获取最小的自己到达周期 `self_min`,最小的队友到达周期 `mate_min`,以及最小的对手到达周期 `opp_min`。
然后,我们使用 `wm.interceptTable()` 对象的方法获取最快的对手球员 `opp_fastest`。
接下来的条件判断语句检查以下情况:
- 如果最快的对手球员存在,并且是守门员,并且当前是点球模式,并且最快的对手球员与球的距离大于等于 3.0(一个魔术数),则将 `M_tackle_situation` 和 `M_opponent_ball` 都设置为假,并记录日志。然后返回。
- 如果最快的对手球员存在,并且当前是点球模式,并且最快的对手球员不是守门员,则获取对方守门员的信息,并根据情况更新 `opp_min` 的值。如果对方守门员存在,则更新 `opp_min` 为守门员的到达周期。如果对方守门员不存在,则将 `opp_min` 设置为一个很大的值(1000000),表示取消考虑最快的非守门员对手球员。然后记录日志。
阅读全文