mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Get rid of parent pointer in MapBlock
This commit is contained in:
parent
c6cf90f67b
commit
f5b35a074f
6 changed files with 15 additions and 50 deletions
|
@ -66,8 +66,7 @@ static const char *modified_reason_strings[] = {
|
|||
MapBlock
|
||||
*/
|
||||
|
||||
MapBlock::MapBlock(Map *parent, v3s16 pos, IGameDef *gamedef):
|
||||
m_parent(parent),
|
||||
MapBlock::MapBlock(v3s16 pos, IGameDef *gamedef):
|
||||
m_pos(pos),
|
||||
m_pos_relative(pos * MAP_BLOCKSIZE),
|
||||
data(new MapNode[nodecount]),
|
||||
|
@ -146,25 +145,6 @@ void MapBlock::step(float dtime, const std::function<bool(v3s16, MapNode, f32)>
|
|||
}
|
||||
}
|
||||
|
||||
bool MapBlock::isValidPositionParent(v3s16 p)
|
||||
{
|
||||
if (isValidPosition(p)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_parent->isValidPosition(getPosRelative() + p);
|
||||
}
|
||||
|
||||
MapNode MapBlock::getNodeParent(v3s16 p, bool *is_valid_position)
|
||||
{
|
||||
if (!isValidPosition(p))
|
||||
return m_parent->getNode(getPosRelative() + p, is_valid_position);
|
||||
|
||||
if (is_valid_position)
|
||||
*is_valid_position = true;
|
||||
return data[p.Z * zstride + p.Y * ystride + p.X];
|
||||
}
|
||||
|
||||
std::string MapBlock::getModifiedReasonString()
|
||||
{
|
||||
std::string reason;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue