Example #1
0
void CSector::Restock()
{
    ADDTOCALLSTACK("CSector::Restock");
    // ARGS: iTime = time in seconds
    // set restock time of all vendors in Sector.
    // set the respawn time of all spawns in Sector.

    CChar * pCharNext;
    CChar * pChar = dynamic_cast <CChar*>(m_Chars_Active.GetHead());
    for (; pChar; pChar = pCharNext)
    {
        pCharNext = pChar->GetNext();
        if (pChar->m_pNPC)
        {
            pChar->NPC_Vendor_Restock(true);
        }
    }

    CItem * pItemNext;
    CItem * pItem = dynamic_cast <CItem*>(m_Items_Timer.GetHead());
    for (; pItem; pItem = pItemNext)
    {
        pItemNext = pItem->GetNext();
        if (pItem->IsType(IT_SPAWN_ITEM) || pItem->IsType(IT_SPAWN_CHAR) || pItem->IsType(IT_SPAWN_CHAMPION))
        {
            CCSpawn *pSpawn = pItem->GetSpawn();
            if (pSpawn)
            {
                pSpawn->OnTickComponent();
            }
        }
    }
}