2013-09-07 13:19:56 -07:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "MobProximityCounter.h"
|
|
|
|
#include "MobFamilyCollecter.h"
|
|
|
|
|
2013-10-18 11:02:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fwd:
|
2013-09-07 13:19:56 -07:00
|
|
|
class cChunk;
|
|
|
|
class cMonster;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-18 11:02:53 -07:00
|
|
|
/** This class is used to collect information, for each Mob, what is the distance of the closest player
|
|
|
|
it was first being designed in order to make mobs spawn / despawn / act
|
|
|
|
as the behaviour and even life of mobs depends on the distance to closest player
|
2013-09-07 13:19:56 -07:00
|
|
|
|
2013-10-18 11:02:53 -07:00
|
|
|
as side effect : it also collect the chunks that are elligible for spawning
|
|
|
|
as side effect 2 : it also know the caps for mobs number and can compare census to this numbers
|
|
|
|
*/
|
|
|
|
class cMobCensus
|
|
|
|
{
|
2013-09-07 13:19:56 -07:00
|
|
|
public:
|
2013-10-18 11:02:53 -07:00
|
|
|
/// Returns the nested proximity counter
|
|
|
|
cMobProximityCounter & GetProximityCounter(void);
|
2013-09-07 13:19:56 -07:00
|
|
|
|
|
|
|
// collect an elligible Chunk for Mob Spawning
|
2013-09-08 03:25:07 -07:00
|
|
|
// MG TODO : code the correct rule (not loaded chunk but short distant from players)
|
2013-10-18 11:02:53 -07:00
|
|
|
void CollectSpawnableChunk(cChunk & a_Chunk);
|
2013-09-07 13:19:56 -07:00
|
|
|
|
2013-10-18 11:02:53 -07:00
|
|
|
/// Collect a mob - it's distance to player, it's family ...
|
2013-09-07 13:19:56 -07:00
|
|
|
void CollectMob(cMonster& a_Monster, cChunk& a_Chunk, double a_Distance);
|
|
|
|
|
2013-10-18 11:02:53 -07:00
|
|
|
/// Returns true if the family is capped (i.e. there are more mobs of this family than max)
|
|
|
|
bool IsCapped(cMonster::eFamily a_MobFamily);
|
2013-10-20 05:00:45 -07:00
|
|
|
|
2013-10-18 11:02:53 -07:00
|
|
|
/// log the results of census to server console
|
|
|
|
void Logd(void);
|
2013-10-20 05:00:45 -07:00
|
|
|
|
2013-10-18 11:02:53 -07:00
|
|
|
protected :
|
|
|
|
cMobProximityCounter m_ProximityCounter;
|
|
|
|
cMobFamilyCollecter m_MobFamilyCollecter;
|
|
|
|
|
|
|
|
std::set<cChunk *> m_EligibleForSpawnChunks;
|
|
|
|
|
|
|
|
/// Returns the number of chunks that are elligible for spawning (for now, the loaded, valid chunks)
|
|
|
|
int GetNumChunks();
|
|
|
|
|
2013-10-20 05:00:45 -07:00
|
|
|
/// Returns the cap multiplier value of the given monster family
|
|
|
|
static int GetCapMultiplier(cMonster::eFamily a_MobFamily);
|
2013-10-18 11:02:53 -07:00
|
|
|
} ;
|
|
|
|
|
2013-09-07 13:19:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|