FastRandom: Remove discrepancy between arg and return value type. (#3846)
This commit is contained in:
@@ -45,12 +45,12 @@ bool cMobSpawner::CheckPackCenter(BLOCKTYPE a_BlockType)
|
||||
|
||||
|
||||
|
||||
void cMobSpawner::addIfAllowed(eMonsterType toAdd, std::set<eMonsterType>& toAddIn)
|
||||
void cMobSpawner::addIfAllowed(eMonsterType toAdd, std::vector<eMonsterType> & toAddIn)
|
||||
{
|
||||
std::set<eMonsterType>::iterator itr = m_AllowedTypes.find(toAdd);
|
||||
if (itr != m_AllowedTypes.end())
|
||||
{
|
||||
toAddIn.insert(toAdd);
|
||||
toAddIn.push_back(toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void cMobSpawner::addIfAllowed(eMonsterType toAdd, std::set<eMonsterType>& toAdd
|
||||
|
||||
eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
|
||||
{
|
||||
std::set<eMonsterType> allowedMobs;
|
||||
std::vector<eMonsterType> allowedMobs;
|
||||
|
||||
if ((a_Biome == biMushroomIsland) || (a_Biome == biMushroomShore))
|
||||
{
|
||||
@@ -107,15 +107,11 @@ eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
|
||||
}
|
||||
}
|
||||
|
||||
// Pick a random mob from the options:
|
||||
size_t allowedMobsSize = allowedMobs.size();
|
||||
if (allowedMobsSize > 0)
|
||||
{
|
||||
std::set<eMonsterType>::iterator itr = allowedMobs.begin();
|
||||
|
||||
using DiffType = decltype(itr)::difference_type;
|
||||
std::advance(itr, GetRandomProvider().RandInt<DiffType>(allowedMobsSize - 1));
|
||||
|
||||
return *itr;
|
||||
return allowedMobs[GetRandomProvider().RandInt(allowedMobsSize - 1)];
|
||||
}
|
||||
return mtInvalidType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user