mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
New map generator added (and SQLite, messed up the commits at that time...) (import from temporary git repo)
This commit is contained in:
parent
47e4eda4bb
commit
7538b4c620
29 changed files with 135053 additions and 2913 deletions
|
@ -31,13 +31,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
MapBlock::MapBlock(NodeContainer *parent, v3s16 pos, bool dummy):
|
||||
m_parent(parent),
|
||||
m_pos(pos),
|
||||
changed(true),
|
||||
m_modified(MOD_STATE_WRITE_NEEDED),
|
||||
is_underground(false),
|
||||
m_lighting_expired(true),
|
||||
m_day_night_differs(false),
|
||||
//m_not_fully_generated(false),
|
||||
m_generated(false),
|
||||
m_objects(this),
|
||||
m_timestamp(BLOCK_TIMESTAMP_UNDEFINED)
|
||||
m_timestamp(BLOCK_TIMESTAMP_UNDEFINED),
|
||||
m_usage_timer(BLOCK_TIMESTAMP_UNDEFINED)
|
||||
{
|
||||
data = NULL;
|
||||
if(dummy == false)
|
||||
|
@ -241,7 +242,7 @@ bool MapBlock::propagateSunlight(core::map<v3s16, bool> & light_sources,
|
|||
// Check if node above block has sunlight
|
||||
try{
|
||||
MapNode n = getNodeParent(v3s16(x, MAP_BLOCKSIZE, z));
|
||||
if(n.getLight(LIGHTBANK_DAY) != LIGHT_SUN)
|
||||
if(n.d == CONTENT_IGNORE || n.getLight(LIGHTBANK_DAY) != LIGHT_SUN)
|
||||
{
|
||||
no_sunlight = true;
|
||||
}
|
||||
|
@ -593,6 +594,11 @@ void MapBlock::serialize(std::ostream &os, u8 version)
|
|||
flags |= 0x02;
|
||||
if(m_lighting_expired)
|
||||
flags |= 0x04;
|
||||
if(version >= 18)
|
||||
{
|
||||
if(m_generated == false)
|
||||
flags |= 0x08;
|
||||
}
|
||||
os.write((char*)&flags, 1);
|
||||
|
||||
u32 nodecount = MAP_BLOCKSIZE*MAP_BLOCKSIZE*MAP_BLOCKSIZE;
|
||||
|
@ -668,6 +674,12 @@ void MapBlock::deSerialize(std::istream &is, u8 version)
|
|||
setLightingExpired(true);
|
||||
}
|
||||
|
||||
// These have no "generated" field
|
||||
if(version < 18)
|
||||
{
|
||||
m_generated = true;
|
||||
}
|
||||
|
||||
// These have no compression
|
||||
if(version <= 3 || version == 5 || version == 6)
|
||||
{
|
||||
|
@ -749,6 +761,8 @@ void MapBlock::deSerialize(std::istream &is, u8 version)
|
|||
is_underground = (flags & 0x01) ? true : false;
|
||||
m_day_night_differs = (flags & 0x02) ? true : false;
|
||||
m_lighting_expired = (flags & 0x04) ? true : false;
|
||||
if(version >= 18)
|
||||
m_generated = (flags & 0x08) ? false : true;
|
||||
|
||||
// Uncompress data
|
||||
std::ostringstream os(std::ios_base::binary);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue