mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Get rid of parent pointer in MapBlock
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user