// TerrainDispOpts.cpp : implementation file
//

#include "stdafx.h"
#include "tctb.h"
#include "TerrainDispOpts.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTerrainDispOpts dialog


CTerrainDispOpts::CTerrainDispOpts(CWnd* pParent /*=NULL*/)
	: CDialog(CTerrainDispOpts::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTerrainDispOpts)
	m_FPCount = _T("");
	m_OPCount = 0;
	m_DFull = FALSE;
	m_DOpt = FALSE;
	//}}AFX_DATA_INIT
}


void CTerrainDispOpts::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTerrainDispOpts)
	DDX_Text(pDX, IDC_FPCOUNT, m_FPCount);
	DDX_Text(pDX, IDC_OPCOUNT, m_OPCount);
	DDX_Check(pDX, IDC_DFULLTERR, m_DFull);
	DDX_Check(pDX, IDC_OPTTERR, m_DOpt);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTerrainDispOpts, CDialog)
	//{{AFX_MSG_MAP(CTerrainDispOpts)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTerrainDispOpts message handlers

void CTerrainDispOpts::OnOK() 
{
		
	// TODO: Add extra validation here
	UpdateData(TRUE);
	int plimit;
	plimit=atoi(m_FPCount);
	if(m_OPCount>plimit || m_OPCount<2)
	{
	MessageBox("Final Polys must be in range 2 - Original Polys","Invalid Input",MB_OK|MB_ICONWARNING);
	m_OPCount=plimit/2;
	UpdateData(FALSE);
	return;
	}


	CDialog::OnOK();
}

void CTerrainDispOpts::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}
