本文整理汇总了C++中AbstractKart::getFinishTime方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractKart::getFinishTime方法的具体用法?C++ AbstractKart::getFinishTime怎么用?C++ AbstractKart::getFinishTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractKart
的用法示例。
在下文中一共展示了AbstractKart::getFinishTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isChallengeFulfilled
/** Returns true if this (non-GP) challenge is fulfilled.
*/
bool ChallengeData::isChallengeFulfilled() const
{
// GP's use the grandPrixFinished() function,
// so they can't be fulfilled here.
if(m_mode==CM_GRAND_PRIX) return false;
// Single races
// ------------
World *world = World::getWorld();
std::string track_name = world->getTrack()->getIdent();
int d = race_manager->getDifficulty();
AbstractKart* kart = world->getPlayerKart(0);
if (kart->isEliminated() ) return false;
if (track_name != m_track_id ) return false;
if ((int)world->getNumKarts() < m_num_karts[d] ) return false;
if (m_energy[d] > 0 && kart->getEnergy() < m_energy[d] ) return false;
if (m_position[d] > 0 && kart->getPosition() > m_position[d]) return false;
// Follow the leader
// -----------------
if(m_minor==RaceManager::MINOR_MODE_FOLLOW_LEADER)
{
// All possible conditions were already checked, so:
// must have been successful
return true;
}
// Quickrace / Timetrial
// ---------------------
// FIXME - encapsulate this better, each race mode needs to be able
// to specify its own challenges and deal with them
LinearWorld* lworld = dynamic_cast<LinearWorld*>(world);
if(lworld != NULL)
{
// wrong number of laps
if(lworld->getLapForKart( kart->getWorldKartId() ) != m_num_laps)
return false;
}
// too slow
if (m_time[d] > 0.0f && kart->getFinishTime() > m_time[d]) return false;
if (m_ai_superpower[d] != RaceManager::SUPERPOWER_NONE &&
race_manager->getAISuperPower() != m_ai_superpower[d])
{
return false;
}
return true;
} // isChallengeFulfilled