#if !defined(AFX_LATTICELINKDLG_H__620E2F21_6060_11D3_845A_00105A17BC83__INCLUDED_)
#define AFX_LATTICELINKDLG_H__620E2F21_6060_11D3_845A_00105A17BC83__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// LatticeLinkDlg.h : header file
//

#include <Adept\Entity.hpp>
#include "EditorWaypoint.h"
using namespace MW4AI;

class DeletedLink : public Plug
{
public:

	DeletedLink(int i,bool blocked):
  		Plug(Plug::DefaultData)
	{
		id = i;
		block = blocked;
	}

	int			id;
	bool		block;
	int			node1;
	int			node2;
};

class OriginalLinkData : public Plug
{
public:

	OriginalLinkData(CRailLink* oldData):
  		Plug(Plug::DefaultData)
	{
		link = oldData;

		m_jumpUse = oldData->Jump(oldData->Location (0));
		m_trackUse = oldData->Tracked(oldData->Location (0));
		m_flyUse = oldData->Flyer(oldData->Location (0));
		m_wheelUse = oldData->Wheeled(oldData->Location (0));
		m_legUse = oldData->Legged(oldData->Location (0));
		m_hoverUse = oldData->Hover(oldData->Location (0));
		m_heliUse = oldData->Heli(oldData->Location (0));

		m_jumpWeight = oldData->Weight(MW4AI::JUMPINDEX,oldData->Location (0));
		m_trackWeight = oldData->Weight(MW4AI::TRACKINDEX,oldData->Location (0));
		m_flyWeight = oldData->Weight(MW4AI::FLYINDEX,oldData->Location (0));
		m_wheelWeight = oldData->Weight(MW4AI::WHEELINDEX,oldData->Location (0));
		m_legWeight = oldData->Weight(MW4AI::LEGINDEX,oldData->Location (0));
		m_hoverWeight = oldData->Weight(MW4AI::HOVERINDEX,oldData->Location (0));
		m_heliWeight = oldData->Weight(MW4AI::HELIINDEX,oldData->Location (0));
	}

	CRailLink* link;

	bool m_jumpUse;
	bool m_trackUse;
	bool m_flyUse;
	bool m_wheelUse;
	bool m_legUse;
	bool m_hoverUse;
	bool m_heliUse;

	float m_jumpWeight;
	float m_trackWeight;
	float m_flyWeight;
	float m_wheelWeight;
	float m_legWeight;
	float m_hoverWeight;
	float m_heliWeight;
};


/////////////////////////////////////////////////////////////////////////////
// CLatticeLinkDlg dialog

class CLatticeLinkDlg : public CDialog
{
// Construction
public:
	CLatticeLinkDlg(CWnd* pParent = NULL);   // standard constructor
	~CLatticeLinkDlg();

	void SetNode(Entity* node);

// Dialog Data
	//{{AFX_DATA(CLatticeLinkDlg)
	enum { IDD = IDD_LATTICELINKDLG };
	CListBox	m_LinksList;
	//}}AFX_DATA

	void OnOK();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CLatticeLinkDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	Entity* editNode;

	ChainOf<DeletedLink*>		m_UndoDeleteChain;
	ChainOf<OriginalLinkData*>	m_UndoDataChain;

	void UpdateFields();
	void SetTypeCombo(int curSel, int checkID, int editID, int index);

	// Generated message map functions
	//{{AFX_MSG(CLatticeLinkDlg)
	afx_msg void OnLlcheckfly();
	afx_msg void OnLlcheckheli();
	afx_msg void OnLlcheckhover();
	afx_msg void OnLlcheckjump();
	afx_msg void OnLlcheckleg();
	afx_msg void OnLlchecktrack();
	afx_msg void OnLlcheckwheel();
	afx_msg void OnChangeLlWeightfly();
	afx_msg void OnChangeLlWeightheli();
	afx_msg void OnChangeLlWeighthover();
	afx_msg void OnChangeLlWeightjump();
	afx_msg void OnChangeLlWeightleg();
	afx_msg void OnChangeLlWeighttrack();
	afx_msg void OnChangeLlWeightwheel();
	virtual void OnCancel();
	afx_msg void OnSelchangeLinklist();
	virtual BOOL OnInitDialog();
	afx_msg void OnBlocklinkbtn();
	afx_msg void OnRemovelinkbtn();
	afx_msg void OnClose();
	afx_msg void OnMyOK();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_LATTICELINKDLG_H__620E2F21_6060_11D3_845A_00105A17BC83__INCLUDED_)
