#include "stdafx.h"
#include "AddLinkCommand.h"
#include <MW4\Rail_move.hpp>

using namespace MW4AI;

AddLinkCommand::AddLinkCommand(EditorLatticeNode* node)
{
	node1 = node;
}

void AddLinkCommand::ConnectLink(EditorLatticeNode* node)
{
	float weight[NUM_MOVE_TYPES][2];
	
	node2 = node;
	memset(&weight,0,sizeof(weight));
	id = MW4AI::g_MissionGraph->AddLink(node1->railNode->ID(),node2->railNode->ID(),weight,MW4AI::twomax);
	MW4AI::g_MissionGraph->Link(id)->ShowLink(true);
}

void AddLinkCommand::Undo()
{
	MW4AI::g_MissionGraph->DeleteLink(id);
}
