|
|
@ -847,10 +847,10 @@ bool CGrpFauna::spawnPop(uint popVersion)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
popVersion = ~0;
|
|
|
|
popVersion = std::numeric_limits<uint>::max();
|
|
|
|
|
|
|
|
|
|
|
|
// if we are in a cycle.
|
|
|
|
// if we are in a cycle.
|
|
|
|
if (_CurrentCycle!=~0)
|
|
|
|
if (_CurrentCycle != std::numeric_limits<uint32>::max())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Cycle const& cycle = _Cycles[_CurrentCycle];
|
|
|
|
Cycle const& cycle = _Cycles[_CurrentCycle];
|
|
|
|
|
|
|
|
|
|
|
@ -868,18 +868,18 @@ bool CGrpFauna::spawnPop(uint popVersion)
|
|
|
|
|
|
|
|
|
|
|
|
if (!timeAllowSpawn(popVersion))
|
|
|
|
if (!timeAllowSpawn(popVersion))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
popVersion=~0;
|
|
|
|
popVersion = std::numeric_limits<uint>::max();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (popVersion==~0)
|
|
|
|
if (popVersion == std::numeric_limits<uint>::max())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_CurrentCycle = ~0;
|
|
|
|
_CurrentCycle = std::numeric_limits<uint32>::max();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if the population version has not been specified then select one at weighted random with day/night difference.
|
|
|
|
// if the population version has not been specified then select one at weighted random with day/night difference.
|
|
|
|
if (popVersion==~0)
|
|
|
|
if (popVersion == std::numeric_limits<uint>::max())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 totalWeight = 0;
|
|
|
|
uint32 totalWeight = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -913,9 +913,9 @@ bool CGrpFauna::spawnPop(uint popVersion)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if !FINAL_VERSION
|
|
|
|
#if !FINAL_VERSION
|
|
|
|
nlassert(popVersion!=~0);
|
|
|
|
nlassert(popVersion != std::numeric_limits<uint>::max());
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
if (popVersion==~0)
|
|
|
|
if (popVersion == std::numeric_limits<uint>::max())
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// find if we are starting a new cycle ..
|
|
|
|
// find if we are starting a new cycle ..
|
|
|
@ -952,7 +952,7 @@ bool CGrpFauna::spawnPop(uint popVersion)
|
|
|
|
despawnGrp();
|
|
|
|
despawnGrp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nlassert(_CurPopulation!=~0);
|
|
|
|
nlassert(_CurPopulation != std::numeric_limits<uint32>::max());
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Init the group type.
|
|
|
|
// Init the group type.
|
|
|
@ -990,14 +990,14 @@ bool CGrpFauna::spawnPop(uint popVersion)
|
|
|
|
void CGrpFauna::despawnGrp()
|
|
|
|
void CGrpFauna::despawnGrp()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CGroup::despawnGrp();
|
|
|
|
CGroup::despawnGrp();
|
|
|
|
_CurPopulation = ~0u;
|
|
|
|
_CurPopulation = std::numeric_limits<uint32>::max();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// reads cycle from primitive (string representation).
|
|
|
|
// reads cycle from primitive (string representation).
|
|
|
|
void CGrpFauna::setCyles(std::string const& cycles)
|
|
|
|
void CGrpFauna::setCyles(std::string const& cycles)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 strIndex = 0;
|
|
|
|
uint32 strIndex = 0;
|
|
|
|
uint32 curCycle = ~0;
|
|
|
|
uint32 curCycle = std::numeric_limits<uint32>::max();
|
|
|
|
|
|
|
|
|
|
|
|
while (strIndex<cycles.size())
|
|
|
|
while (strIndex<cycles.size())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1008,7 +1008,7 @@ void CGrpFauna::setCyles(std::string const& cycles)
|
|
|
|
|
|
|
|
|
|
|
|
if (carac>='a' && carac<='z')
|
|
|
|
if (carac>='a' && carac<='z')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (curCycle==~0)
|
|
|
|
if (curCycle == std::numeric_limits<uint32>::max())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
curCycle = (uint32)_Cycles.size();
|
|
|
|
curCycle = (uint32)_Cycles.size();
|
|
|
|
_Cycles.push_back(Cycle());
|
|
|
|
_Cycles.push_back(Cycle());
|
|
|
@ -1018,7 +1018,7 @@ void CGrpFauna::setCyles(std::string const& cycles)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
curCycle = ~0;
|
|
|
|
curCycle = std::numeric_limits<uint32>::max();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1026,7 +1026,7 @@ void CGrpFauna::setCyles(std::string const& cycles)
|
|
|
|
void CGrpFauna::setPopulation(CPopulation* pop)
|
|
|
|
void CGrpFauna::setPopulation(CPopulation* pop)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CPopulation* sameAliasPop = NULL;
|
|
|
|
CPopulation* sameAliasPop = NULL;
|
|
|
|
uint32 index = ~0;
|
|
|
|
uint32 index = std::numeric_limits<uint32>::max();
|
|
|
|
|
|
|
|
|
|
|
|
if (pop)
|
|
|
|
if (pop)
|
|
|
|
sameAliasPop = _Populations.getChildByAlias(pop->getAlias());
|
|
|
|
sameAliasPop = _Populations.getChildByAlias(pop->getAlias());
|
|
|
|