mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Water fixes
Change must_reflow to a deque Add overload for MapBlock::raiseModified that takes a const char*. This is a speed improvement. Comment out unused variable Optimisations to block offset calculations
This commit is contained in:
parent
805c8e51e5
commit
db3466dbe8
3 changed files with 72 additions and 22 deletions
|
@ -166,6 +166,29 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
void raiseModified(u32 mod, const char *reason)
|
||||
{
|
||||
if (mod > m_modified){
|
||||
m_modified = mod;
|
||||
m_modified_reason = reason;
|
||||
m_modified_reason_too_long = false;
|
||||
|
||||
if (m_modified >= MOD_STATE_WRITE_AT_UNLOAD){
|
||||
m_disk_timestamp = m_timestamp;
|
||||
}
|
||||
}
|
||||
else if (mod == m_modified){
|
||||
if (!m_modified_reason_too_long){
|
||||
if (m_modified_reason.size() < 40)
|
||||
m_modified_reason += ", " + std::string(reason);
|
||||
else{
|
||||
m_modified_reason += "...";
|
||||
m_modified_reason_too_long = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 getModified()
|
||||
{
|
||||
return m_modified;
|
||||
|
@ -619,6 +642,16 @@ inline s16 getNodeBlockY(s16 y)
|
|||
return getContainerPos(y, MAP_BLOCKSIZE);
|
||||
}
|
||||
|
||||
inline void getNodeBlockPosWithOffset(const v3s16 &p, v3s16 &block, v3s16 &offset)
|
||||
{
|
||||
getContainerPosWithOffset(p, MAP_BLOCKSIZE, block, offset);
|
||||
}
|
||||
|
||||
inline void getNodeSectorPosWithOffset(const v2s16 &p, v2s16 &block, v2s16 &offset)
|
||||
{
|
||||
getContainerPosWithOffset(p, MAP_BLOCKSIZE, block, offset);
|
||||
}
|
||||
|
||||
/*
|
||||
Get a quick string to describe what a block actually contains
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue