fix static data not beeing stored correctly on deactivation
parent
098692ef26
commit
58f036ad1d
|
@ -1084,8 +1084,8 @@ void ServerEnvironment::step(float dtime)
|
||||||
{
|
{
|
||||||
v3s16 p = *i;
|
v3s16 p = *i;
|
||||||
|
|
||||||
/*infostream<<"Server: Block ("<<p.X<<","<<p.Y<<","<<p.Z
|
/* infostream<<"Server: Block " << PP(p)
|
||||||
<<") became inactive"<<std::endl;*/
|
<< " became inactive"<<std::endl; */
|
||||||
|
|
||||||
MapBlock *block = m_map->getBlockNoCreateNoEx(p);
|
MapBlock *block = m_map->getBlockNoCreateNoEx(p);
|
||||||
if(block==NULL)
|
if(block==NULL)
|
||||||
|
@ -1105,9 +1105,6 @@ void ServerEnvironment::step(float dtime)
|
||||||
{
|
{
|
||||||
v3s16 p = *i;
|
v3s16 p = *i;
|
||||||
|
|
||||||
/*infostream<<"Server: Block ("<<p.X<<","<<p.Y<<","<<p.Z
|
|
||||||
<<") became active"<<std::endl;*/
|
|
||||||
|
|
||||||
MapBlock *block = m_map->getBlockNoCreateNoEx(p);
|
MapBlock *block = m_map->getBlockNoCreateNoEx(p);
|
||||||
if(block==NULL){
|
if(block==NULL){
|
||||||
// Block needs to be fetched first
|
// Block needs to be fetched first
|
||||||
|
@ -1117,6 +1114,8 @@ void ServerEnvironment::step(float dtime)
|
||||||
}
|
}
|
||||||
|
|
||||||
activateBlock(block);
|
activateBlock(block);
|
||||||
|
/* infostream<<"Server: Block " << PP(p)
|
||||||
|
<< " became active"<<std::endl; */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1850,17 +1849,17 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete)
|
||||||
<<" Forcing delete."<<std::endl;
|
<<" Forcing delete."<<std::endl;
|
||||||
force_delete = true;
|
force_delete = true;
|
||||||
} else {
|
} else {
|
||||||
u16 new_id = pending_delete ? id : 0;
|
|
||||||
// If static counterpart already exists, remove it first.
|
// If static counterpart already exists, remove it first.
|
||||||
// This shouldn't happen, but happens rarely for some
|
// This shouldn't happen, but happens rarely for some
|
||||||
// unknown reason. Unsuccessful attempts have been made to
|
// unknown reason. Unsuccessful attempts have been made to
|
||||||
// find said reason.
|
// find said reason.
|
||||||
if(new_id && block->m_static_objects.m_active.find(new_id) != block->m_static_objects.m_active.end()){
|
if(id && block->m_static_objects.m_active.find(id) != block->m_static_objects.m_active.end()){
|
||||||
infostream<<"ServerEnv: WARNING: Performing hack #83274"
|
infostream<<"ServerEnv: WARNING: Performing hack #83274"
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
block->m_static_objects.remove(new_id);
|
block->m_static_objects.remove(id);
|
||||||
}
|
}
|
||||||
block->m_static_objects.insert(new_id, s_obj);
|
//store static data
|
||||||
|
block->m_static_objects.insert(0, s_obj);
|
||||||
|
|
||||||
// Only mark block as modified if data changed considerably
|
// Only mark block as modified if data changed considerably
|
||||||
if(shall_be_written)
|
if(shall_be_written)
|
||||||
|
|
Loading…
Reference in New Issue