Exemple #1
0
// remove all NPCs from the map
void NPCManager::removeNpcsFromMap(uint16_t mapID)
{
    map<uint8_t, NPC*>::const_iterator iter = m_npcMap.begin();
    for(; iter != m_npcMap.end(); ++iter)
    {
        NPC* pNPC = iter->second;
        if(pNPC->getMapID() == mapID)
        {
            pNPC->removeFromMap();
        }
    }
}
Exemple #2
0
// show NPC on the specified map
void NPCManager::showNpcOnMap(uint16_t mapID, CCNode* pParent)
{
    map<uint8_t, NPC*>::iterator iter = m_npcMap.begin();
    for(; iter != m_npcMap.end(); ++iter)
    {
        NPC* pNPC = iter->second;
        if(pNPC->getMapID() == mapID)
        {
            pNPC->showOnMap(pParent);
        }
    }
}