NPC* WorldServer::getNPCGlobal(const word_t npcId) { for (unsigned int i = 0;i<this->globalNPCs.size(); i++) { NPC* npc = this->globalNPCs[i]; if (npc->getTypeId() == npcId) return npc; } return nullptr; }
NPC* Map::getNPC(const word_t type) const { LinkedList<Entity*>::Node* nNode = this->getFirstEntity(); for(;nNode;nNode = nNode->getNextNode()) { Entity* entity = nNode->getValue(); if(!entity || entity->getEntityType() != Entity::TYPE_NPC) continue; NPC* curNpc = dynamic_cast<NPC*>(entity); if(curNpc->getTypeId() == type) return curNpc; } return nullptr; }