29 lines
576 B
C++
29 lines
576 B
C++
#include "Node.hpp"
|
|
|
|
Node::Node()
|
|
{
|
|
std::cout << "Default constructing Node with parent " << parent << std::endl;
|
|
}
|
|
|
|
Node::Node(Node *parent) : parent(parent)
|
|
{
|
|
std::cout << "Constructing Node with parent " << parent << std::endl;
|
|
}
|
|
|
|
Configuration* Node::get_configuration()
|
|
{
|
|
Game* game = get_root();
|
|
Configuration* configuration = &game->configuration;
|
|
return configuration;
|
|
}
|
|
|
|
Game* Node::get_root()
|
|
{
|
|
Node *current = this;
|
|
while (current->parent != NULL)
|
|
{
|
|
current = current->parent;
|
|
}
|
|
return static_cast<Game*>(current);
|
|
}
|