示例#1
0
    AgentId AgentManager::newAgent()
    {
        Agent *t = new Agent(getFreeAgentId(), mLevel);
        mAgents.insert(std::pair<AgentId, Agent *>(t->id(), t));
//         Debug::log("new agent with id ")(t->id()).endl();
        SignalManager::instance().emit(getSignal(PublicSignal::agentCreated));
        return t->id();
    }
示例#2
0
    Agent *AgentManager::newAgent(AgentId &id)
    {
        Agent *t = nullptr;

        // check is not already taken
        if(reserveId(id))
        {
            t = new Agent(id, mLevel);
            mAgents.insert(std::pair<AgentId, Agent *>(t->id(), t));
            Debug::log("new agent with id ")(t->id()).endl();
            SignalManager::instance().emit(getSignal(PublicSignal::agentCreated));
        }

        return t;
    }