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(); }
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; }