Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Set tile id in map node #967

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix getMapNodeDataForLayer
Lisa Welsch committed May 29, 2022
commit 6bb41cc7b433e589fc4519360706f2f116231a85
22 changes: 11 additions & 11 deletions src/engine/GameObjects/MapNode.cxx
Original file line number Diff line number Diff line change
@@ -560,10 +560,6 @@ const bool MapNode::isConductive() const

for (auto layer : conductiveLayers)
{
if (isOriginNode()) //&& getTileData(layer))
{
LOG(LOG_ERROR) << "true";
}
if ((!isOriginNode() && m_originCoordinates != Point::INVALID() &&
MapFunctions::instance().getMapNode(m_originCoordinates).getTileData(layer)) ||
(isOriginNode() && getTileData(layer)))
@@ -581,10 +577,7 @@ const TileData *MapNode::getTileData(Layer layer) const
{
return MapFunctions::instance().getMapNode(m_originCoordinates).getMapNodeDataForLayer(layer).tileData;
}
else
{
return m_mapNodeData[layer].tileData;
}
return m_mapNodeData[layer].tileData;
}

const std::string &MapNode::getTileID(Layer layer) const
@@ -593,8 +586,15 @@ const std::string &MapNode::getTileID(Layer layer) const
{
return MapFunctions::instance().getMapNode(m_originCoordinates).getMapNodeDataForLayer(layer).tileID;
}
else
return m_mapNodeData[layer].tileID;
}

const MapNodeData &MapNode::getMapNodeDataForLayer(Layer layer) const
{

if (!isOriginNode() && m_originCoordinates != Point::INVALID())
{
return m_mapNodeData[layer].tileID;
return MapFunctions::instance().getMapNode(m_originCoordinates).getMapNodeDataForLayer(layer);
}
};
return m_mapNodeData[layer];
};
2 changes: 1 addition & 1 deletion src/engine/GameObjects/MapNode.hxx
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ public:
void setMapNodeData(std::vector<MapNodeData> &&mapNodeData);

const std::vector<MapNodeData> &getMapNodeData() const { return m_mapNodeData; };
const MapNodeData &getMapNodeDataForLayer(Layer layer) const { return m_mapNodeData[layer]; };
const MapNodeData &getMapNodeDataForLayer(Layer layer) const;

const MapNodeData &getActiveMapNodeData() const;