本文整理汇总了C++中CItem::GetTimerAdjusted方法的典型用法代码示例。如果您正苦于以下问题:C++ CItem::GetTimerAdjusted方法的具体用法?C++ CItem::GetTimerAdjusted怎么用?C++ CItem::GetTimerAdjusted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItem
的用法示例。
在下文中一共展示了CItem::GetTimerAdjusted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Announce
void CClient::Announce(bool fArrive) const
{
ADDTOCALLSTACK("CClient::Announce");
if ( !m_pAccount || !m_pChar || !m_pChar->m_pPlayer )
return;
// We have logged in or disconnected.
// Annouce my arrival or departure.
TCHAR *pszMsg = Str_GetTemp();
if ( (g_Cfg.m_iArriveDepartMsg == 2) && (GetPrivLevel() > PLEVEL_Player) ) // notify of GMs
{
LPCTSTR pszTitle = m_pChar->Noto_GetFameTitle();
sprintf(pszMsg, "@231 STAFF: %s%s logged %s.", pszTitle, m_pChar->GetName(), fArrive ? "in" : "out");
}
else if ( g_Cfg.m_iArriveDepartMsg == 1 ) // notify of players
{
const CRegionBase *pRegion = m_pChar->GetTopPoint().GetRegion(REGION_TYPE_AREA);
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_MSG_ARRDEP_1), m_pChar->GetName(), g_Cfg.GetDefaultMsg(fArrive ? DEFMSG_MSG_ARRDEP_2 : DEFMSG_MSG_ARRDEP_3), pRegion ? pRegion->GetName() : g_Serv.GetName());
}
if ( pszMsg )
{
ClientIterator it;
for ( CClient *pClient = it.next(); pClient != NULL; pClient = it.next() )
{
if ( (pClient == this) || (GetPrivLevel() > pClient->GetPrivLevel()) )
continue;
pClient->SysMessage(pszMsg);
}
}
// Check murder decay timer
CItem *pMurders = m_pChar->LayerFind(LAYER_FLAG_Murders);
if ( pMurders )
{
if ( fArrive )
{
// On client login, set active timer on murder memory
pMurders->SetTimeout(pMurders->m_itEqMurderCount.m_Decay_Balance * TICK_PER_SEC);
}
else
{
// Or make it inactive on logout
pMurders->m_itEqMurderCount.m_Decay_Balance = static_cast<DWORD>(pMurders->GetTimerAdjusted());
pMurders->SetTimeout(-1);
}
}
else if ( fArrive )
{
// If there's no murder memory found, check if we need a new memory
m_pChar->Noto_Murder();
}
}
示例2: OnTick
//.........这里部分代码省略.........
// regen all creatures and do AI
ProfileTask charactersTask(PROFILE_CHARS);
//pChar = STATIC_CAST <CChar*>( m_Chars_Active.GetHead());
CChar * pCharNext = NULL;
CChar * pChar = dynamic_cast <CChar*>( m_Chars_Active.GetHead());
for ( ; pChar != NULL; pChar = pCharNext )
{
EXC_TRYSUB("TickChar");
pCharNext = pChar->GetNext();
if (( fEnvironChange ) && ( IsTrigUsed(TRIGGER_ENVIRONCHANGE) ))
pChar->OnTrigger(CTRIG_EnvironChange, pChar);
if ( pChar->IsClient())
{
CClient * pClient = pChar->GetClient();
ASSERT( pClient );
if ( sound )
pClient->addSound(sound, pChar);
if ( fLightChange && ! pChar->IsStatFlag( STATF_DEAD | STATF_NightSight ))
pClient->addLight();
if ( fWeatherChange )
pClient->addWeather(GetWeather());
if ( iRegionPeriodic && pChar->m_pArea )
{
if (( iRegionPeriodic == 2 )&&( IsTrigUsed(TRIGGER_REGPERIODIC) ))
{
pChar->m_pArea->OnRegionTrigger( pChar, RTRIG_REGPERIODIC );
iRegionPeriodic--;
}
if ( IsTrigUsed(TRIGGER_CLIPERIODIC) )
pChar->m_pArea->OnRegionTrigger( pChar, RTRIG_CLIPERIODIC );
}
}
// Can only die on your own tick.
if ( !pChar->OnTick() )
pChar->Delete();
EXC_CATCHSUB("Sector");
EXC_DEBUGSUB_START;
CPointMap pt = GetBasePoint();
g_Log.EventDebug("char 0%lx '%s'\n", static_cast<DWORD>(pChar->GetUID()), pChar->GetName());
g_Log.EventDebug("sector #%d [%d,%d,%d,%d]\n", GetIndex(), pt.m_x, pt.m_y, pt.m_z, pt.m_map);
EXC_DEBUGSUB_END;
}
// decay items on ground = time out spells / gates etc.. etc..
// No need to check these so often !
ProfileTask itemsTask(PROFILE_ITEMS);
CItem * pItemNext = NULL;
CItem * pItem = dynamic_cast <CItem*>( m_Items_Timer.GetHead());
for ( ; pItem != NULL; pItem = pItemNext )
{
EXC_TRYSUB("TickItem");
pItemNext = pItem->GetNext();
EXC_SETSUB("TimerExpired");
if ( pItem->IsTimerExpired() )
{
EXC_SETSUB("ItemTick");
if ( !pItem->OnTick() )
{
EXC_SETSUB("ItemDelete");
pItem->Delete();
}
else
{
EXC_SETSUB("TimerExpired2");
if ( pItem->IsTimerExpired() ) // forgot to clear the timer.? strange.
{
EXC_SETSUB("SetTimeout");
pItem->SetTimeout(-1);
}
}
}
EXC_SETSUB("UpdateFlags");
pItem->OnTickStatusUpdate();
#ifdef _WIN32
EXC_CATCHSUB("Sector");
EXC_DEBUGSUB_START;
CPointMap pt = GetBasePoint();
g_Log.EventError("item 0%lx '%s' [timer=%lld, type=%lld]\n", static_cast<DWORD>(pItem->GetUID()), pItem->GetName(), pItem->GetTimerAdjusted(), static_cast<int>(pItem->GetType()));
g_Log.EventError("sector #%d [%d,%d,%d,%d]\n", GetIndex(), pt.m_x, pt.m_y, pt.m_z, pt.m_map);
EXC_DEBUGSUB_END;
#else
}
#ifndef _DEBUG
catch ( const CGrayError& e )