Replacing chunCk by chunk
This commit is contained in:
parent
5846be9400
commit
b4bb255344
@ -434,7 +434,7 @@ void cChunk::Stay(bool a_Stay)
|
||||
|
||||
void cChunk::CollectMobCensus(cMobCensus& toFill)
|
||||
{
|
||||
toFill.CollectSpawnableChunck(*this);
|
||||
toFill.CollectSpawnableChunk(*this);
|
||||
std::list<const Vector3d*> playerPositions;
|
||||
cPlayer* currentPlayer;
|
||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr)
|
||||
|
@ -50,7 +50,7 @@ void cMobCensus::CollectMob(cMonster& a_Monster, cChunk& a_Chunk, double a_Dista
|
||||
bool cMobCensus::isCaped(cMonster::eFamily a_MobFamily)
|
||||
{
|
||||
bool toReturn = true;
|
||||
const int ratio = 319; // this should be 256 as we are only supposed to take account from chuncks that are in 17x17 from a player
|
||||
const int ratio = 319; // this should be 256 as we are only supposed to take account from chunks that are in 17x17 from a player
|
||||
// but for now, we use all chunks loaded by players. that means 19 x 19 chucks. That's why we use 256 * (19*19) / (17*17) = 319
|
||||
// MG TODO : code the correct count
|
||||
tCapMultipliersMap::const_iterator capMultiplier = m_CapMultipliers().find(a_MobFamily);
|
||||
@ -64,7 +64,7 @@ bool cMobCensus::isCaped(cMonster::eFamily a_MobFamily)
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
void cMobCensus::CollectSpawnableChunck(cChunk& a_Chunk)
|
||||
void cMobCensus::CollectSpawnableChunk(cChunk& a_Chunk)
|
||||
{
|
||||
m_EligibleForSpawnChunks.insert(&a_Chunk);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class cMonster;
|
||||
// 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
|
||||
//
|
||||
// as side effect : it also collect the chuncks that are elligible for spawning
|
||||
// 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
|
||||
{
|
||||
@ -27,7 +27,7 @@ protected :
|
||||
|
||||
std::set<cChunk*> m_EligibleForSpawnChunks;
|
||||
|
||||
// count the chunks that are elligible to spawn (for now, the loaded valide not null chuncks)
|
||||
// count the chunks that are elligible to spawn (for now, the loaded valide not null chunks)
|
||||
int getChunkNb();
|
||||
|
||||
public:
|
||||
@ -39,8 +39,8 @@ public:
|
||||
|
||||
public :
|
||||
// collect an elligible Chunk for Mob Spawning
|
||||
// MG TODO : code the correct rule (not loaded chunck but short distant from players)
|
||||
void CollectSpawnableChunck(cChunk& a_Chunk);
|
||||
// MG TODO : code the correct rule (not loaded chunk but short distant from players)
|
||||
void CollectSpawnableChunk(cChunk& a_Chunk);
|
||||
|
||||
// collect a mob - it's distance to player, it's family ...
|
||||
void CollectMob(cMonster& a_Monster, cChunk& a_Chunk, double a_Distance);
|
||||
|
@ -12,8 +12,8 @@ void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, doubl
|
||||
tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster);
|
||||
if (it == m_MonsterToDistance.end())
|
||||
{
|
||||
sDistanceAndChunk newDistanceAndChunck(a_Distance,a_Chunk);
|
||||
std::pair<tMonsterToDistance::iterator,bool> result = m_MonsterToDistance.insert(tMonsterToDistance::value_type(&a_Monster,newDistanceAndChunck));
|
||||
sDistanceAndChunk newDistanceAndChunk(a_Distance,a_Chunk);
|
||||
std::pair<tMonsterToDistance::iterator,bool> result = m_MonsterToDistance.insert(tMonsterToDistance::value_type(&a_Monster,newDistanceAndChunk));
|
||||
if (!result.second)
|
||||
{
|
||||
ASSERT(!"A collected Monster was not found inside distance map using find(), but insert() said there already is a key for it");
|
||||
|
@ -38,7 +38,7 @@ protected :
|
||||
// this map is generated after collection phase, in order to access monster by distance to player
|
||||
tDistanceToMonster m_DistanceToMonster;
|
||||
|
||||
// this are the collected chuncks. Used to determinate the number of elligible chunck for spawning.
|
||||
// this are the collected chunks. Used to determinate the number of elligible chunk for spawning.
|
||||
std::set<cChunk*> m_EligibleForSpawnChunks;
|
||||
|
||||
protected :
|
||||
@ -47,9 +47,9 @@ protected :
|
||||
void convertMaps();
|
||||
|
||||
public :
|
||||
// count a mob on a specified chunck with specified distance to an unkown player
|
||||
// count a mob on a specified chunk with specified distance to an unkown player
|
||||
// if the distance is shortest than the one collected, this become the new closest
|
||||
// distance and the chunck become the "hosting" chunk (that is the one that will perform the action)
|
||||
// distance and the chunk become the "hosting" chunk (that is the one that will perform the action)
|
||||
void CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance);
|
||||
|
||||
// return the mobs that are within the range of distance of the closest player they are
|
||||
|
Loading…
Reference in New Issue
Block a user