コード例 #1
0
ファイル: Species.cpp プロジェクト: adrianbroher/freeorion
const std::string& SpeciesManager::RandomPlayableSpeciesName() const {
    if (NumPlayableSpecies() <= 0)
        return EMPTY_STRING;

    int species_idx = RandSmallInt(0, NumPlayableSpecies() - 1);
    return std::next(playable_begin(), species_idx)->first;
}
コード例 #2
0
ファイル: Species.cpp プロジェクト: adrianbroher/freeorion
const std::string& SpeciesManager::SequentialPlayableSpeciesName(int id) const {
    if (NumPlayableSpecies() <= 0)
        return EMPTY_STRING;

    int species_idx = id % NumPlayableSpecies();
    DebugLogger() << "SpeciesManager::SequentialPlayableSpeciesName has " << NumPlayableSpecies() << " and is given id " << id << " yielding index " << species_idx;
    return std::next(playable_begin(), species_idx)->first;
}
コード例 #3
0
ファイル: Species.cpp プロジェクト: e-h-j/freeorion
const std::string& SpeciesManager::RandomPlayableSpeciesName() const {
    if (NumPlayableSpecies() <= 0)
        return EMPTY_STRING;

    int species_idx = RandSmallInt(0, NumPlayableSpecies() - 1);
    playable_iterator it = playable_begin();
    std::advance(it, species_idx);
    return it->first;
}
コード例 #4
0
ファイル: Species.cpp プロジェクト: e-h-j/freeorion
int SpeciesManager::NumPlayableSpecies() const
{ return std::distance(playable_begin(), playable_end()); }