本文整理汇总了C++中EvilNumber::to_float方法的典型用法代码示例。如果您正苦于以下问题:C++ EvilNumber::to_float方法的具体用法?C++ EvilNumber::to_float怎么用?C++ EvilNumber::to_float使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EvilNumber
的用法示例。
在下文中一共展示了EvilNumber::to_float方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateSkillQueue
void Character::UpdateSkillQueue()
{
Client *c = m_factory.entity_list.FindCharacter( itemID() );
SkillRef currentTraining = GetSkillInTraining();
if( currentTraining )
{
if( m_skillQueue.empty()
|| currentTraining->typeID() != m_skillQueue.front().typeID )
{
// either queue is empty or skill with different typeID is in training ...
// stop training:
_log( ITEM__ERROR, "%s (%u): Stopping training of skill %s (%u).", itemName().c_str(), itemID(), currentTraining->itemName().c_str(), currentTraining->itemID() );
/*
uint64 timeEndTrain = currentTraining->expiryTime();
if(timeEndTrain != 0)
{
double nextLevelSP = currentTraining->GetSPForLevel( currentTraining->skillLevel() + 1 );
double SPPerMinute = GetSPPerMin( currentTraining );
double minRemaining = (double)(timeEndTrain - Win32TimeNow()) / (double)Win32Time_Minute;
currentTraining->Set_skillPoints( nextLevelSP - (minRemaining * SPPerMinute) );
}
currentTraining->Clear_expiryTime();
*/
EvilNumber timeEndTrain = currentTraining->GetAttribute(AttrExpiryTime);
if (timeEndTrain != 0) {
EvilNumber nextLevelSP = currentTraining->GetSPForLevel( currentTraining->GetAttribute(AttrSkillLevel) + 1 );
EvilNumber SPPerMinute = GetSPPerMin( currentTraining );
EvilNumber minRemaining = (timeEndTrain - EvilNumber(Win32TimeNow())) / (double)Win32Time_Minute;
//currentTraining->Set_skillPoints( nextLevelSP - (minRemaining * SPPerMinute) );
EvilNumber skillPointsTrained = nextLevelSP - (minRemaining * SPPerMinute);
currentTraining->SetAttribute(AttrSkillPoints, skillPointsTrained);
sLog.Debug( "", "Skill %s (%u) trained %u skill points before termination from training queue", currentTraining->itemName().c_str(), currentTraining->itemID(), skillPointsTrained.get_float() );
}
currentTraining->SetAttribute(AttrExpiryTime, 0);
currentTraining->MoveInto( *this, flagSkill, true );
if( c != NULL )
{
OnSkillTrainingStopped osst;
osst.itemID = currentTraining->itemID();
osst.endOfTraining = 0;
PyTuple* tmp = osst.Encode();
c->QueueDestinyEvent( &tmp );
PySafeDecRef( tmp );
c->UpdateSkillTraining();
}
// nothing currently in training
currentTraining = SkillRef();
}
}
EvilNumber nextStartTime = EvilTimeNow();
while( !m_skillQueue.empty() )
{
if( !currentTraining )
{
// something should be trained, get desired skill
uint32 skillTypeID = m_skillQueue.front().typeID;
currentTraining = GetSkill( skillTypeID );
if( !currentTraining )
{
_log( ITEM__ERROR, "%s (%u): Skill %u to train was not found.", itemName().c_str(), itemID(), skillTypeID );
break;
}
sLog.Debug( "Character::UpdateSkillQueue()", "%s (%u): Starting training of skill %s (%u)", m_itemName.c_str(), m_itemID, currentTraining->itemName().c_str(), currentTraining->itemID() );
EvilNumber SPPerMinute = GetSPPerMin( currentTraining );
EvilNumber NextLevel = currentTraining->GetAttribute(AttrSkillLevel) + 1;
EvilNumber SPToNextLevel = currentTraining->GetSPForLevel( NextLevel ) - currentTraining->GetAttribute(AttrSkillPoints);
sLog.Debug( " ", "Training skill at %f SP/min", SPPerMinute.get_float() );
sLog.Debug( " ", "%f SP to next Level of %d", SPToNextLevel.get_float(), NextLevel.get_int() );
SPPerMinute.to_float();
SPToNextLevel.to_float();
nextStartTime.to_float();
EvilNumber timeTraining = nextStartTime + EvilTime_Minute * SPToNextLevel / SPPerMinute;
currentTraining->MoveInto( *this, flagSkillInTraining );
double dbl_timeTraining = timeTraining.get_float() + (double)(Win32Time_Second * 10);
currentTraining->SetAttribute(AttrExpiryTime, dbl_timeTraining); // Set server-side
// skill expiry + 10 sec
sLog.Debug( " ", "Calculated time to complete training = %s", Win32TimeToString((uint64)dbl_timeTraining).c_str() );
if( c != NULL )
{
//.........这里部分代码省略.........