| 60 | } |
| 61 | |
| 62 | StateRef<Agent> AgentGenerator::createAgent(GameState &state, StateRef<Organisation> org, |
| 63 | AgentType::Role role) const |
| 64 | { |
| 65 | std::list<sp<AgentType>> types; |
| 66 | for (auto &t : state.agent_types) |
| 67 | if (t.second->role == role && t.second->playable) |
| 68 | types.insert(types.begin(), t.second); |
| 69 | auto type = pickRandom(state.rng, types); |
| 70 | |
| 71 | return createAgent(state, org, {&state, AgentType::getId(state, type)}); |
| 72 | } |
| 73 | |
| 74 | StateRef<Agent> AgentGenerator::createAgent(GameState &state, StateRef<Organisation> org, |
| 75 | StateRef<AgentType> type) const |
no test coverage detected