Fix active_object_count and active_object_count_wider not getting updated between ABM calls causing huge amounts of DMs and rats and stuff

master
Perttu Ahola 2011-11-29 17:09:29 +02:00
parent dde22d26a8
commit 1c19f959db
1 changed files with 20 additions and 17 deletions

View File

@ -618,6 +618,27 @@ public:
return;
ServerMap *map = &m_env->getServerMap();
v3s16 p0;
for(p0.X=0; p0.X<MAP_BLOCKSIZE; p0.X++)
for(p0.Y=0; p0.Y<MAP_BLOCKSIZE; p0.Y++)
for(p0.Z=0; p0.Z<MAP_BLOCKSIZE; p0.Z++)
{
MapNode n = block->getNodeNoEx(p0);
content_t c = n.getContent();
v3s16 p = p0 + block->getPosRelative();
std::map<content_t, std::list<ActiveABM> >::iterator j;
j = m_aabms.find(c);
if(j == m_aabms.end())
continue;
for(std::list<ActiveABM>::iterator
i = j->second.begin(); i != j->second.end(); i++)
{
if(myrand() % i->chance != 0)
continue;
// Find out how many objects the block contains
u32 active_object_count = block->m_static_objects.m_active.size();
// Find out how many objects this and all the neighbors contain
@ -635,24 +656,6 @@ public:
+ block2->m_static_objects.m_stored.size();
}
v3s16 p0;
for(p0.X=0; p0.X<MAP_BLOCKSIZE; p0.X++)
for(p0.Y=0; p0.Y<MAP_BLOCKSIZE; p0.Y++)
for(p0.Z=0; p0.Z<MAP_BLOCKSIZE; p0.Z++)
{
MapNode n = block->getNodeNoEx(p0);
content_t c = n.getContent();
v3s16 p = p0 + block->getPosRelative();
std::map<content_t, std::list<ActiveABM> >::iterator j;
j = m_aabms.find(c);
if(j == m_aabms.end())
continue;
for(std::list<ActiveABM>::iterator
i = j->second.begin(); i != j->second.end(); i++){
if(myrand() % i->chance != 0)
continue;
// Call all the trigger variations
i->abm->trigger(m_env, p, n);
i->abm->trigger(m_env, p, n,