#include "mapsector.h"
#include "mapblock.h"
#include "main.h"
-#ifndef SERVER
-#include "client.h"
-#endif
#include "filesys.h"
#include "utility.h"
#include "voxel.h"
#include "porting.h"
#include "mapgen.h"
#include "nodemetadata.h"
-#ifndef SERVER
-#include <IMaterialRenderer.h>
-#endif
#include "settings.h"
#include "log.h"
#include "profiler.h"
#include "nodedef.h"
#include "gamedef.h"
+#ifndef SERVER
+#include "client.h"
+#include "mapblock_mesh.h"
+#include <IMaterialRenderer.h>
+#endif
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
v3s16 blockpos = getNodeBlockPos(p);
MapBlock *block = getBlockNoCreate(blockpos);
v3s16 relpos = p - blockpos*MAP_BLOCKSIZE;
+ // Never allow placing CONTENT_IGNORE, it fucks up stuff
+ if(n.getContent() == CONTENT_IGNORE){
+ errorstream<<"Map::setNode(): Not allowing to place CONTENT_IGNORE"
+ <<" while trying to replace \""
+ <<m_gamedef->ndef()->get(block->getNodeNoCheck(relpos)).name
+ <<"\" at "<<PP(p)<<" (block "<<PP(blockpos)<<")"<<std::endl;
+ debug_stacks_print_to(infostream);
+ return;
+ }
block->setNodeNoCheck(relpos, n);
}
for(s16 y=-1; y<=1; y++)
for(s16 x=-1; x<=1; x++)
{
- v3s16 p(x,y,z);
- MapBlock *block = getBlockNoCreateNoEx(p);
+ v3s16 p2 = p + v3s16(x,y,z);
+ MapBlock *block = getBlockNoCreateNoEx(p2);
if(block == NULL)
continue;
if(block->isDummy())
continue;
if(block->getLightingExpired())
continue;
- vmanip.initialEmerge(p, p);
+ vmanip.initialEmerge(p2, p2);
}*/
// Lighting of block will be updated completely
/*
*/
void Map::addNodeAndUpdate(v3s16 p, MapNode n,
- core::map<v3s16, MapBlock*> &modified_blocks, std::string &player_name)
+ core::map<v3s16, MapBlock*> &modified_blocks)
{
INodeDefManager *nodemgr = m_gamedef->ndef();
/*
Add intial metadata
*/
-
- NodeMetadata *meta_proto = nodemgr->get(n).initial_metadata;
- if(meta_proto)
- {
- NodeMetadata *meta = meta_proto->clone(m_gamedef);
- meta->setOwner(player_name);
- setNodeMetadata(p, meta);
+
+ std::string metadata_name = nodemgr->get(n).metadata_name;
+ if(metadata_name != ""){
+ NodeMetadata *meta = NodeMetadata::create(metadata_name, m_gamedef);
+ if(!meta){
+ errorstream<<"Failed to create node metadata \""
+ <<metadata_name<<"\""<<std::endl;
+ } else {
+ setNodeMetadata(p, meta);
+ }
}
/*
bool succeeded = true;
try{
core::map<v3s16, MapBlock*> modified_blocks;
- std::string st = std::string("");
- addNodeAndUpdate(p, n, modified_blocks, st);
+ addNodeAndUpdate(p, n, modified_blocks);
// Copy modified_blocks to event
for(core::map<v3s16, MapBlock*>::Iterator
core::list<v2s16> sector_deletion_queue;
u32 deleted_blocks_count = 0;
u32 saved_blocks_count = 0;
+ u32 block_count_all = 0;
core::map<v2s16, MapSector*>::Iterator si;
else
{
all_blocks_deleted = false;
+ block_count_all++;
}
}
<<" blocks from memory";
if(save_before_unloading)
infostream<<", of which "<<saved_blocks_count<<" were written";
+ infostream<<", "<<block_count_all<<" blocks in memory";
infostream<<"."<<std::endl;
- PrintInfo(infostream); // ServerMap/ClientMap:
- infostream<<"Blocks modified by: "<<std::endl;
- modprofiler.print(infostream);
+ if(saved_blocks_count != 0){
+ PrintInfo(infostream); // ServerMap/ClientMap:
+ infostream<<"Blocks modified by: "<<std::endl;
+ modprofiler.print(infostream);
+ }
}
}
switch (liquid_type) {
case LIQUID_SOURCE:
liquid_level = LIQUID_LEVEL_SOURCE;
- liquid_kind = nodemgr->get(n0).liquid_alternative_flowing;
+ liquid_kind = nodemgr->getId(nodemgr->get(n0).liquid_alternative_flowing);
break;
case LIQUID_FLOWING:
liquid_level = (n0.param2 & LIQUID_LEVEL_MASK);
case LIQUID_SOURCE:
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
if (liquid_kind == CONTENT_AIR)
- liquid_kind = nodemgr->get(nb.n.getContent()).liquid_alternative_flowing;
- if (nodemgr->get(nb.n.getContent()).liquid_alternative_flowing !=liquid_kind) {
+ liquid_kind = nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing);
+ if (nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing) != liquid_kind) {
neutrals[num_neutrals++] = nb;
} else {
- sources[num_sources++] = nb;
+ // Do not count bottom source, it will screw things up
+ if(dirs[i].Y != -1)
+ sources[num_sources++] = nb;
}
break;
case LIQUID_FLOWING:
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
if (liquid_kind == CONTENT_AIR)
- liquid_kind = nodemgr->get(nb.n.getContent()).liquid_alternative_flowing;
- if (nodemgr->get(nb.n.getContent()).liquid_alternative_flowing != liquid_kind) {
+ liquid_kind = nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing);
+ if (nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing) != liquid_kind) {
neutrals[num_neutrals++] = nb;
} else {
flows[num_flows++] = nb;
// liquid_kind will be set to either the flowing alternative of the node (if it's a liquid)
// or the flowing alternative of the first of the surrounding sources (if it's air), so
// it's perfectly safe to use liquid_kind here to determine the new node content.
- new_node_content = nodemgr->get(liquid_kind).liquid_alternative_source;
+ new_node_content = nodemgr->getId(nodemgr->get(liquid_kind).liquid_alternative_source);
} else if (num_sources == 1 && sources[0].t != NEIGHBOR_LOWER) {
// liquid_kind is set properly, see above
new_node_content = liquid_kind;
m_database_read(NULL),
m_database_write(NULL)
{
- infostream<<__FUNCTION_NAME<<std::endl;
+ verbosestream<<__FUNCTION_NAME<<std::endl;
//m_chunksize = 8; // Takes a few seconds
// If directory is empty, it is safe to save into it.
if(fs::GetDirListing(m_savedir).size() == 0)
{
- infostream<<"Server: Empty save directory is valid."
+ infostream<<"ServerMap: Empty save directory is valid."
<<std::endl;
m_map_saving_enabled = true;
}
//m_chunksize = 0;
}
- /*try{
- // Load chunk metadata
- loadChunkMeta();
- }
- catch(FileNotGoodException &e){
- infostream<<"WARNING: Could not load chunk metadata."
- <<" Disabling chunk-based generator."
- <<std::endl;
- m_chunksize = 0;
- }*/
-
- /*infostream<<"Server: Successfully loaded chunk "
- "metadata and sector (0,0) from "<<savedir<<
- ", assuming valid save directory."
- <<std::endl;*/
-
- infostream<<"Server: Successfully loaded map "
- <<"and chunk metadata from "<<savedir
+ infostream<<"ServerMap: Successfully loaded map "
+ <<"metadata from "<<savedir
<<", assuming valid save directory."
+ <<" seed="<<m_seed<<"."
<<std::endl;
m_map_saving_enabled = true;
}
catch(std::exception &e)
{
- infostream<<"WARNING: Server: Failed to load map from "<<savedir
+ infostream<<"WARNING: ServerMap: Failed to load map from "<<savedir
<<", exception: "<<e.what()<<std::endl;
infostream<<"Please remove the map or fix it."<<std::endl;
infostream<<"WARNING: Map saving will be disabled."<<std::endl;
emergeSector(v2s16(0,0));
// Initially write whole map
- save(false);
+ save(MOD_STATE_CLEAN);
}
ServerMap::~ServerMap()
{
- infostream<<__FUNCTION_NAME<<std::endl;
+ verbosestream<<__FUNCTION_NAME<<std::endl;
try
{
if(m_map_saving_enabled)
{
// Save only changed parts
- save(true);
- infostream<<"Server: saved map to "<<m_savedir<<std::endl;
+ save(MOD_STATE_WRITE_AT_UNLOAD);
+ infostream<<"ServerMap: Saved map to "<<m_savedir<<std::endl;
}
else
{
- infostream<<"Server: map not saved"<<std::endl;
+ infostream<<"ServerMap: Map not saved"<<std::endl;
}
}
catch(std::exception &e)
{
- infostream<<"Server: Failed to save map to "<<m_savedir
+ infostream<<"ServerMap: Failed to save map to "<<m_savedir
<<", exception: "<<e.what()<<std::endl;
}
/*infostream<<"Resulting vmanip:"<<std::endl;
data->vmanip.print(infostream);*/
-
+
+ // Make sure affected blocks are loaded
+ for(s16 x=-1; x<=1; x++)
+ for(s16 z=-1; z<=1; z++)
+ for(s16 y=-1; y<=1; y++)
+ {
+ v3s16 p(blockpos.X+x, blockpos.Y+y, blockpos.Z+z);
+ // Load from disk if not already in memory
+ emergeBlock(p, false);
+ }
+
/*
Blit generated stuff to map
NOTE: blitBackAll adds nearly everything to changed_blocks
Save changed parts of map
NOTE: Will be saved later.
*/
- //save(true);
+ //save(MOD_STATE_WRITE_AT_UNLOAD);
/*infostream<<"finishBlockMake() done for ("<<blockpos.X<<","<<blockpos.Y<<","
<<blockpos.Z<<")"<<std::endl;*/
if(e == SQLITE_ABORT)
throw FileNotGoodException("Could not create database structure");
else
- infostream<<"Server: Database structure was created";
+ infostream<<"ServerMap: Database structure was created";
}
void ServerMap::verifyDatabase() {
throw FileNotGoodException("Cannot prepare read statement");
}
- infostream<<"Server: Database opened"<<std::endl;
+ infostream<<"ServerMap: Database opened"<<std::endl;
}
}
return cc;
}
-void ServerMap::save(bool only_changed)
+void ServerMap::save(ModifiedState save_level)
{
DSTACK(__FUNCTION_NAME);
if(m_map_saving_enabled == false)
return;
}
- if(only_changed == false)
+ if(save_level == MOD_STATE_CLEAN)
infostream<<"ServerMap: Saving whole map, this can take time."
<<std::endl;
- if(only_changed == false || m_map_metadata_changed)
+ if(m_map_metadata_changed || save_level == MOD_STATE_CLEAN)
{
saveMapMeta();
}
u32 block_count = 0;
u32 block_count_all = 0; // Number of blocks in memory
- beginSave();
+ // Don't do anything with sqlite unless something is really saved
+ bool save_started = false;
+
core::map<v2s16, MapSector*>::Iterator i = m_sectors.getIterator();
for(; i.atEnd() == false; i++)
{
ServerMapSector *sector = (ServerMapSector*)i.getNode()->getValue();
assert(sector->getId() == MAPSECTOR_SERVER);
- if(sector->differs_from_disk || only_changed == false)
+ if(sector->differs_from_disk || save_level == MOD_STATE_CLEAN)
{
saveSectorMeta(sector);
sector_meta_count++;
sector->getBlocks(blocks);
core::list<MapBlock*>::Iterator j;
- //sqlite3_exec(m_database, "BEGIN;", NULL, NULL, NULL);
for(j=blocks.begin(); j!=blocks.end(); j++)
{
MapBlock *block = *j;
block_count_all++;
- if(block->getModified() >= MOD_STATE_WRITE_NEEDED
- || only_changed == false)
+ if(block->getModified() >= save_level)
{
+ // Lazy beginSave()
+ if(!save_started){
+ beginSave();
+ save_started = true;
+ }
+
modprofiler.add(block->getModifiedReason(), 1);
+
saveBlock(block);
block_count++;
<<block->getPos().Z<<")"
<<std::endl;*/
}
- //sqlite3_exec(m_database, "COMMIT;", NULL, NULL, NULL);
}
}
- endSave();
+ if(save_started)
+ endSave();
/*
Only print if something happened or saved whole map
*/
- if(only_changed == false || sector_meta_count != 0
+ if(save_level == MOD_STATE_CLEAN || sector_meta_count != 0
|| block_count != 0)
{
infostream<<"ServerMap: Written: "
{
DSTACK(__FUNCTION_NAME);
- infostream<<"ServerMap::saveMapMeta(): "
+ /*infostream<<"ServerMap::saveMapMeta(): "
<<"seed="<<m_seed
- <<std::endl;
+ <<std::endl;*/
createDirs(m_savedir);
{
DSTACK(__FUNCTION_NAME);
- infostream<<"ServerMap::loadMapMeta(): Loading map metadata"
- <<std::endl;
+ /*infostream<<"ServerMap::loadMapMeta(): Loading map metadata"
+ <<std::endl;*/
std::string fullpath = m_savedir + DIR_DELIM + "map_meta.txt";
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
m_seed = params.getU64("seed");
- infostream<<"ServerMap::loadMapMeta(): "<<"seed="<<m_seed<<std::endl;
+ verbosestream<<"ServerMap::loadMapMeta(): "<<"seed="<<m_seed<<std::endl;
}
void ServerMap::saveSectorMeta(ServerMapSector *sector)
o.write((char*)&version, 1);
// Write basic data
- block->serialize(o, version);
-
- // Write extra data stored on disk
- block->serializeDiskExtra(o, version);
+ block->serialize(o, version, true);
// Write block to database
}
// Read basic data
- block->deSerialize(is, version);
+ block->deSerialize(is, version, true);
- // Read extra data stored on disk
- block->deSerializeDiskExtra(is, version);
-
// If it's a new block, insert it to the map
if(created_new)
sector->insertBlock(block);
}
// Read basic data
- block->deSerialize(is, version);
-
- // Read extra data stored on disk
- block->deSerializeDiskExtra(is, version);
+ block->deSerialize(is, version, true);
// If it's a new block, insert it to the map
if(created_new)
*/
int time1 = time(0);
- //u32 daynight_ratio = m_client->getDayNightRatio();
+ /*
+ Get animation parameters
+ */
+ float animation_time = m_client->getAnimationTime();
+ int crack = m_client->getCrackLevel();
+ u32 daynight_ratio = m_client->getDayNightRatio();
m_camera_mutex.Lock();
v3f camera_position = m_camera_position;
u32 vertex_count = 0;
u32 meshbuffer_count = 0;
- // For limiting number of mesh updates per frame
- u32 mesh_update_count = 0;
+ // For limiting number of mesh animations per frame
+ u32 mesh_animate_count = 0;
+ u32 mesh_animate_count_far = 0;
// Number of blocks in rendering range
u32 blocks_in_range = 0;
blocks_in_range++;
-#if 1
/*
- Update expired mesh (used for day/night change)
-
- It doesn't work exactly like it should now with the
- tasked mesh update but whatever.
+ Ignore if mesh doesn't exist
*/
-
- bool mesh_expired = false;
-
{
- JMutexAutoLock lock(block->mesh_mutex);
+ //JMutexAutoLock lock(block->mesh_mutex);
- mesh_expired = block->getMeshExpired();
-
- // Mesh has not been expired and there is no mesh:
- // block has no content
- if(block->mesh == NULL && mesh_expired == false){
+ if(block->mesh == NULL){
blocks_in_range_without_mesh++;
continue;
}
}
- f32 faraway = BS*50;
- //f32 faraway = m_control.wanted_range * BS;
-
- /*
- This has to be done with the mesh_mutex unlocked
- */
- // Pretty random but this should work somewhat nicely
- if(mesh_expired && (
- (mesh_update_count < 3
- && (d < faraway || mesh_update_count < 2)
- )
- ||
- (m_control.range_all && mesh_update_count < 20)
- )
- )
- /*if(mesh_expired && mesh_update_count < 6
- && (d < faraway || mesh_update_count < 3))*/
- {
- mesh_update_count++;
-
- // Mesh has been expired: generate new mesh
- //block->updateMesh(daynight_ratio);
- m_client->addUpdateMeshTask(block->getPos());
-
- mesh_expired = false;
- }
-#endif
-
/*
Occlusion culling
*/
// This block is in range. Reset usage timer.
block->resetUsageTimer();
- /*
- Ignore if mesh doesn't exist
- */
- {
- JMutexAutoLock lock(block->mesh_mutex);
-
- scene::SMesh *mesh = block->mesh;
-
- if(mesh == NULL){
- blocks_in_range_without_mesh++;
- continue;
- }
- }
-
// Limit block count in case of a sudden increase
blocks_would_have_drawn++;
if(blocks_drawn >= m_control.wanted_max_blocks
&& m_control.range_all == false
&& d > m_control.wanted_min_range * BS)
continue;
-
+
+ // Mesh animation
+ {
+ //JMutexAutoLock lock(block->mesh_mutex);
+ MapBlockMesh *mapBlockMesh = block->mesh;
+ // Pretty random but this should work somewhat nicely
+ bool faraway = d >= BS*50;
+ //bool faraway = d >= m_control.wanted_range * BS;
+ if(mapBlockMesh->isAnimationForced() ||
+ !faraway ||
+ mesh_animate_count_far < (m_control.range_all ? 200 : 50))
+ {
+ bool animated = mapBlockMesh->animate(
+ faraway,
+ animation_time,
+ crack,
+ daynight_ratio);
+ if(animated)
+ mesh_animate_count++;
+ if(animated && faraway)
+ mesh_animate_count_far++;
+ }
+ else
+ {
+ mapBlockMesh->decreaseAnimationForceTimer();
+ }
+ }
+
// Add to set
drawset[block->getPos()] = block;
Draw the faces of the block
*/
{
- JMutexAutoLock lock(block->mesh_mutex);
+ //JMutexAutoLock lock(block->mesh_mutex);
- scene::SMesh *mesh = block->mesh;
+ MapBlockMesh *mapBlockMesh = block->mesh;
+ assert(mapBlockMesh);
+
+ scene::SMesh *mesh = mapBlockMesh->getMesh();
assert(mesh);
-
+
u32 c = mesh->getMeshBufferCount();
bool stuff_actually_drawn = false;
for(u32 i=0; i<c; i++)
g_profiler->avg("CM: blocks in range without mesh (frac)",
(float)blocks_in_range_without_mesh/blocks_in_range);
g_profiler->avg("CM: blocks drawn", blocks_drawn);
+ g_profiler->avg("CM: animated meshes", mesh_animate_count);
+ g_profiler->avg("CM: animated meshes (far)", mesh_animate_count_far);
}
g_profiler->avg(prefix+"vertices drawn", vertex_count);
}
}
-bool ClientMap::setTempMod(v3s16 p, NodeMod mod,
- core::map<v3s16, MapBlock*> *affected_blocks)
-{
- bool changed = false;
- /*
- Add it to all blocks touching it
- */
- v3s16 dirs[7] = {
- v3s16(0,0,0), // this
- v3s16(0,0,1), // back
- v3s16(0,1,0), // top
- v3s16(1,0,0), // right
- v3s16(0,0,-1), // front
- v3s16(0,-1,0), // bottom
- v3s16(-1,0,0), // left
- };
- for(u16 i=0; i<7; i++)
- {
- v3s16 p2 = p + dirs[i];
- // Block position of neighbor (or requested) node
- v3s16 blockpos = getNodeBlockPos(p2);
- MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
- if(blockref == NULL)
- continue;
- // Relative position of requested node
- v3s16 relpos = p - blockpos*MAP_BLOCKSIZE;
- if(blockref->setTempMod(relpos, mod))
- {
- changed = true;
- }
- }
- if(changed && affected_blocks!=NULL)
- {
- for(u16 i=0; i<7; i++)
- {
- v3s16 p2 = p + dirs[i];
- // Block position of neighbor (or requested) node
- v3s16 blockpos = getNodeBlockPos(p2);
- MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
- if(blockref == NULL)
- continue;
- affected_blocks->insert(blockpos, blockref);
- }
- }
- return changed;
-}
-
-bool ClientMap::clearTempMod(v3s16 p,
- core::map<v3s16, MapBlock*> *affected_blocks)
-{
- bool changed = false;
- v3s16 dirs[7] = {
- v3s16(0,0,0), // this
- v3s16(0,0,1), // back
- v3s16(0,1,0), // top
- v3s16(1,0,0), // right
- v3s16(0,0,-1), // front
- v3s16(0,-1,0), // bottom
- v3s16(-1,0,0), // left
- };
- for(u16 i=0; i<7; i++)
- {
- v3s16 p2 = p + dirs[i];
- // Block position of neighbor (or requested) node
- v3s16 blockpos = getNodeBlockPos(p2);
- MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
- if(blockref == NULL)
- continue;
- // Relative position of requested node
- v3s16 relpos = p - blockpos*MAP_BLOCKSIZE;
- if(blockref->clearTempMod(relpos))
- {
- changed = true;
- }
- }
- if(changed && affected_blocks!=NULL)
- {
- for(u16 i=0; i<7; i++)
- {
- v3s16 p2 = p + dirs[i];
- // Block position of neighbor (or requested) node
- v3s16 blockpos = getNodeBlockPos(p2);
- MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
- if(blockref == NULL)
- continue;
- affected_blocks->insert(blockpos, blockref);
- }
- }
- return changed;
-}
-
-void ClientMap::expireMeshes(bool only_daynight_diffed)
-{
- TimeTaker timer("expireMeshes()");
-
- core::map<v2s16, MapSector*>::Iterator si;
- si = m_sectors.getIterator();
- for(; si.atEnd() == false; si++)
- {
- MapSector *sector = si.getNode()->getValue();
-
- core::list< MapBlock * > sectorblocks;
- sector->getBlocks(sectorblocks);
-
- core::list< MapBlock * >::Iterator i;
- for(i=sectorblocks.begin(); i!=sectorblocks.end(); i++)
- {
- MapBlock *block = *i;
-
- if(only_daynight_diffed && dayNightDiffed(block->getPos()) == false)
- {
- continue;
- }
-
- {
- JMutexAutoLock lock(block->mesh_mutex);
- if(block->mesh != NULL)
- {
- /*block->mesh->drop();
- block->mesh = NULL;*/
- block->setMeshExpired(true);
- }
- }
- }
- }
-}
-
-void ClientMap::updateMeshes(v3s16 blockpos, u32 daynight_ratio)
-{
- assert(mapType() == MAPTYPE_CLIENT);
-
- try{
- v3s16 p = blockpos + v3s16(0,0,0);
- MapBlock *b = getBlockNoCreate(p);
- b->updateMesh(daynight_ratio);
- //b->setMeshExpired(true);
- }
- catch(InvalidPositionException &e){}
- // Leading edge
- try{
- v3s16 p = blockpos + v3s16(-1,0,0);
- MapBlock *b = getBlockNoCreate(p);
- b->updateMesh(daynight_ratio);
- //b->setMeshExpired(true);
- }
- catch(InvalidPositionException &e){}
- try{
- v3s16 p = blockpos + v3s16(0,-1,0);
- MapBlock *b = getBlockNoCreate(p);
- b->updateMesh(daynight_ratio);
- //b->setMeshExpired(true);
- }
- catch(InvalidPositionException &e){}
- try{
- v3s16 p = blockpos + v3s16(0,0,-1);
- MapBlock *b = getBlockNoCreate(p);
- b->updateMesh(daynight_ratio);
- //b->setMeshExpired(true);
- }
- catch(InvalidPositionException &e){}
-}
-
-#if 0
-/*
- Update mesh of block in which the node is, and if the node is at the
- leading edge, update the appropriate leading blocks too.
-*/
-void ClientMap::updateNodeMeshes(v3s16 nodepos, u32 daynight_ratio)
-{
- v3s16 dirs[4] = {
- v3s16(0,0,0),
- v3s16(-1,0,0),
- v3s16(0,-1,0),
- v3s16(0,0,-1),
- };
- v3s16 blockposes[4];
- for(u32 i=0; i<4; i++)
- {
- v3s16 np = nodepos + dirs[i];
- blockposes[i] = getNodeBlockPos(np);
- // Don't update mesh of block if it has been done already
- bool already_updated = false;
- for(u32 j=0; j<i; j++)
- {
- if(blockposes[j] == blockposes[i])
- {
- already_updated = true;
- break;
- }
- }
- if(already_updated)
- continue;
- // Update mesh
- MapBlock *b = getBlockNoCreate(blockposes[i]);
- b->updateMesh(daynight_ratio);
- }
-}
-#endif
-
void ClientMap::PrintInfo(std::ostream &out)
{
out<<"ClientMap: ";