#pragma once
#include "stdafx.h"
#include "resource.h"
#include <windows.h>

#include "AboutDlg.h"

#include "module1.h"

extern int vGenerate;

namespace map {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	//using namespace std;

	// входные данные
	int Generate;

	/// <summary>
	/// Сводка для Form1
	///
	/// Внимание! При изменении имени этого класса необходимо также изменить
	///          свойство имени файла ресурсов ("Resource File Name") для средства компиляции управляемого ресурса,
	///          связанного со всеми файлами с расширением .resx, от которых зависит данный класс. В противном случае,
	///          конструкторы не смогут правильно работать с локализованными
	///          ресурсами, сопоставленными данной форме.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: добавьте код конструктора
			//
		}

	protected:
		/// <summary>
		/// Освободить все используемые ресурсы.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::MenuStrip^  MenuStrip1;
	protected: 
	private: System::Windows::Forms::OpenFileDialog^  OpenFileDialog1;
	private: System::Windows::Forms::SaveFileDialog^  SaveFileDialog1;
	private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  helpToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  aboutToolStripMenuItem;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::GroupBox^  groupBox2;
	private: System::Windows::Forms::CheckBox^  qRegions;
	private: System::Windows::Forms::CheckBox^  qObjects;
	private: System::Windows::Forms::CheckBox^  qLandscape;
	private: System::Windows::Forms::CheckBox^  qStepFloor;
	private: System::Windows::Forms::CheckBox^  qMaze;
	private: System::Windows::Forms::GroupBox^  groupBox5;
	private: System::Windows::Forms::Button^  qLoad2;
	private: System::Windows::Forms::ComboBox^  qIdR;
	private: System::Windows::Forms::Button^  qApplyR;
	private: System::Windows::Forms::Button^  qDeleteR;
	private: System::Windows::Forms::MaskedTextBox^  qTypeR;
	private: System::Windows::Forms::Label^  label3;
	private: System::Windows::Forms::Button^  qSave2;
	private: System::Windows::Forms::Button^  qCreateR;
	private: System::Windows::Forms::Label^  label40;
	private: System::Windows::Forms::Label^  label42;
	private: System::Windows::Forms::Label^  label38;
	private: System::Windows::Forms::MaskedTextBox^  qDownR;
	private: System::Windows::Forms::MaskedTextBox^  qRightR;
	private: System::Windows::Forms::ComboBox^  qSelectM;
	private: System::Windows::Forms::Label^  label41;
	private: System::Windows::Forms::MaskedTextBox^  qLeftR;
	private: System::Windows::Forms::DomainUpDown^  qTerrainType;
	private: System::Windows::Forms::MaskedTextBox^  qUpR;
	private: System::Windows::Forms::Label^  label39;
	private: System::Windows::Forms::NumericUpDown^  qBrushSize;
	private: System::Windows::Forms::Label^  label37;
	private: System::Windows::Forms::Button^  qSaveM;
	private: System::Windows::Forms::Button^  qClearM;
	private: System::Windows::Forms::Label^  label36;
	private: System::Windows::Forms::DomainUpDown^  qObjectNum;
	private: System::Windows::Forms::Button^  qLoadM;
	private: System::Windows::Forms::Label^  label30;
	private: System::Windows::Forms::NumericUpDown^  qLevelUpland;
	private: System::Windows::Forms::Label^  label29;
	private: System::Windows::Forms::Label^  label28;
	private: System::Windows::Forms::GroupBox^  groupBox4;
	private: System::Windows::Forms::NumericUpDown^  qkH;
	private: System::Windows::Forms::NumericUpDown^  qkW;
	private: System::Windows::Forms::Label^  label21;
	private: System::Windows::Forms::Label^  label20;
	private: System::Windows::Forms::Label^  qH;
	private: System::Windows::Forms::Label^  label23;
	private: System::Windows::Forms::Label^  qHm;
	private: System::Windows::Forms::Label^  qWm;
	private: System::Windows::Forms::Label^  label27;
	private: System::Windows::Forms::Label^  label34;
	private: System::Windows::Forms::Label^  qW;
	private: System::Windows::Forms::Label^  label24;
	private: System::Windows::Forms::GroupBox^  groupBox3;
	private: System::Windows::Forms::Label^  label43;
	private: System::Windows::Forms::MaskedTextBox^  qNewH;
	private: System::Windows::Forms::Button^  qCreateNewM;
	private: System::Windows::Forms::Label^  label19;
	private: System::Windows::Forms::MaskedTextBox^  qNewW;
	private: System::Windows::Forms::GroupBox^  groupBox1;
	private: System::Windows::Forms::NumericUpDown^  qBloodB;
	private: System::Windows::Forms::Label^  label35;
	private: System::Windows::Forms::Label^  label26;
	private: System::Windows::Forms::NumericUpDown^  qFelledTreesB;
	private: System::Windows::Forms::Label^  label25;
	private: System::Windows::Forms::NumericUpDown^  qLvlСhangeB;
	private: System::Windows::Forms::Label^  label33;
	private: System::Windows::Forms::NumericUpDown^  qTreeB;
	private: System::Windows::Forms::Label^  label32;
	private: System::Windows::Forms::NumericUpDown^  qWidePassB;
	private: System::Windows::Forms::Label^  label31;
	private: System::Windows::Forms::NumericUpDown^  qIncLvlB;
	private: System::Windows::Forms::ComboBox^  qOpenB;
	private: System::Windows::Forms::Label^  label18;
	private: System::Windows::Forms::ComboBox^  qIdB;
	private: System::Windows::Forms::Label^  label17;
	private: System::Windows::Forms::Button^  qDeleteB;
	private: System::Windows::Forms::MaskedTextBox^  qSizeB;
	private: System::Windows::Forms::Button^  qApplyB;
	private: System::Windows::Forms::Button^  qCreateB;
	private: System::Windows::Forms::Label^  label15;
	private: System::Windows::Forms::Label^  label14;
	private: System::Windows::Forms::Label^  label12;
	private: System::Windows::Forms::MaskedTextBox^  qYB;
	private: System::Windows::Forms::Label^  label13;
	private: System::Windows::Forms::MaskedTextBox^  qXB;
	private: System::Windows::Forms::Label^  label11;
	private: System::Windows::Forms::ComboBox^  qPosDistrB;
	private: System::Windows::Forms::Label^  label10;
	private: System::Windows::Forms::ComboBox^  qTypeB;
	private: System::Windows::Forms::Label^  label9;
	private: System::Windows::Forms::MaskedTextBox^  qAllowanceB;
	private: System::Windows::Forms::Label^  label8;
	private: System::Windows::Forms::Label^  label7;
	private: System::Windows::Forms::MaskedTextBox^  qDownB;
	private: System::Windows::Forms::Label^  label6;
	private: System::Windows::Forms::MaskedTextBox^  qRightB;
	private: System::Windows::Forms::Label^  label5;
	private: System::Windows::Forms::MaskedTextBox^  qUpB;
	private: System::Windows::Forms::Label^  label4;
	private: System::Windows::Forms::MaskedTextBox^  qLeftB;
	private: System::Windows::Forms::Panel^  panel1;
	private: System::Windows::Forms::Button^  qGenerate;
private: System::Windows::Forms::ToolStripMenuItem^  openToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  saveToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  saveAsToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Label^  qCoordinatesMap;


private: System::Windows::Forms::MaskedTextBox^  qClickN;

private: System::Windows::Forms::Label^  label16;
private: System::Windows::Forms::Label^  label2;
private: System::Windows::Forms::Label^  qClick;



	private:
		/// <summary>
		/// Требуется переменная конструктора.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Обязательный метод для поддержки конструктора - не изменяйте
		/// содержимое данного метода при помощи редактора кода.
		/// </summary>
		void InitializeComponent(void)
		{
			this->MenuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
			this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->saveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->saveAsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->OpenFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
			this->SaveFileDialog1 = (gcnew System::Windows::Forms::SaveFileDialog());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
			this->qRegions = (gcnew System::Windows::Forms::CheckBox());
			this->qObjects = (gcnew System::Windows::Forms::CheckBox());
			this->qLandscape = (gcnew System::Windows::Forms::CheckBox());
			this->qStepFloor = (gcnew System::Windows::Forms::CheckBox());
			this->qMaze = (gcnew System::Windows::Forms::CheckBox());
			this->groupBox5 = (gcnew System::Windows::Forms::GroupBox());
			this->qLoad2 = (gcnew System::Windows::Forms::Button());
			this->qIdR = (gcnew System::Windows::Forms::ComboBox());
			this->qApplyR = (gcnew System::Windows::Forms::Button());
			this->qDeleteR = (gcnew System::Windows::Forms::Button());
			this->qTypeR = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label3 = (gcnew System::Windows::Forms::Label());
			this->qSave2 = (gcnew System::Windows::Forms::Button());
			this->qCreateR = (gcnew System::Windows::Forms::Button());
			this->label40 = (gcnew System::Windows::Forms::Label());
			this->label42 = (gcnew System::Windows::Forms::Label());
			this->label38 = (gcnew System::Windows::Forms::Label());
			this->qDownR = (gcnew System::Windows::Forms::MaskedTextBox());
			this->qRightR = (gcnew System::Windows::Forms::MaskedTextBox());
			this->qSelectM = (gcnew System::Windows::Forms::ComboBox());
			this->label41 = (gcnew System::Windows::Forms::Label());
			this->qLeftR = (gcnew System::Windows::Forms::MaskedTextBox());
			this->qTerrainType = (gcnew System::Windows::Forms::DomainUpDown());
			this->qUpR = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label39 = (gcnew System::Windows::Forms::Label());
			this->qBrushSize = (gcnew System::Windows::Forms::NumericUpDown());
			this->label37 = (gcnew System::Windows::Forms::Label());
			this->qSaveM = (gcnew System::Windows::Forms::Button());
			this->qClearM = (gcnew System::Windows::Forms::Button());
			this->label36 = (gcnew System::Windows::Forms::Label());
			this->qObjectNum = (gcnew System::Windows::Forms::DomainUpDown());
			this->qLoadM = (gcnew System::Windows::Forms::Button());
			this->label30 = (gcnew System::Windows::Forms::Label());
			this->qLevelUpland = (gcnew System::Windows::Forms::NumericUpDown());
			this->label29 = (gcnew System::Windows::Forms::Label());
			this->label28 = (gcnew System::Windows::Forms::Label());
			this->groupBox4 = (gcnew System::Windows::Forms::GroupBox());
			this->qkH = (gcnew System::Windows::Forms::NumericUpDown());
			this->qkW = (gcnew System::Windows::Forms::NumericUpDown());
			this->label21 = (gcnew System::Windows::Forms::Label());
			this->label20 = (gcnew System::Windows::Forms::Label());
			this->qH = (gcnew System::Windows::Forms::Label());
			this->label23 = (gcnew System::Windows::Forms::Label());
			this->qHm = (gcnew System::Windows::Forms::Label());
			this->qWm = (gcnew System::Windows::Forms::Label());
			this->label27 = (gcnew System::Windows::Forms::Label());
			this->label34 = (gcnew System::Windows::Forms::Label());
			this->qW = (gcnew System::Windows::Forms::Label());
			this->label24 = (gcnew System::Windows::Forms::Label());
			this->groupBox3 = (gcnew System::Windows::Forms::GroupBox());
			this->label43 = (gcnew System::Windows::Forms::Label());
			this->qNewH = (gcnew System::Windows::Forms::MaskedTextBox());
			this->qCreateNewM = (gcnew System::Windows::Forms::Button());
			this->label19 = (gcnew System::Windows::Forms::Label());
			this->qNewW = (gcnew System::Windows::Forms::MaskedTextBox());
			this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
			this->qBloodB = (gcnew System::Windows::Forms::NumericUpDown());
			this->label35 = (gcnew System::Windows::Forms::Label());
			this->label26 = (gcnew System::Windows::Forms::Label());
			this->qFelledTreesB = (gcnew System::Windows::Forms::NumericUpDown());
			this->label25 = (gcnew System::Windows::Forms::Label());
			this->qLvlСhangeB = (gcnew System::Windows::Forms::NumericUpDown());
			this->label33 = (gcnew System::Windows::Forms::Label());
			this->qTreeB = (gcnew System::Windows::Forms::NumericUpDown());
			this->label32 = (gcnew System::Windows::Forms::Label());
			this->qWidePassB = (gcnew System::Windows::Forms::NumericUpDown());
			this->label31 = (gcnew System::Windows::Forms::Label());
			this->qIncLvlB = (gcnew System::Windows::Forms::NumericUpDown());
			this->qOpenB = (gcnew System::Windows::Forms::ComboBox());
			this->label18 = (gcnew System::Windows::Forms::Label());
			this->qIdB = (gcnew System::Windows::Forms::ComboBox());
			this->label17 = (gcnew System::Windows::Forms::Label());
			this->qDeleteB = (gcnew System::Windows::Forms::Button());
			this->qSizeB = (gcnew System::Windows::Forms::MaskedTextBox());
			this->qApplyB = (gcnew System::Windows::Forms::Button());
			this->qCreateB = (gcnew System::Windows::Forms::Button());
			this->label15 = (gcnew System::Windows::Forms::Label());
			this->label14 = (gcnew System::Windows::Forms::Label());
			this->label12 = (gcnew System::Windows::Forms::Label());
			this->qYB = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label13 = (gcnew System::Windows::Forms::Label());
			this->qXB = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label11 = (gcnew System::Windows::Forms::Label());
			this->qPosDistrB = (gcnew System::Windows::Forms::ComboBox());
			this->label10 = (gcnew System::Windows::Forms::Label());
			this->qTypeB = (gcnew System::Windows::Forms::ComboBox());
			this->label9 = (gcnew System::Windows::Forms::Label());
			this->qAllowanceB = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label8 = (gcnew System::Windows::Forms::Label());
			this->label7 = (gcnew System::Windows::Forms::Label());
			this->qDownB = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label6 = (gcnew System::Windows::Forms::Label());
			this->qRightB = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label5 = (gcnew System::Windows::Forms::Label());
			this->qUpB = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label4 = (gcnew System::Windows::Forms::Label());
			this->qLeftB = (gcnew System::Windows::Forms::MaskedTextBox());
			this->panel1 = (gcnew System::Windows::Forms::Panel());
			this->qGenerate = (gcnew System::Windows::Forms::Button());
			this->button2 = (gcnew System::Windows::Forms::Button());
			this->qCoordinatesMap = (gcnew System::Windows::Forms::Label());
			this->qClickN = (gcnew System::Windows::Forms::MaskedTextBox());
			this->label16 = (gcnew System::Windows::Forms::Label());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->qClick = (gcnew System::Windows::Forms::Label());
			this->MenuStrip1->SuspendLayout();
			this->groupBox2->SuspendLayout();
			this->groupBox5->SuspendLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qBrushSize))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qLevelUpland))->BeginInit();
			this->groupBox4->SuspendLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qkH))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qkW))->BeginInit();
			this->groupBox3->SuspendLayout();
			this->groupBox1->SuspendLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qBloodB))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qFelledTreesB))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qLvlСhangeB))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qTreeB))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qWidePassB))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qIncLvlB))->BeginInit();
			this->SuspendLayout();
			// 
			// MenuStrip1
			// 
			this->MenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->fileToolStripMenuItem, 
				this->helpToolStripMenuItem});
			this->MenuStrip1->Location = System::Drawing::Point(0, 0);
			this->MenuStrip1->Name = L"MenuStrip1";
			this->MenuStrip1->Size = System::Drawing::Size(820, 24);
			this->MenuStrip1->TabIndex = 0;
			this->MenuStrip1->Text = L"menuStrip1";
			// 
			// fileToolStripMenuItem
			// 
			this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->openToolStripMenuItem, 
				this->saveToolStripMenuItem, this->saveAsToolStripMenuItem, this->exitToolStripMenuItem});
			this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
			this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
			this->fileToolStripMenuItem->Text = L"File";
			// 
			// openToolStripMenuItem
			// 
			this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
			this->openToolStripMenuItem->Size = System::Drawing::Size(121, 22);
			this->openToolStripMenuItem->Text = L"Open";
			this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::openToolStripMenuItem_Click);
			// 
			// saveToolStripMenuItem
			// 
			this->saveToolStripMenuItem->Name = L"saveToolStripMenuItem";
			this->saveToolStripMenuItem->Size = System::Drawing::Size(121, 22);
			this->saveToolStripMenuItem->Text = L"Save";
			this->saveToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveToolStripMenuItem_Click);
			// 
			// saveAsToolStripMenuItem
			// 
			this->saveAsToolStripMenuItem->Name = L"saveAsToolStripMenuItem";
			this->saveAsToolStripMenuItem->Size = System::Drawing::Size(121, 22);
			this->saveAsToolStripMenuItem->Text = L"Save as...";
			this->saveAsToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveAsToolStripMenuItem_Click);
			// 
			// exitToolStripMenuItem
			// 
			this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
			this->exitToolStripMenuItem->Size = System::Drawing::Size(121, 22);
			this->exitToolStripMenuItem->Text = L"Exit";
			this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);
			// 
			// helpToolStripMenuItem
			// 
			this->helpToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->aboutToolStripMenuItem});
			this->helpToolStripMenuItem->Name = L"helpToolStripMenuItem";
			this->helpToolStripMenuItem->Size = System::Drawing::Size(44, 20);
			this->helpToolStripMenuItem->Text = L"Help";
			// 
			// aboutToolStripMenuItem
			// 
			this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
			this->aboutToolStripMenuItem->Size = System::Drawing::Size(116, 22);
			this->aboutToolStripMenuItem->Text = L"About...";
			this->aboutToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::aboutToolStripMenuItem_Click);
			// 
			// OpenFileDialog1
			// 
			this->OpenFileDialog1->FileName = L"openFileDialog1";
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(164, 33);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(121, 13);
			this->label1->TabIndex = 2;
			this->label1->Text = L"Лабиринт - Минотавра";
			// 
			// groupBox2
			// 
			this->groupBox2->Controls->Add(this->qRegions);
			this->groupBox2->Controls->Add(this->qObjects);
			this->groupBox2->Controls->Add(this->qLandscape);
			this->groupBox2->Controls->Add(this->qStepFloor);
			this->groupBox2->Controls->Add(this->qMaze);
			this->groupBox2->Location = System::Drawing::Point(22, 60);
			this->groupBox2->Name = L"groupBox2";
			this->groupBox2->Size = System::Drawing::Size(400, 43);
			this->groupBox2->TabIndex = 8;
			this->groupBox2->TabStop = false;
			this->groupBox2->Text = L"Вид";
			// 
			// qRegions
			// 
			this->qRegions->AutoSize = true;
			this->qRegions->Location = System::Drawing::Point(315, 20);
			this->qRegions->Name = L"qRegions";
			this->qRegions->Size = System::Drawing::Size(65, 17);
			this->qRegions->TabIndex = 4;
			this->qRegions->Text = L"Regions";
			this->qRegions->UseVisualStyleBackColor = true;
			this->qRegions->Click += gcnew System::EventHandler(this, &Form1::qRegions_Click);
			// 
			// qObjects
			// 
			this->qObjects->AutoSize = true;
			this->qObjects->Location = System::Drawing::Point(240, 20);
			this->qObjects->Name = L"qObjects";
			this->qObjects->Size = System::Drawing::Size(62, 17);
			this->qObjects->TabIndex = 3;
			this->qObjects->Text = L"Objects";
			this->qObjects->UseVisualStyleBackColor = true;
			this->qObjects->Click += gcnew System::EventHandler(this, &Form1::qObjects_Click);
			// 
			// qLandscape
			// 
			this->qLandscape->AutoSize = true;
			this->qLandscape->Location = System::Drawing::Point(165, 20);
			this->qLandscape->Name = L"qLandscape";
			this->qLandscape->Size = System::Drawing::Size(79, 17);
			this->qLandscape->TabIndex = 2;
			this->qLandscape->Text = L"Landscape";
			this->qLandscape->UseVisualStyleBackColor = true;
			this->qLandscape->Click += gcnew System::EventHandler(this, &Form1::qLandscape_Click);
			// 
			// qStepFloor
			// 
			this->qStepFloor->AutoSize = true;
			this->qStepFloor->Location = System::Drawing::Point(90, 20);
			this->qStepFloor->Name = L"qStepFloor";
			this->qStepFloor->Size = System::Drawing::Size(71, 17);
			this->qStepFloor->TabIndex = 1;
			this->qStepFloor->Text = L"StepFloor";
			this->qStepFloor->UseVisualStyleBackColor = true;
			this->qStepFloor->Click += gcnew System::EventHandler(this, &Form1::qStepFloor_Click);
			// 
			// qMaze
			// 
			this->qMaze->AutoSize = true;
			this->qMaze->Checked = true;
			this->qMaze->CheckState = System::Windows::Forms::CheckState::Checked;
			this->qMaze->Location = System::Drawing::Point(15, 20);
			this->qMaze->Name = L"qMaze";
			this->qMaze->Size = System::Drawing::Size(52, 17);
			this->qMaze->TabIndex = 0;
			this->qMaze->Text = L"Maze";
			this->qMaze->UseVisualStyleBackColor = true;
			this->qMaze->Click += gcnew System::EventHandler(this, &Form1::qMaze_Click);
			// 
			// groupBox5
			// 
			this->groupBox5->Controls->Add(this->qLoad2);
			this->groupBox5->Controls->Add(this->qIdR);
			this->groupBox5->Controls->Add(this->qApplyR);
			this->groupBox5->Controls->Add(this->qDeleteR);
			this->groupBox5->Controls->Add(this->qTypeR);
			this->groupBox5->Controls->Add(this->label3);
			this->groupBox5->Controls->Add(this->qSave2);
			this->groupBox5->Controls->Add(this->qCreateR);
			this->groupBox5->Controls->Add(this->label40);
			this->groupBox5->Controls->Add(this->label42);
			this->groupBox5->Controls->Add(this->label38);
			this->groupBox5->Controls->Add(this->qDownR);
			this->groupBox5->Controls->Add(this->qRightR);
			this->groupBox5->Controls->Add(this->qSelectM);
			this->groupBox5->Controls->Add(this->label41);
			this->groupBox5->Controls->Add(this->qLeftR);
			this->groupBox5->Controls->Add(this->qTerrainType);
			this->groupBox5->Controls->Add(this->qUpR);
			this->groupBox5->Controls->Add(this->label39);
			this->groupBox5->Controls->Add(this->qBrushSize);
			this->groupBox5->Controls->Add(this->label37);
			this->groupBox5->Controls->Add(this->qSaveM);
			this->groupBox5->Controls->Add(this->qClearM);
			this->groupBox5->Controls->Add(this->label36);
			this->groupBox5->Controls->Add(this->qObjectNum);
			this->groupBox5->Controls->Add(this->qLoadM);
			this->groupBox5->Controls->Add(this->label30);
			this->groupBox5->Controls->Add(this->qLevelUpland);
			this->groupBox5->Controls->Add(this->label29);
			this->groupBox5->Controls->Add(this->label28);
			this->groupBox5->Location = System::Drawing::Point(22, 548);
			this->groupBox5->Name = L"groupBox5";
			this->groupBox5->Size = System::Drawing::Size(672, 142);
			this->groupBox5->TabIndex = 47;
			this->groupBox5->TabStop = false;
			this->groupBox5->Text = L"Редактор карты";
			// 
			// qLoad2
			// 
			this->qLoad2->Location = System::Drawing::Point(305, 105);
			this->qLoad2->Name = L"qLoad2";
			this->qLoad2->Size = System::Drawing::Size(75, 23);
			this->qLoad2->TabIndex = 65;
			this->qLoad2->Text = L"Load";
			this->qLoad2->UseVisualStyleBackColor = true;
			this->qLoad2->Click += gcnew System::EventHandler(this, &Form1::qLoad2_Click);
			// 
			// qIdR
			// 
			this->qIdR->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->qIdR->FormattingEnabled = true;
			this->qIdR->Location = System::Drawing::Point(502, 28);
			this->qIdR->Name = L"qIdR";
			this->qIdR->Size = System::Drawing::Size(59, 21);
			this->qIdR->TabIndex = 64;
			this->qIdR->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::qIdR_SelectedIndexChanged);
			// 
			// qApplyR
			// 
			this->qApplyR->Location = System::Drawing::Point(401, 79);
			this->qApplyR->Name = L"qApplyR";
			this->qApplyR->Size = System::Drawing::Size(75, 23);
			this->qApplyR->TabIndex = 63;
			this->qApplyR->Text = L"Применить";
			this->qApplyR->UseVisualStyleBackColor = true;
			this->qApplyR->Click += gcnew System::EventHandler(this, &Form1::qApplyR_Click);
			// 
			// qDeleteR
			// 
			this->qDeleteR->Location = System::Drawing::Point(486, 105);
			this->qDeleteR->Name = L"qDeleteR";
			this->qDeleteR->Size = System::Drawing::Size(75, 23);
			this->qDeleteR->TabIndex = 62;
			this->qDeleteR->Text = L"Удалить";
			this->qDeleteR->UseVisualStyleBackColor = true;
			this->qDeleteR->Click += gcnew System::EventHandler(this, &Form1::qDeleteR_Click);
			// 
			// qTypeR
			// 
			this->qTypeR->Location = System::Drawing::Point(502, 55);
			this->qTypeR->Name = L"qTypeR";
			this->qTypeR->Size = System::Drawing::Size(59, 20);
			this->qTypeR->TabIndex = 60;
			this->qTypeR->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// label3
			// 
			this->label3->AutoSize = true;
			this->label3->Location = System::Drawing::Point(398, 58);
			this->label3->Name = L"label3";
			this->label3->Size = System::Drawing::Size(70, 13);
			this->label3->TabIndex = 58;
			this->label3->Text = L"Тип региона";
			// 
			// qSave2
			// 
			this->qSave2->Location = System::Drawing::Point(218, 105);
			this->qSave2->Name = L"qSave2";
			this->qSave2->Size = System::Drawing::Size(75, 23);
			this->qSave2->TabIndex = 57;
			this->qSave2->Text = L"Save";
			this->qSave2->UseVisualStyleBackColor = true;
			this->qSave2->Click += gcnew System::EventHandler(this, &Form1::qSave2_Click);
			// 
			// qCreateR
			// 
			this->qCreateR->Location = System::Drawing::Point(486, 79);
			this->qCreateR->Name = L"qCreateR";
			this->qCreateR->Size = System::Drawing::Size(75, 23);
			this->qCreateR->TabIndex = 56;
			this->qCreateR->Text = L"Создать";
			this->qCreateR->UseVisualStyleBackColor = true;
			this->qCreateR->Click += gcnew System::EventHandler(this, &Form1::qCreateR_Click);
			// 
			// label40
			// 
			this->label40->AutoSize = true;
			this->label40->Location = System::Drawing::Point(579, 110);
			this->label40->Name = L"label40";
			this->label40->Size = System::Drawing::Size(35, 13);
			this->label40->TabIndex = 53;
			this->label40->Text = L"Down";
			// 
			// label42
			// 
			this->label42->AutoSize = true;
			this->label42->Location = System::Drawing::Point(398, 31);
			this->label42->Name = L"label42";
			this->label42->Size = System::Drawing::Size(85, 13);
			this->label42->TabIndex = 54;
			this->label42->Text = L"Номер региона";
			// 
			// label38
			// 
			this->label38->AutoSize = true;
			this->label38->Location = System::Drawing::Point(579, 58);
			this->label38->Name = L"label38";
			this->label38->Size = System::Drawing::Size(21, 13);
			this->label38->TabIndex = 53;
			this->label38->Text = L"Up";
			// 
			// qDownR
			// 
			this->qDownR->Location = System::Drawing::Point(619, 107);
			this->qDownR->Name = L"qDownR";
			this->qDownR->Size = System::Drawing::Size(36, 20);
			this->qDownR->TabIndex = 52;
			this->qDownR->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// qRightR
			// 
			this->qRightR->Location = System::Drawing::Point(619, 81);
			this->qRightR->Name = L"qRightR";
			this->qRightR->Size = System::Drawing::Size(36, 20);
			this->qRightR->TabIndex = 50;
			this->qRightR->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// qSelectM
			// 
			this->qSelectM->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->qSelectM->FormattingEnabled = true;
			this->qSelectM->Items->AddRange(gcnew cli::array< System::Object^  >(4) {L"_main", L"_slayer_place", L"_dance_pool", L"_base_vampire"});
			this->qSelectM->Location = System::Drawing::Point(288, 28);
			this->qSelectM->Name = L"qSelectM";
			this->qSelectM->Size = System::Drawing::Size(92, 21);
			this->qSelectM->TabIndex = 42;
			this->qSelectM->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::qSelectM_SelectedIndexChanged);
			// 
			// label41
			// 
			this->label41->AutoSize = true;
			this->label41->Location = System::Drawing::Point(579, 84);
			this->label41->Name = L"label41";
			this->label41->Size = System::Drawing::Size(32, 13);
			this->label41->TabIndex = 51;
			this->label41->Text = L"Right";
			// 
			// qLeftR
			// 
			this->qLeftR->Location = System::Drawing::Point(619, 28);
			this->qLeftR->Name = L"qLeftR";
			this->qLeftR->Size = System::Drawing::Size(36, 20);
			this->qLeftR->TabIndex = 50;
			this->qLeftR->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// qTerrainType
			// 
			this->qTerrainType->Items->Add(L"-01");
			this->qTerrainType->Items->Add(L"00");
			this->qTerrainType->Items->Add(L"01");
			this->qTerrainType->Items->Add(L"02");
			this->qTerrainType->Items->Add(L"03");
			this->qTerrainType->Items->Add(L"04");
			this->qTerrainType->Items->Add(L"05");
			this->qTerrainType->Items->Add(L"06");
			this->qTerrainType->Items->Add(L"10");
			this->qTerrainType->Items->Add(L"11");
			this->qTerrainType->Items->Add(L"12");
			this->qTerrainType->Items->Add(L"13");
			this->qTerrainType->Items->Add(L"14");
			this->qTerrainType->Items->Add(L"15");
			this->qTerrainType->Items->Add(L"16");
			this->qTerrainType->Items->Add(L"20");
			this->qTerrainType->Items->Add(L"21");
			this->qTerrainType->Items->Add(L"22");
			this->qTerrainType->Items->Add(L"23");
			this->qTerrainType->Items->Add(L"24");
			this->qTerrainType->Items->Add(L"25");
			this->qTerrainType->Items->Add(L"26");
			this->qTerrainType->Items->Add(L"40");
			this->qTerrainType->Items->Add(L"41");
			this->qTerrainType->Items->Add(L"42");
			this->qTerrainType->Items->Add(L"43");
			this->qTerrainType->Items->Add(L"44");
			this->qTerrainType->Items->Add(L"45");
			this->qTerrainType->Items->Add(L"46");
			this->qTerrainType->Items->Add(L"50");
			this->qTerrainType->Items->Add(L"51");
			this->qTerrainType->Items->Add(L"52");
			this->qTerrainType->Items->Add(L"53");
			this->qTerrainType->Items->Add(L"54");
			this->qTerrainType->Items->Add(L"55");
			this->qTerrainType->Items->Add(L"56");
			this->qTerrainType->Items->Add(L"70");
			this->qTerrainType->Items->Add(L"71");
			this->qTerrainType->Items->Add(L"72");
			this->qTerrainType->Items->Add(L"73");
			this->qTerrainType->Items->Add(L"74");
			this->qTerrainType->Items->Add(L"75");
			this->qTerrainType->Items->Add(L"76");
			this->qTerrainType->Location = System::Drawing::Point(159, 29);
			this->qTerrainType->Name = L"qTerrainType";
			this->qTerrainType->ReadOnly = true;
			this->qTerrainType->Size = System::Drawing::Size(36, 20);
			this->qTerrainType->TabIndex = 47;
			this->qTerrainType->Text = L"00";
			// 
			// qUpR
			// 
			this->qUpR->Location = System::Drawing::Point(619, 55);
			this->qUpR->Name = L"qUpR";
			this->qUpR->Size = System::Drawing::Size(36, 20);
			this->qUpR->TabIndex = 52;
			this->qUpR->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// label39
			// 
			this->label39->AutoSize = true;
			this->label39->Location = System::Drawing::Point(579, 31);
			this->label39->Name = L"label39";
			this->label39->Size = System::Drawing::Size(25, 13);
			this->label39->TabIndex = 51;
			this->label39->Text = L"Left";
			// 
			// qBrushSize
			// 
			this->qBrushSize->Location = System::Drawing::Point(159, 108);
			this->qBrushSize->Name = L"qBrushSize";
			this->qBrushSize->ReadOnly = true;
			this->qBrushSize->Size = System::Drawing::Size(36, 20);
			this->qBrushSize->TabIndex = 46;
			// 
			// label37
			// 
			this->label37->AutoSize = true;
			this->label37->Location = System::Drawing::Point(12, 110);
			this->label37->Name = L"label37";
			this->label37->Size = System::Drawing::Size(78, 13);
			this->label37->TabIndex = 45;
			this->label37->Text = L"Размер кисти";
			// 
			// qSaveM
			// 
			this->qSaveM->Location = System::Drawing::Point(305, 53);
			this->qSaveM->Name = L"qSaveM";
			this->qSaveM->Size = System::Drawing::Size(75, 23);
			this->qSaveM->TabIndex = 31;
			this->qSaveM->Text = L"Сохранить";
			this->qSaveM->UseVisualStyleBackColor = true;
			this->qSaveM->Click += gcnew System::EventHandler(this, &Form1::qSaveM_Click);
			// 
			// qClearM
			// 
			this->qClearM->Location = System::Drawing::Point(305, 79);
			this->qClearM->Name = L"qClearM";
			this->qClearM->Size = System::Drawing::Size(75, 23);
			this->qClearM->TabIndex = 44;
			this->qClearM->Text = L"Очистить";
			this->qClearM->UseVisualStyleBackColor = true;
			this->qClearM->Click += gcnew System::EventHandler(this, &Form1::qClearM_Click);
			// 
			// label36
			// 
			this->label36->AutoSize = true;
			this->label36->Location = System::Drawing::Point(12, 31);
			this->label36->Name = L"label36";
			this->label36->Size = System::Drawing::Size(83, 13);
			this->label36->TabIndex = 40;
			this->label36->Text = L"Тип местности";
			// 
			// qObjectNum
			// 
			this->qObjectNum->Items->Add(L"00");
			this->qObjectNum->Items->Add(L"T1");
			this->qObjectNum->Items->Add(L"T2");
			this->qObjectNum->Items->Add(L"B1");
			this->qObjectNum->Items->Add(L"P1");
			this->qObjectNum->Items->Add(L"P2");
			this->qObjectNum->Items->Add(L"R1");
			this->qObjectNum->Items->Add(L"H1");
			this->qObjectNum->Items->Add(L"H2");
			this->qObjectNum->Items->Add(L"H3");
			this->qObjectNum->Items->Add(L"F1");
			this->qObjectNum->Items->Add(L"K1");
			this->qObjectNum->Items->Add(L"O1");
			this->qObjectNum->Items->Add(L"O2");
			this->qObjectNum->Items->Add(L"S1");
			this->qObjectNum->Items->Add(L"Y1");
			this->qObjectNum->Items->Add(L"E1");
			this->qObjectNum->Items->Add(L"E2");
			this->qObjectNum->Items->Add(L"E3");
			this->qObjectNum->Items->Add(L"E4");
			this->qObjectNum->Items->Add(L"E5");
			this->qObjectNum->Items->Add(L"E6");
			this->qObjectNum->Location = System::Drawing::Point(159, 82);
			this->qObjectNum->Name = L"qObjectNum";
			this->qObjectNum->ReadOnly = true;
			this->qObjectNum->Size = System::Drawing::Size(36, 20);
			this->qObjectNum->TabIndex = 39;
			this->qObjectNum->Text = L"00";
			// 
			// qLoadM
			// 
			this->qLoadM->Location = System::Drawing::Point(217, 53);
			this->qLoadM->Name = L"qLoadM";
			this->qLoadM->Size = System::Drawing::Size(75, 23);
			this->qLoadM->TabIndex = 30;
			this->qLoadM->Text = L"Загрузить";
			this->qLoadM->UseVisualStyleBackColor = true;
			this->qLoadM->Click += gcnew System::EventHandler(this, &Form1::qLoadM_Click);
			// 
			// label30
			// 
			this->label30->AutoSize = true;
			this->label30->Location = System::Drawing::Point(12, 84);
			this->label30->Name = L"label30";
			this->label30->Size = System::Drawing::Size(45, 13);
			this->label30->TabIndex = 34;
			this->label30->Text = L"Объект";
			// 
			// qLevelUpland
			// 
			this->qLevelUpland->Location = System::Drawing::Point(159, 56);
			this->qLevelUpland->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {6, 0, 0, 0});
			this->qLevelUpland->Name = L"qLevelUpland";
			this->qLevelUpland->ReadOnly = true;
			this->qLevelUpland->Size = System::Drawing::Size(36, 20);
			this->qLevelUpland->TabIndex = 33;
			// 
			// label29
			// 
			this->label29->AutoSize = true;
			this->label29->Location = System::Drawing::Point(12, 58);
			this->label29->Name = L"label29";
			this->label29->Size = System::Drawing::Size(135, 13);
			this->label29->TabIndex = 32;
			this->label29->Text = L"Уровень возвышенности";
			// 
			// label28
			// 
			this->label28->AutoSize = true;
			this->label28->Location = System::Drawing::Point(215, 31);
			this->label28->Name = L"label28";
			this->label28->Size = System::Drawing::Size(37, 13);
			this->label28->TabIndex = 27;
			this->label28->Text = L"Карта";
			// 
			// groupBox4
			// 
			this->groupBox4->Controls->Add(this->qkH);
			this->groupBox4->Controls->Add(this->qkW);
			this->groupBox4->Controls->Add(this->label21);
			this->groupBox4->Controls->Add(this->label20);
			this->groupBox4->Controls->Add(this->qH);
			this->groupBox4->Controls->Add(this->label23);
			this->groupBox4->Controls->Add(this->qHm);
			this->groupBox4->Controls->Add(this->qWm);
			this->groupBox4->Controls->Add(this->label27);
			this->groupBox4->Controls->Add(this->label34);
			this->groupBox4->Controls->Add(this->qW);
			this->groupBox4->Controls->Add(this->label24);
			this->groupBox4->Location = System::Drawing::Point(451, 60);
			this->groupBox4->Name = L"groupBox4";
			this->groupBox4->Size = System::Drawing::Size(191, 116);
			this->groupBox4->TabIndex = 46;
			this->groupBox4->TabStop = false;
			this->groupBox4->Text = L"Свойства карты";
			// 
			// qkH
			// 
			this->qkH->Location = System::Drawing::Point(53, 55);
			this->qkH->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {6, 0, 0, 0});
			this->qkH->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {4, 0, 0, 0});
			this->qkH->Name = L"qkH";
			this->qkH->ReadOnly = true;
			this->qkH->Size = System::Drawing::Size(36, 20);
			this->qkH->TabIndex = 59;
			this->qkH->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {4, 0, 0, 0});
			// 
			// qkW
			// 
			this->qkW->Location = System::Drawing::Point(53, 29);
			this->qkW->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {6, 0, 0, 0});
			this->qkW->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {4, 0, 0, 0});
			this->qkW->Name = L"qkW";
			this->qkW->ReadOnly = true;
			this->qkW->Size = System::Drawing::Size(36, 20);
			this->qkW->TabIndex = 58;
			this->qkW->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {4, 0, 0, 0});
			// 
			// label21
			// 
			this->label21->AutoSize = true;
			this->label21->Location = System::Drawing::Point(19, 57);
			this->label21->Name = L"label21";
			this->label21->Size = System::Drawing::Size(21, 13);
			this->label21->TabIndex = 57;
			this->label21->Text = L"kH";
			// 
			// label20
			// 
			this->label20->AutoSize = true;
			this->label20->Location = System::Drawing::Point(19, 31);
			this->label20->Name = L"label20";
			this->label20->Size = System::Drawing::Size(24, 13);
			this->label20->TabIndex = 55;
			this->label20->Text = L"kW";
			// 
			// qH
			// 
			this->qH->AutoSize = true;
			this->qH->Location = System::Drawing::Point(134, 83);
			this->qH->Name = L"qH";
			this->qH->Size = System::Drawing::Size(17, 13);
			this->qH->TabIndex = 53;
			this->qH->Text = L"//";
			// 
			// label23
			// 
			this->label23->AutoSize = true;
			this->label23->Location = System::Drawing::Point(103, 83);
			this->label23->Name = L"label23";
			this->label23->Size = System::Drawing::Size(15, 13);
			this->label23->TabIndex = 52;
			this->label23->Text = L"H";
			// 
			// qHm
			// 
			this->qHm->AutoSize = true;
			this->qHm->Location = System::Drawing::Point(134, 57);
			this->qHm->Name = L"qHm";
			this->qHm->Size = System::Drawing::Size(17, 13);
			this->qHm->TabIndex = 51;
			this->qHm->Text = L"//";
			// 
			// qWm
			// 
			this->qWm->AutoSize = true;
			this->qWm->Location = System::Drawing::Point(134, 31);
			this->qWm->Name = L"qWm";
			this->qWm->Size = System::Drawing::Size(17, 13);
			this->qWm->TabIndex = 50;
			this->qWm->Text = L"//";
			// 
			// label27
			// 
			this->label27->AutoSize = true;
			this->label27->Location = System::Drawing::Point(103, 57);
			this->label27->Name = L"label27";
			this->label27->Size = System::Drawing::Size(23, 13);
			this->label27->TabIndex = 49;
			this->label27->Text = L"Hm";
			// 
			// label34
			// 
			this->label34->AutoSize = true;
			this->label34->Location = System::Drawing::Point(103, 31);
			this->label34->Name = L"label34";
			this->label34->Size = System::Drawing::Size(26, 13);
			this->label34->TabIndex = 48;
			this->label34->Text = L"Wm";
			// 
			// qW
			// 
			this->qW->AutoSize = true;
			this->qW->Location = System::Drawing::Point(50, 83);
			this->qW->Name = L"qW";
			this->qW->Size = System::Drawing::Size(17, 13);
			this->qW->TabIndex = 45;
			this->qW->Text = L"//";
			// 
			// label24
			// 
			this->label24->AutoSize = true;
			this->label24->Location = System::Drawing::Point(19, 83);
			this->label24->Name = L"label24";
			this->label24->Size = System::Drawing::Size(18, 13);
			this->label24->TabIndex = 42;
			this->label24->Text = L"W";
			// 
			// groupBox3
			// 
			this->groupBox3->Controls->Add(this->label43);
			this->groupBox3->Controls->Add(this->qNewH);
			this->groupBox3->Controls->Add(this->qCreateNewM);
			this->groupBox3->Controls->Add(this->label19);
			this->groupBox3->Controls->Add(this->qNewW);
			this->groupBox3->Location = System::Drawing::Point(648, 60);
			this->groupBox3->Name = L"groupBox3";
			this->groupBox3->Size = System::Drawing::Size(160, 116);
			this->groupBox3->TabIndex = 45;
			this->groupBox3->TabStop = false;
			this->groupBox3->Text = L"Новая карта";
			// 
			// label43
			// 
			this->label43->AutoSize = true;
			this->label43->Location = System::Drawing::Point(8, 57);
			this->label43->Name = L"label43";
			this->label43->Size = System::Drawing::Size(15, 13);
			this->label43->TabIndex = 44;
			this->label43->Text = L"H";
			// 
			// qNewH
			// 
			this->qNewH->Location = System::Drawing::Point(53, 54);
			this->qNewH->Name = L"qNewH";
			this->qNewH->Size = System::Drawing::Size(92, 20);
			this->qNewH->TabIndex = 43;
			this->qNewH->Text = L"128";
			this->qNewH->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// qCreateNewM
			// 
			this->qCreateNewM->Location = System::Drawing::Point(51, 83);
			this->qCreateNewM->Name = L"qCreateNewM";
			this->qCreateNewM->Size = System::Drawing::Size(75, 23);
			this->qCreateNewM->TabIndex = 42;
			this->qCreateNewM->Text = L"Создать";
			this->qCreateNewM->UseVisualStyleBackColor = true;
			this->qCreateNewM->Click += gcnew System::EventHandler(this, &Form1::qCreateNewM_Click);
			// 
			// label19
			// 
			this->label19->AutoSize = true;
			this->label19->Location = System::Drawing::Point(8, 31);
			this->label19->Name = L"label19";
			this->label19->Size = System::Drawing::Size(18, 13);
			this->label19->TabIndex = 37;
			this->label19->Text = L"W";
			// 
			// qNewW
			// 
			this->qNewW->Location = System::Drawing::Point(53, 28);
			this->qNewW->Name = L"qNewW";
			this->qNewW->Size = System::Drawing::Size(92, 20);
			this->qNewW->TabIndex = 36;
			this->qNewW->Text = L"128";
			this->qNewW->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// groupBox1
			// 
			this->groupBox1->Controls->Add(this->qBloodB);
			this->groupBox1->Controls->Add(this->label35);
			this->groupBox1->Controls->Add(this->label26);
			this->groupBox1->Controls->Add(this->qFelledTreesB);
			this->groupBox1->Controls->Add(this->label25);
			this->groupBox1->Controls->Add(this->qLvlСhangeB);
			this->groupBox1->Controls->Add(this->label33);
			this->groupBox1->Controls->Add(this->qTreeB);
			this->groupBox1->Controls->Add(this->label32);
			this->groupBox1->Controls->Add(this->qWidePassB);
			this->groupBox1->Controls->Add(this->label31);
			this->groupBox1->Controls->Add(this->qIncLvlB);
			this->groupBox1->Controls->Add(this->qOpenB);
			this->groupBox1->Controls->Add(this->label18);
			this->groupBox1->Controls->Add(this->qIdB);
			this->groupBox1->Controls->Add(this->label17);
			this->groupBox1->Controls->Add(this->qDeleteB);
			this->groupBox1->Controls->Add(this->qSizeB);
			this->groupBox1->Controls->Add(this->qApplyB);
			this->groupBox1->Controls->Add(this->qCreateB);
			this->groupBox1->Controls->Add(this->label15);
			this->groupBox1->Controls->Add(this->label14);
			this->groupBox1->Controls->Add(this->label12);
			this->groupBox1->Controls->Add(this->qYB);
			this->groupBox1->Controls->Add(this->label13);
			this->groupBox1->Controls->Add(this->qXB);
			this->groupBox1->Controls->Add(this->label11);
			this->groupBox1->Controls->Add(this->qPosDistrB);
			this->groupBox1->Controls->Add(this->label10);
			this->groupBox1->Controls->Add(this->qTypeB);
			this->groupBox1->Controls->Add(this->label9);
			this->groupBox1->Controls->Add(this->qAllowanceB);
			this->groupBox1->Controls->Add(this->label8);
			this->groupBox1->Controls->Add(this->label7);
			this->groupBox1->Controls->Add(this->qDownB);
			this->groupBox1->Controls->Add(this->label6);
			this->groupBox1->Controls->Add(this->qRightB);
			this->groupBox1->Controls->Add(this->label5);
			this->groupBox1->Controls->Add(this->qUpB);
			this->groupBox1->Controls->Add(this->label4);
			this->groupBox1->Controls->Add(this->qLeftB);
			this->groupBox1->Location = System::Drawing::Point(451, 182);
			this->groupBox1->Name = L"groupBox1";
			this->groupBox1->Size = System::Drawing::Size(357, 350);
			this->groupBox1->TabIndex = 44;
			this->groupBox1->TabStop = false;
			this->groupBox1->Text = L"Редактор баз";
			// 
			// qBloodB
			// 
			this->qBloodB->DecimalPlaces = 2;
			this->qBloodB->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 65536});
			this->qBloodB->Location = System::Drawing::Point(252, 234);
			this->qBloodB->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
			this->qBloodB->Name = L"qBloodB";
			this->qBloodB->Size = System::Drawing::Size(92, 20);
			this->qBloodB->TabIndex = 49;
			// 
			// label35
			// 
			this->label35->AutoSize = true;
			this->label35->Location = System::Drawing::Point(187, 236);
			this->label35->Name = L"label35";
			this->label35->Size = System::Drawing::Size(34, 13);
			this->label35->TabIndex = 48;
			this->label35->Text = L"Blood";
			// 
			// label26
			// 
			this->label26->AutoSize = true;
			this->label26->Location = System::Drawing::Point(187, 133);
			this->label26->Name = L"label26";
			this->label26->Size = System::Drawing::Size(62, 13);
			this->label26->TabIndex = 47;
			this->label26->Text = L"FelledTrees";
			// 
			// qFelledTreesB
			// 
			this->qFelledTreesB->DecimalPlaces = 2;
			this->qFelledTreesB->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 65536});
			this->qFelledTreesB->Location = System::Drawing::Point(252, 131);
			this->qFelledTreesB->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
			this->qFelledTreesB->Name = L"qFelledTreesB";
			this->qFelledTreesB->Size = System::Drawing::Size(92, 20);
			this->qFelledTreesB->TabIndex = 46;
			// 
			// label25
			// 
			this->label25->AutoSize = true;
			this->label25->Location = System::Drawing::Point(187, 159);
			this->label25->Name = L"label25";
			this->label25->Size = System::Drawing::Size(58, 13);
			this->label25->TabIndex = 45;
			this->label25->Text = L"LvlСhange";
			// 
			// qLvlСhangeB
			// 
			this->qLvlСhangeB->DecimalPlaces = 2;
			this->qLvlСhangeB->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 65536});
			this->qLvlСhangeB->Location = System::Drawing::Point(253, 157);
			this->qLvlСhangeB->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
			this->qLvlСhangeB->Name = L"qLvlСhangeB";
			this->qLvlСhangeB->Size = System::Drawing::Size(92, 20);
			this->qLvlСhangeB->TabIndex = 44;
			// 
			// label33
			// 
			this->label33->AutoSize = true;
			this->label33->Location = System::Drawing::Point(187, 108);
			this->label33->Name = L"label33";
			this->label33->Size = System::Drawing::Size(29, 13);
			this->label33->TabIndex = 43;
			this->label33->Text = L"Tree";
			// 
			// qTreeB
			// 
			this->qTreeB->DecimalPlaces = 2;
			this->qTreeB->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 65536});
			this->qTreeB->Location = System::Drawing::Point(252, 106);
			this->qTreeB->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
			this->qTreeB->Name = L"qTreeB";
			this->qTreeB->Size = System::Drawing::Size(92, 20);
			this->qTreeB->TabIndex = 42;
			// 
			// label32
			// 
			this->label32->AutoSize = true;
			this->label32->Location = System::Drawing::Point(188, 210);
			this->label32->Name = L"label32";
			this->label32->Size = System::Drawing::Size(55, 13);
			this->label32->TabIndex = 41;
			this->label32->Text = L"WidePass";
			// 
			// qWidePassB
			// 
			this->qWidePassB->DecimalPlaces = 2;
			this->qWidePassB->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 65536});
			this->qWidePassB->Location = System::Drawing::Point(253, 208);
			this->qWidePassB->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
			this->qWidePassB->Name = L"qWidePassB";
			this->qWidePassB->Size = System::Drawing::Size(92, 20);
			this->qWidePassB->TabIndex = 40;
			// 
			// label31
			// 
			this->label31->AutoSize = true;
			this->label31->Location = System::Drawing::Point(187, 184);
			this->label31->Name = L"label31";
			this->label31->Size = System::Drawing::Size(36, 13);
			this->label31->TabIndex = 39;
			this->label31->Text = L"IncLvl";
			// 
			// qIncLvlB
			// 
			this->qIncLvlB->DecimalPlaces = 2;
			this->qIncLvlB->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 65536});
			this->qIncLvlB->Location = System::Drawing::Point(253, 182);
			this->qIncLvlB->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
			this->qIncLvlB->Name = L"qIncLvlB";
			this->qIncLvlB->Size = System::Drawing::Size(92, 20);
			this->qIncLvlB->TabIndex = 38;
			// 
			// qOpenB
			// 
			this->qOpenB->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->qOpenB->FormattingEnabled = true;
			this->qOpenB->Items->AddRange(gcnew cli::array< System::Object^  >(2) {L"True", L"False"});
			this->qOpenB->Location = System::Drawing::Point(252, 23);
			this->qOpenB->Name = L"qOpenB";
			this->qOpenB->Size = System::Drawing::Size(93, 21);
			this->qOpenB->TabIndex = 37;
			// 
			// label18
			// 
			this->label18->AutoSize = true;
			this->label18->Location = System::Drawing::Point(187, 26);
			this->label18->Name = L"label18";
			this->label18->Size = System::Drawing::Size(33, 13);
			this->label18->TabIndex = 36;
			this->label18->Text = L"Open";
			// 
			// qIdB
			// 
			this->qIdB->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->qIdB->FormattingEnabled = true;
			this->qIdB->Location = System::Drawing::Point(73, 23);
			this->qIdB->Name = L"qIdB";
			this->qIdB->Size = System::Drawing::Size(92, 21);
			this->qIdB->TabIndex = 35;
			this->qIdB->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::qIdB_SelectedIndexChanged);
			// 
			// label17
			// 
			this->label17->AutoSize = true;
			this->label17->Location = System::Drawing::Point(8, 26);
			this->label17->Name = L"label17";
			this->label17->Size = System::Drawing::Size(18, 13);
			this->label17->TabIndex = 34;
			this->label17->Text = L"ID";
			// 
			// qDeleteB
			// 
			this->qDeleteB->Location = System::Drawing::Point(271, 293);
			this->qDeleteB->Name = L"qDeleteB";
			this->qDeleteB->Size = System::Drawing::Size(75, 23);
			this->qDeleteB->TabIndex = 32;
			this->qDeleteB->Text = L"Удалить";
			this->qDeleteB->UseVisualStyleBackColor = true;
			this->qDeleteB->Click += gcnew System::EventHandler(this, &Form1::qDeleteB_Click);
			// 
			// qSizeB
			// 
			this->qSizeB->Location = System::Drawing::Point(73, 182);
			this->qSizeB->Name = L"qSizeB";
			this->qSizeB->Size = System::Drawing::Size(92, 20);
			this->qSizeB->TabIndex = 31;
			this->qSizeB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// qApplyB
			// 
			this->qApplyB->Location = System::Drawing::Point(190, 267);
			this->qApplyB->Name = L"qApplyB";
			this->qApplyB->Size = System::Drawing::Size(75, 23);
			this->qApplyB->TabIndex = 29;
			this->qApplyB->Text = L"Применить";
			this->qApplyB->UseVisualStyleBackColor = true;
			this->qApplyB->Click += gcnew System::EventHandler(this, &Form1::qApplyB_Click);
			// 
			// qCreateB
			// 
			this->qCreateB->Location = System::Drawing::Point(271, 267);
			this->qCreateB->Name = L"qCreateB";
			this->qCreateB->Size = System::Drawing::Size(75, 23);
			this->qCreateB->TabIndex = 28;
			this->qCreateB->Text = L"Создать";
			this->qCreateB->UseVisualStyleBackColor = true;
			this->qCreateB->Click += gcnew System::EventHandler(this, &Form1::qCreateB_Click);
			// 
			// label15
			// 
			this->label15->AutoSize = true;
			this->label15->Location = System::Drawing::Point(8, 53);
			this->label15->Name = L"label15";
			this->label15->Size = System::Drawing::Size(48, 13);
			this->label15->TabIndex = 27;
			this->label15->Text = L"Location";
			// 
			// label14
			// 
			this->label14->AutoSize = true;
			this->label14->Location = System::Drawing::Point(8, 236);
			this->label14->Name = L"label14";
			this->label14->Size = System::Drawing::Size(46, 13);
			this->label14->TabIndex = 26;
			this->label14->Text = L"CellPath";
			// 
			// label12
			// 
			this->label12->AutoSize = true;
			this->label12->Location = System::Drawing::Point(8, 287);
			this->label12->Name = L"label12";
			this->label12->Size = System::Drawing::Size(12, 13);
			this->label12->TabIndex = 25;
			this->label12->Text = L"y";
			// 
			// qYB
			// 
			this->qYB->Location = System::Drawing::Point(73, 284);
			this->qYB->Name = L"qYB";
			this->qYB->Size = System::Drawing::Size(92, 20);
			this->qYB->TabIndex = 24;
			this->qYB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// label13
			// 
			this->label13->AutoSize = true;
			this->label13->Location = System::Drawing::Point(8, 261);
			this->label13->Name = L"label13";
			this->label13->Size = System::Drawing::Size(12, 13);
			this->label13->TabIndex = 23;
			this->label13->Text = L"x";
			// 
			// qXB
			// 
			this->qXB->Location = System::Drawing::Point(73, 258);
			this->qXB->Name = L"qXB";
			this->qXB->Size = System::Drawing::Size(92, 20);
			this->qXB->TabIndex = 22;
			this->qXB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// label11
			// 
			this->label11->AutoSize = true;
			this->label11->Location = System::Drawing::Point(187, 80);
			this->label11->Name = L"label11";
			this->label11->Size = System::Drawing::Size(46, 13);
			this->label11->TabIndex = 21;
			this->label11->Text = L"PosDistr";
			// 
			// qPosDistrB
			// 
			this->qPosDistrB->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->qPosDistrB->FormattingEnabled = true;
			this->qPosDistrB->Items->AddRange(gcnew cli::array< System::Object^  >(9) {L"CENTER", L"LEFT", L"UP", L"RIGHT", L"DOWN", 
				L"LEFTUP", L"RIGHTUP", L"LEFTDOWN", L"RIGHTDOWN"});
			this->qPosDistrB->Location = System::Drawing::Point(252, 77);
			this->qPosDistrB->Name = L"qPosDistrB";
			this->qPosDistrB->Size = System::Drawing::Size(92, 21);
			this->qPosDistrB->TabIndex = 20;
			// 
			// label10
			// 
			this->label10->AutoSize = true;
			this->label10->Location = System::Drawing::Point(187, 53);
			this->label10->Name = L"label10";
			this->label10->Size = System::Drawing::Size(31, 13);
			this->label10->TabIndex = 19;
			this->label10->Text = L"Type";
			// 
			// qTypeB
			// 
			this->qTypeB->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->qTypeB->FormattingEnabled = true;
			this->qTypeB->Items->AddRange(gcnew cli::array< System::Object^  >(2) {L"1", L"2"});
			this->qTypeB->Location = System::Drawing::Point(252, 50);
			this->qTypeB->Name = L"qTypeB";
			this->qTypeB->Size = System::Drawing::Size(93, 21);
			this->qTypeB->TabIndex = 18;
			// 
			// label9
			// 
			this->label9->AutoSize = true;
			this->label9->Location = System::Drawing::Point(9, 211);
			this->label9->Name = L"label9";
			this->label9->Size = System::Drawing::Size(56, 13);
			this->label9->TabIndex = 17;
			this->label9->Text = L"Allowance";
			// 
			// qAllowanceB
			// 
			this->qAllowanceB->Location = System::Drawing::Point(73, 208);
			this->qAllowanceB->Name = L"qAllowanceB";
			this->qAllowanceB->Size = System::Drawing::Size(92, 20);
			this->qAllowanceB->TabIndex = 16;
			this->qAllowanceB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// label8
			// 
			this->label8->AutoSize = true;
			this->label8->Location = System::Drawing::Point(8, 185);
			this->label8->Name = L"label8";
			this->label8->Size = System::Drawing::Size(27, 13);
			this->label8->TabIndex = 15;
			this->label8->Text = L"Size";
			// 
			// label7
			// 
			this->label7->AutoSize = true;
			this->label7->Location = System::Drawing::Point(8, 160);
			this->label7->Name = L"label7";
			this->label7->Size = System::Drawing::Size(35, 13);
			this->label7->TabIndex = 13;
			this->label7->Text = L"Down";
			// 
			// qDownB
			// 
			this->qDownB->Location = System::Drawing::Point(73, 157);
			this->qDownB->Name = L"qDownB";
			this->qDownB->Size = System::Drawing::Size(92, 20);
			this->qDownB->TabIndex = 12;
			this->qDownB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			this->qDownB->KeyUp += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::qVisual);
			// 
			// label6
			// 
			this->label6->AutoSize = true;
			this->label6->Location = System::Drawing::Point(8, 134);
			this->label6->Name = L"label6";
			this->label6->Size = System::Drawing::Size(32, 13);
			this->label6->TabIndex = 11;
			this->label6->Text = L"Right";
			// 
			// qRightB
			// 
			this->qRightB->Location = System::Drawing::Point(73, 131);
			this->qRightB->Name = L"qRightB";
			this->qRightB->Size = System::Drawing::Size(92, 20);
			this->qRightB->TabIndex = 10;
			this->qRightB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			this->qRightB->KeyUp += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::qVisual);
			// 
			// label5
			// 
			this->label5->AutoSize = true;
			this->label5->Location = System::Drawing::Point(8, 108);
			this->label5->Name = L"label5";
			this->label5->Size = System::Drawing::Size(21, 13);
			this->label5->TabIndex = 9;
			this->label5->Text = L"Up";
			// 
			// qUpB
			// 
			this->qUpB->Location = System::Drawing::Point(73, 105);
			this->qUpB->Name = L"qUpB";
			this->qUpB->Size = System::Drawing::Size(92, 20);
			this->qUpB->TabIndex = 8;
			this->qUpB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			this->qUpB->KeyUp += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::qVisual);
			// 
			// label4
			// 
			this->label4->AutoSize = true;
			this->label4->Location = System::Drawing::Point(8, 80);
			this->label4->Name = L"label4";
			this->label4->Size = System::Drawing::Size(25, 13);
			this->label4->TabIndex = 7;
			this->label4->Text = L"Left";
			// 
			// qLeftB
			// 
			this->qLeftB->Location = System::Drawing::Point(73, 77);
			this->qLeftB->Name = L"qLeftB";
			this->qLeftB->Size = System::Drawing::Size(92, 20);
			this->qLeftB->TabIndex = 0;
			this->qLeftB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			this->qLeftB->KeyUp += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::qVisual);
			// 
			// panel1
			// 
			this->panel1->BackColor = System::Drawing::SystemColors::ScrollBar;
			this->panel1->Location = System::Drawing::Point(22, 114);
			this->panel1->Name = L"panel1";
			this->panel1->Size = System::Drawing::Size(400, 400);
			this->panel1->TabIndex = 43;
			this->panel1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::panel1_MouseDown);
			this->panel1->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::panel1_MouseMove);
			this->panel1->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::panel1_MouseUp);
			// 
			// qGenerate
			// 
			this->qGenerate->Location = System::Drawing::Point(733, 574);
			this->qGenerate->Name = L"qGenerate";
			this->qGenerate->Size = System::Drawing::Size(75, 23);
			this->qGenerate->TabIndex = 42;
			this->qGenerate->Text = L"Построить";
			this->qGenerate->UseVisualStyleBackColor = true;
			this->qGenerate->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(733, 653);
			this->button2->Name = L"button2";
			this->button2->Size = System::Drawing::Size(75, 23);
			this->button2->TabIndex = 48;
			this->button2->Text = L"Найти";
			this->button2->UseVisualStyleBackColor = true;
			this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
			// 
			// qCoordinatesMap
			// 
			this->qCoordinatesMap->AutoSize = true;
			this->qCoordinatesMap->Location = System::Drawing::Point(237, 532);
			this->qCoordinatesMap->Name = L"qCoordinatesMap";
			this->qCoordinatesMap->Size = System::Drawing::Size(17, 13);
			this->qCoordinatesMap->TabIndex = 52;
			this->qCoordinatesMap->Text = L"//";
			// 
			// qClickN
			// 
			this->qClickN->Location = System::Drawing::Point(749, 603);
			this->qClickN->Name = L"qClickN";
			this->qClickN->Size = System::Drawing::Size(59, 20);
			this->qClickN->TabIndex = 61;
			this->qClickN->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::qInputValidationInteger);
			// 
			// label16
			// 
			this->label16->AutoSize = true;
			this->label16->Location = System::Drawing::Point(701, 606);
			this->label16->Name = L"label16";
			this->label16->Size = System::Drawing::Size(41, 13);
			this->label16->TabIndex = 62;
			this->label16->Text = L"Кол-во";
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->Location = System::Drawing::Point(701, 632);
			this->label2->Name = L"label2";
			this->label2->Size = System::Drawing::Size(15, 13);
			this->label2->TabIndex = 63;
			this->label2->Text = L"N";
			// 
			// qClick
			// 
			this->qClick->AutoSize = true;
			this->qClick->Location = System::Drawing::Point(748, 632);
			this->qClick->Name = L"qClick";
			this->qClick->Size = System::Drawing::Size(17, 13);
			this->qClick->TabIndex = 64;
			this->qClick->Text = L"//";
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(820, 700);
			this->Controls->Add(this->qClick);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->label16);
			this->Controls->Add(this->qClickN);
			this->Controls->Add(this->qCoordinatesMap);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->groupBox5);
			this->Controls->Add(this->groupBox4);
			this->Controls->Add(this->groupBox3);
			this->Controls->Add(this->groupBox1);
			this->Controls->Add(this->panel1);
			this->Controls->Add(this->qGenerate);
			this->Controls->Add(this->groupBox2);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->MenuStrip1);
			this->MainMenuStrip = this->MenuStrip1;
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::Form1_Paint);
			this->MenuStrip1->ResumeLayout(false);
			this->MenuStrip1->PerformLayout();
			this->groupBox2->ResumeLayout(false);
			this->groupBox2->PerformLayout();
			this->groupBox5->ResumeLayout(false);
			this->groupBox5->PerformLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qBrushSize))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qLevelUpland))->EndInit();
			this->groupBox4->ResumeLayout(false);
			this->groupBox4->PerformLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qkH))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qkW))->EndInit();
			this->groupBox3->ResumeLayout(false);
			this->groupBox3->PerformLayout();
			this->groupBox1->ResumeLayout(false);
			this->groupBox1->PerformLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qBloodB))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qFelledTreesB))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qLvlСhangeB))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qTreeB))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qWidePassB))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->qIncLvlB))->EndInit();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	private: int vW;
	private: int vH;
	private: int vnR;
	private: int vkW;
	private: int vkH;
	private: int vWm;
	private: int vHm;
	private: int vRects;
	private: int vCheckF1;
	private: int vCheckF2;
	private: int vCheckF3;
	private: System::Drawing::Font ^vFont1;
	private: String^ vFile1;
    private: String^ vFile2;
    private: String^ vStartupPath;
	private: bool vPressingMouse;
	private: array <System::Drawing::Point^> ^vPointMouse;

//
	private: System::Void aboutToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
				 // Спаравка -> О программе
				 AboutDlg^ vAboutDlg;
			 	 vAboutDlg = gcnew AboutDlg();
			 	 vAboutDlg->ShowDialog();
			 }
// Нажать кнопку 1 "Построить" (сгенерировать карту)
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
////////////////////////////////////////////////////////////////
//Generator of map
Generate++;
qClick->Text = Convert::ToString(Generate);
vGenerate = Generate;
fCreateMap();
fCreateWorldMap(vkW,vkH);
fRefreshListIdOfRegions(-1);

fRefreshRect();
////////////////////////////////////////////////////////////////
			 }
// Загрузка формы
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
			 char *pFullPath;

			 vW = 128;
			 vH = 128;
			 vkW = 4;
			 vkH = 4;
			 fLoadingData1();
			 Generate = 0;
			 vCheckF1 = 0;
			 vCheckF2 = 0;
			 vRects = 1;
			 vFont1 = gcnew System::Drawing::Font(L"Arial",14);
			 vFile1 = "";
			 vFile2 = "";
			 vStartupPath = System::Windows::Forms::Application::StartupPath;
			 vPressingMouse = false;
			 vPointMouse = gcnew array <System::Drawing::Point^> (6);
			 vPointMouse[0] = gcnew System::Drawing::Point;
			 vPointMouse[1] = gcnew System::Drawing::Point;
			 vPointMouse[2] = gcnew System::Drawing::Point;
			 vPointMouse[3] = gcnew System::Drawing::Point;
			 vPointMouse[4] = gcnew System::Drawing::Point;
			 vPointMouse[5] = gcnew System::Drawing::Point;
			 qTerrainType->SelectedIndex = 1;
			 qObjectNum->SelectedIndex = 0;
			 qSelectM->SelectedIndex = 0;
			 fCreateNewMap();
			 //fLoadFile1(0);
			 /*fLoadFileArchive("Maps\\SlayerPlace.w3x",1);
			 fLoadFileArchive("Maps\\DancePool.w3x",2);
			 fLoadFileArchive("Maps\\BaseVampire.w3x",3);
			 fLoadFileArchive("Maps\\VampirismFire5.10b2.w3x",0);*/
			 vFile2 = vStartupPath + "\\Maps\\SlayerPlace.w3x";
			 fSysStringToChar(vFile2,pFullPath);
			 fLoadFileArchive(pFullPath,1);
			 vFile2 = vStartupPath + "\\Maps\\DancePool.w3x";
			 fSysStringToChar(vFile2,pFullPath);
			 fLoadFileArchive(pFullPath,2);
			 vFile2 = vStartupPath + "\\Maps\\BaseVampire.w3x";
			 fSysStringToChar(vFile2,pFullPath);
			 fLoadFileArchive(pFullPath,3);
			 vFile2 = vStartupPath + "\\Maps\\VampirismFire5.10b2.w3x";
			 fSysStringToChar(vFile2,pFullPath);
			 fLoadFileArchive(pFullPath,0);
			 //fLoadDefaultMap();
		 }
/////////////////////////////////////////////////////////////////////////
// Кнопка 2 "Найти" (тупая кнопка)
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 String ^vStr;
			 String ^vDir;
			 String ^vFileName;
			 int vStrLen;
			 int vStrLen2;
			 char *pFullPath;
			 int vClickN;
			 RECT AllocationArea;

			 pFullPath = NULL;
			 
			 SaveFileDialog1->FileName = "*.w3x";
			 SaveFileDialog1->Filter = "Сценарий Warcraft 3 (*w3m, *.w3x)|*.w3m;*.w3x";
			 //SaveFileDialog1->InitialDirectory = System::Windows::Forms::Application::StartupPath;
			 if (SaveFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
			 {
				 vStrLen = SaveFileDialog1->FileName->Length;
				 vDir = "";
				 for(int vvi=0;vvi<vStrLen-1;vvi++)
				 {
					 vStr = SaveFileDialog1->FileName->Substring(vStrLen-vvi-1,1);
					 if (vStr == "\\")
					 {
						 vDir = SaveFileDialog1->FileName->Substring(0,vStrLen-vvi);
						 vFileName = SaveFileDialog1->FileName->Substring(vStrLen-vvi,vvi);
						 break;
					 }
				 }
				 
				 if (!System::IO::Directory::Exists(vDir))
				 {
					 MessageBox::Show("Путь указан не правильно!");
					 return;
				 }
				 
				 if (vFileName == "")
					 return;
			 }

			 vStrLen2 = vFileName->Length;

			 if (vStrLen2 > 4)
			 {
				 vStr = vFileName->Substring(vStrLen2-4,4);
				 if (vStr != ".w3x" || vStr != ".w3m")
					 vFileName = vFileName->Substring(0,vStrLen2-4);
			 }

			 vClickN = 0;
			 if (qClickN->Text != "")
			 {
				 if (fCheckInteger2(qClickN->Text))
					 vClickN = Convert::ToInt32(qClickN->Text);
			 }
			 if (vClickN > 0)
			 {
				 Generate = 0;
				 for (int vvi=0;vvi<vClickN;vvi++)
				 {
					 this->Refresh();
					 button1_Click(sender,e);

					 AllocationArea.left = 0;
					 AllocationArea.top = 0;
					 AllocationArea.right = vW;
					 AllocationArea.bottom = vH;
					 fSaveMapEditor(0,AllocationArea);

					 qClick->Text = Convert::ToString(vvi);
					 qClick->Refresh();
					 
					 vFile2 = vDir + vFileName + "[" + Convert::ToString(vvi) + "]" + ".w3x";
					 
					 fSysStringToChar(vFile2,pFullPath);
					 fSaveFileArchive(pFullPath);
				 }
			 }
		 }
/////////////////////////////////////////////////////////////////////////
// Проверка целого числа
private: System::Void qInputValidationInteger(System::Object^  sender, System::Windows::Forms::KeyPressEventArgs^  e) {
			 //
			 MaskedTextBox ^vMaskedTextBox;
			 Type ^vType;
			 String ^vText;
			 int vIndex;
			 int vSelectionStart;
			 int vSelectionLength;
			 int vStrLen;
			 
			 if ((e->KeyChar < 48 || e->KeyChar > 57) && e->KeyChar != '\b'
				 && e->KeyChar != '-')
				 e->Handled = true;

			 vType = sender->GetType();
			 if (vType->FullName == "System.Windows.Forms.MaskedTextBox")
			 {
				 vMaskedTextBox = (MaskedTextBox ^)sender;
				 vText = vMaskedTextBox->Text;
				 vStrLen = vText->Length;
				 vIndex = vText->IndexOf('-');
				 vSelectionStart = vMaskedTextBox->SelectionStart;
				 vSelectionLength = vMaskedTextBox->SelectionLength;
				 if ((e->KeyChar == '-' && vSelectionStart != 0) ||
					 (vSelectionStart <= vIndex &&
					 vSelectionStart + vSelectionLength <= vIndex) ||
					 (vIndex >= 0 && vSelectionStart == 1 && e->KeyChar == '0') ||
					 (vSelectionStart == 0 && vStrLen > 1 && e->KeyChar == '0'))
				 {
					 e->Handled = true;
				 }
				 if (vStrLen > 8)
				 {
					 if (e->KeyChar >= 48 && e->KeyChar <= 57 && vSelectionLength == 0)
					 {
						 e->Handled = true;
					 }
				 }
			 }
		 }
// Кликнуть на карту лабиринта
private: System::Void qMaze_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 qMaze->Checked = true;
			 qStepFloor->Checked = false;
			 qLandscape->Checked = false;
			 qObjects->Checked = false;
			 qRegions->Checked = false;
			 vCheckF1 = 0;
			 fUpdateValuesRect();
			 fRefreshRect();
		 }
// Кликнуть на карту уровней возвышенности
private: System::Void qStepFloor_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 qMaze->Checked = false;
			 qStepFloor->Checked = true;
			 qLandscape->Checked = false;
			 qObjects->Checked = false;
			 qRegions->Checked = false;
			 vCheckF1 = 1;
			 fUpdateValuesRect();
			 fMode(1);
			 fRefreshRect();
		 }
// Кликнуть на карту ландшафта
private: System::Void qLandscape_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 qMaze->Checked = false;
			 qStepFloor->Checked = false;
			 qLandscape->Checked = true;
			 qObjects->Checked = false;
			 qRegions->Checked = false;
			 vCheckF1 = 2;
			 fUpdateValuesRect();
			 fMode(2);
			 fRefreshRect();
		 }
// Кликнуть на карту объектов декораций
private: System::Void qObjects_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 qMaze->Checked = false;
			 qStepFloor->Checked = false;
			 qLandscape->Checked = false;
			 qObjects->Checked = true;
			 qRegions->Checked = false;
			 vCheckF1 = 3;
			 fUpdateValuesRect();
			 fMode(3);
			 fRefreshRect();
		 }
// Кликнуть на карту регионов
private: System::Void qRegions_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 if (qRegions->Checked == true)
				 vCheckF3 = 1;
			 else
				 vCheckF3 = 0;
			 fUpdateValuesRect();
			 fRefreshRect();
		 }
// Кнопка в меню "Save as..." (cохранить конфигурационный файл выбрав путь к файлу)
private: System::Void saveAsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 String ^vStr;
			 String ^vDir;
			 String ^vFileName;
			 int vStrLen;

			 SaveFileDialog1->FileName = "*.txt";
			 SaveFileDialog1->Filter = "txt files (*.txt)|*.txt";
			 SaveFileDialog1->InitialDirectory = System::Windows::Forms::Application::StartupPath;
			 if (SaveFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
			 {
				 vStrLen = SaveFileDialog1->FileName->Length;
				 vDir = "";
				 for(int vvi=0;vvi<vStrLen-1;vvi++)
				 {
					 vStr = SaveFileDialog1->FileName->Substring(vStrLen-vvi-1,1);
					 if (vStr == "\\")
					 {
						 vDir = SaveFileDialog1->FileName->Substring(0,vStrLen-vvi);
						 vFileName = SaveFileDialog1->FileName->Substring(vStrLen-vvi,vvi);
						 break;
					 }
				 }
				 
				 if (!System::IO::Directory::Exists(vDir))
				 {
					 MessageBox::Show("Путь указан не правильно!");
					 return;
				 }
				 vStr = vFileName->Substring(vFileName->Length-4,4);
				 if (vStr != ".txt") SaveFileDialog1->FileName += ".txt";
				 vFile1 = SaveFileDialog1->FileName;
				 fSaveFile1();
			 }
		 }
// Кнопка в меню "Open" (открыть файл)
private: System::Void openToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 int vFlag;

			 OpenFileDialog1->FileName = "*.txt";
			 OpenFileDialog1->Filter = "txt files (*.txt)|*.txt";
m1:;
			 vFlag = 0;
			 if (OpenFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
			 {
				 if (!System::IO::File::Exists(OpenFileDialog1->FileName))
				 {
					 MessageBox::Show("Выберите файл!");
					 vFlag = 1;
				 }
			 }
			 else
				 return;
			 if (vFlag == 1) goto m1;

			 vFile1 = OpenFileDialog1->FileName;
			 fLoadFile1(1);
		 }
// Кнопка в меню "Save" (сохранить файл)
private: System::Void saveToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 fSaveFile1();
		 }
// Создать новую базу
private: System::Void qCreateB_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 Base1 vBase;
			 if(fCollectDataOfBase(vBase) == 0)
				 return;
			 fAddBase(vBase);
			 fRefreshListIdOfBases(vBase.Id);
		 }
// Забираем данные базы
private: System::Int32 fCollectDataOfBase(Base1 &_Base) {
			 Base1 vBase;
			 int vIndex;
			 int vInt1;
			 int vFlag;
			 double vD;
			 vIndex = 0;
			 vFlag = 0;
			 if (qOpenB->Text == "" ||
				 qLeftB->Text == "" || qUpB->Text == "" ||
				 qRightB->Text == "" || qDownB->Text == "" ||
				 qSizeB->Text == "" || qAllowanceB->Text == "" ||
				 qTypeB->Text == "" || qPosDistrB->Text == "" ||
				 qXB->Text == "" || qYB->Text == "" ||
				 qTreeB->Text == "" || qFelledTreesB->Text == "" ||
				 qLvlСhangeB->Text == "" || qIncLvlB->Text == "" ||
				 qWidePassB->Text == "" || qBloodB->Text == "")
			 {
				 MessageBox::Show("Отсутствуют некоторые данные!");
				 return 0;
			 }
			 vBase.Open = Convert::ToBoolean(qOpenB->Text);
			 vBase.Type = Convert::ToInt32(qTypeB->Text);
			 vInt1 = Convert::ToInt32(qLeftB->Text);
			 if (vInt1 < 0 || vInt1 >= vWm)
			 {
				 vFlag = 1;
				 MessageBox::Show("Left >= 0 && Left < Wm");
			 }
			 vBase.Location.left = vInt1;
			 vInt1 = Convert::ToInt32(qUpB->Text);
			 if (vInt1 < 0 || vInt1 >= vHm)
			 {
				 vFlag = 1;
				 MessageBox::Show("Up >= 0 && Up < Hm");
			 }
			 vBase.Location.top = vInt1;
			 vInt1 = Convert::ToInt32(qRightB->Text);
			 if (vInt1 < 0 || vInt1 >= vWm)
			 {
				 vFlag = 1;
				 MessageBox::Show("Right >= 0 && Right < Wm");
			 }
			 vBase.Location.right = vInt1;
			 vInt1 = Convert::ToInt32(qDownB->Text);
			 if (vInt1 < 0 || vInt1 >= vHm)
			 {
				 vFlag = 1;
				 MessageBox::Show("Down >= 0 && Down < Hm");
			 }
			 vBase.Location.bottom = vInt1;
			 vInt1 = Convert::ToInt32(qSizeB->Text);
			 if (vInt1 <= 0 || vInt1 > vWm*vHm)
			 {
				 vFlag = 1;
				 MessageBox::Show("Size > 0 && Size <= Wm*Hm");
			 }
			 vBase.Size = vInt1;
			 vInt1 = Convert::ToInt32(qAllowanceB->Text);
			 if (vInt1 < 0 || vInt1 > vWm*vHm)
			 {
				 vFlag = 1;
				 MessageBox::Show("Allowance >= 0 && Allowance <= Wm*Hm");
			 }
			 vBase.Allowance = vInt1;
			 vIndex = qPosDistrB->SelectedIndex;
			 if (vIndex == 0) vBase.PosDistr = 0;
			 if (vIndex > 0 && vIndex <= 8)
				 vBase.PosDistr = (int)pow(2,(double)(vIndex-1));
			 vInt1 = Convert::ToInt32(qXB->Text);
			 if (vInt1 < 0 || vInt1 >= vWm)
			 {
				 vFlag = 1;
				 MessageBox::Show("x >= 0 && x < Wm");
			 }
			 vBase._c2 = vInt1;
			 vInt1 = Convert::ToInt32(qYB->Text);
			 if (vInt1 < 0 || vInt1 >= vHm)
			 {
				 vFlag = 1;
				 MessageBox::Show("y >= 0 && y < Hm");
			 }
			 vBase._v2 = vInt1;
			 vD = Convert::ToDouble(qTreeB->Text);
			 if (vD < 0 || vD > 1)
			 {
				 vFlag = 1;
				 MessageBox::Show("Tree >= 0 && Tree <= 1");
			 }
			 vBase.Tree = vD;
			 vD = Convert::ToDouble(qFelledTreesB->Text);
			 if (vD < 0 || vD > 1)
			 {
				 vFlag = 1;
				 MessageBox::Show("FelledTrees >= 0 && FelledTrees <= 1");
			 }
			 vBase.FelledTrees = vD;
			 vD = Convert::ToDouble(qLvlСhangeB->Text);
			 if (vD < 0 || vD > 1)
			 {
				 vFlag = 1;
				 MessageBox::Show("LvlСhange >= 0 && LvlСhange <= 1");
			 }
			 vBase.LvlСhange = vD;
			 vD = Convert::ToDouble(qIncLvlB->Text);
			 if (vD < 0 || vD > 1)
			 {
				 vFlag = 1;
				 MessageBox::Show("IncLvl >= 0 && IncLvl <= 1");
			 }
			 vBase.IncLvl = vD;
			 vD = Convert::ToDouble(qWidePassB->Text);
			 if (vD < 0 || vD > 1)
			 {
				 vFlag = 1;
				 MessageBox::Show("WidePass >= 0 && WidePass <= 1");
			 }
			 vBase.WidePass = vD;
			 vD = Convert::ToDouble(qBloodB->Text);
			 if (vD < 0 || vD > 1)
			 {
				 vFlag = 1;
				 MessageBox::Show("Blood >= 0 && Blood <= 1");
			 }
			 vBase.Blood = vD;
			 if (vBase.Location.left > vBase.Location.right)
			 {
				 vFlag = 1;
				 MessageBox::Show("Left <= Right");
			 }
			 if (vBase.Location.top > vBase.Location.bottom)
			 {
				 vFlag = 1;
				 MessageBox::Show("Up <= Down");
			 }
			 if (vFlag == 1)
			 {
				 MessageBox::Show("Данные введены не верно!");
				 return 0;
			 }
			 _Base = vBase;
			 return 1;
		 }
// Применить изменения базы
private: System::Void qApplyB_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 Base1 vBase;
			 int vId;
			 if (qIdB->Text == "")
			 {
				 MessageBox::Show("Выберите идентификационный номер базы!");
				 return;
			 }
			 vId = Convert::ToInt32(qIdB->Text);
			 if(vId < 0)
				 return;
			 if(fCollectDataOfBase(vBase) == 0)
				 return;
			 vBase.Id = vId;
			 fEditBase(vBase);
		 }
// Обновить лист ID баз (индентификационных номеров)
private: System::Void fRefreshListIdOfBases(int _SelectId) {
			 //
			 int *pListId;
			 int vN;
			 int vPreviousIndex;
			 int vCount;
			 String ^vString;
			 vPreviousIndex = qIdB->SelectedIndex;
			 pListId = new int[100];
			 fGetListIdOfBases(pListId,vN);
			 qIdB->Items->Clear();
			 for (int vvi=0;vvi<vN;vvi++)
			 {
				 vString = Convert::ToString(pListId[vvi]);
				 qIdB->Items->Add(vString);
				 if (pListId[vvi] == _SelectId)
					 qIdB->SelectedIndex = vvi;
			 }
			 vCount = qIdB->Items->Count;
			 if (_SelectId == -1 && vCount > 0)
			 {
				 if(vCount > vPreviousIndex)
					 qIdB->SelectedIndex = vPreviousIndex;
				 else
					 qIdB->SelectedIndex = vCount-1;
			 }
			 if (vCount == 0)
			 {
				 qIdB->Text = "";
				 qOpenB->Text = "";
				 qTypeB->Text = "";
				 qLeftB->Text = "";
				 qUpB->Text = "";
				 qRightB->Text = "";
				 qDownB->Text = "";
				 qSizeB->Text = "";
				 qAllowanceB->Text = "";
				 qXB->Text = "";
				 qYB->Text = "";
				 qTreeB->Text = "";
				 qFelledTreesB->Text = "";
				 qLvlСhangeB->Text = "";
				 qIncLvlB->Text = "";
				 qWidePassB->Text = "";
				 qBloodB->Text = "";
			 }
			 if (pListId)
				 delete pListId;
		 }
// Удалить базу
private: System::Void qDeleteB_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 int vId;
			 if (qIdB->Text == "")
				 return;
			 vId = Convert::ToInt32(qIdB->Text);
			 fDelBase(vId);
			 fRefreshListIdOfBases(-1);
			 fTakeData();
		 }
// Взять данные базы
private: System::Void fTakeData () {
			 // Нужно забрать данные из массива
			 Base1 vBase;
			 int vId;
			 if (qIdB->Text == "")
				 return;
			 vId = Convert::ToInt32(qIdB->Text);
			 fGetBase(vBase,vId);
			 if (vBase.Id < 0)
				 return;
			 fFillDataOfBases(vBase);
			 fUpdateValuesRect();
			 fRefreshRect();
		 }
// Скинуть данные базы
private: System::Int32 fFillDataOfBases (Base1 _Base) {
			 //
			 if (_Base.Open == true)
				 qOpenB->SelectedIndex = 0;
			 else
				 qOpenB->SelectedIndex = 1;
			 qTypeB->Text = Convert::ToString(_Base.Type);
			 qLeftB->Text = Convert::ToString(_Base.Location.left);
			 qUpB->Text = Convert::ToString(_Base.Location.top);
			 qRightB->Text = Convert::ToString(_Base.Location.right);
			 qDownB->Text = Convert::ToString(_Base.Location.bottom);
			 qSizeB->Text = Convert::ToString(_Base.Size);
			 qAllowanceB->Text = Convert::ToString(_Base.Allowance);
			 if (_Base.PosDistr == 0) qPosDistrB->SelectedIndex = 0;
			 for (int vvi=0;vvi<8;vvi++)
			 {
				 if ((int)pow(2,(double)vvi) == _Base.PosDistr)
					 qPosDistrB->SelectedIndex = vvi+1;
			 }
			 qXB->Text = Convert::ToString(_Base._c2);
			 qYB->Text = Convert::ToString(_Base._v2);
			 qTreeB->Text = Convert::ToString(_Base.Tree);
			 qFelledTreesB->Text = Convert::ToString(_Base.FelledTrees);
			 qLvlСhangeB->Text = Convert::ToString(_Base.LvlСhange);
			 qIncLvlB->Text = Convert::ToString(_Base.IncLvl);
			 qWidePassB->Text = Convert::ToString(_Base.WidePass);
			 qBloodB->Text = Convert::ToString(_Base.Blood);
			 return 1;
		 }
// Сохранить конфигурационный файл
private: System::Void fSaveFile1 () {
			 System::IO::StreamWriter^ vStreamWriter;
			 int vCount;
			 String ^vStr;
			 String ^vStr2;
			 array <String ^> ^vCap;
			 Base1 vBase;
			 int *pListId;
			 int _N;
			 int vMaxCount;

			 vMaxCount = 18;

			 vCap = gcnew array<String ^> (vMaxCount);// {"test1","test2","test3"};

			 if (vFile1 == "")
				 return;

			 vStreamWriter = gcnew System::IO::StreamWriter(vFile1);
			 
			 vStr = "[SETTING_MAP]";
			 vStreamWriter->WriteLine(vStr);

			 vStr = "Wm = " + Convert::ToString(vWm);
			 vStreamWriter->WriteLine(vStr);

			 vStr = "Hm = " + Convert::ToString(vHm);
			 vStreamWriter->WriteLine(vStr);

			 vStr = "kW = " + Convert::ToString(vkW);
			 vStreamWriter->WriteLine(vStr);

			 vStr = "kH = " + Convert::ToString(vkH);
			 vStreamWriter->WriteLine(vStr);

			 // данные
			 vCap[0] = "ID        ";	// идентификационный номер
			 vCap[1] = "Open      ";	// открытая или закрытая база
			 vCap[2] = "Type      ";	// тип базы
			 vCap[3] = "Left      ";	// размещение
			 vCap[4] = "Up        ";	//
			 vCap[5] = "Right     ";	//
			 vCap[6] = "Down      ";	//
			 vCap[7] = "Size      ";	// размер
			 vCap[8] = "Allowance ";	// припуск
			 vCap[9] = "PosDistr  ";	// позиция распростронения
			 vCap[10] = "x        ";	// клетка пути
			 vCap[11] = "y        ";	//
			 vCap[12] = "Tree     ";	// деревья
			 vCap[13] = "FelledT  ";	// срубленные деревья
			 vCap[14] = "LvlСhange";	// изменение уровня
			 vCap[15] = "IncLvl   ";	// повышение уровня
			 vCap[16] = "WidePass ";	// широкий проход
			 vCap[17] = "Blood    ";	// кровь
			 
			 vStr = "[CAP]";
			 vStreamWriter->WriteLine(vStr);

			 vStr = "";
			 for (int vvi=0;vvi<vMaxCount;vvi++)
			 {
				 vStr += vCap[vvi];
			 }
			 vStreamWriter->WriteLine(vStr);	// записываем(добавляем) строку в файл

			 vStr = "[DATA]";
			 vStreamWriter->WriteLine(vStr);

			 pListId = new int[100];
			 fGetListIdOfBases(pListId,_N);
			 for (int vvn=0;vvn<_N;vvn++)
			 {
				 vStr = "";
				 fGetBase(vBase,pListId[vvn]);
				 for (int vvi=0;vvi<vMaxCount;vvi++)
				 {
					 vStr2 = "";
					 if (vvi == 0) vStr2 = Convert::ToString(vBase.Id);
					 if (vvi == 1) vStr2 = Convert::ToString(vBase.Open);
					 if (vvi == 2) vStr2 = Convert::ToString(vBase.Type);
					 if (vvi == 3) vStr2 = Convert::ToString(vBase.Location.left);
					 if (vvi == 4) vStr2 = Convert::ToString(vBase.Location.top);
					 if (vvi == 5) vStr2 = Convert::ToString(vBase.Location.right);
					 if (vvi == 6) vStr2 = Convert::ToString(vBase.Location.bottom);
					 if (vvi == 7) vStr2 = Convert::ToString(vBase.Size);
					 if (vvi == 8) vStr2 = Convert::ToString(vBase.Allowance);
					 if (vvi == 9) vStr2 = Convert::ToString(vBase.PosDistr);
					 if (vvi == 10) vStr2 = Convert::ToString(vBase._c2);
					 if (vvi == 11) vStr2 = Convert::ToString(vBase._v2);
					 if (vvi == 12) vStr2 = Convert::ToString(vBase.Tree);
					 if (vvi == 13) vStr2 = Convert::ToString(vBase.FelledTrees);
					 if (vvi == 14) vStr2 = Convert::ToString(vBase.LvlСhange);
					 if (vvi == 15) vStr2 = Convert::ToString(vBase.IncLvl);
					 if (vvi == 16) vStr2 = Convert::ToString(vBase.WidePass);
					 if (vvi == 17) vStr2 = Convert::ToString(vBase.Blood);
					 if (vBase.Id >= 0)
					 {
						 for (int vvj=vStr2->Length;vvj<vCap[vvi]->Length;vvj++)
						 {
							 vStr2 += Char(0x20);
						 }
						 vStr += vStr2;
					 }
				 }
				 vStreamWriter->WriteLine(vStr);
			 }

			 vStreamWriter->Close();
			 if (pListId)
				 delete pListId;
		 }
// Загрузить конфигурационный файл
private: System::Void fLoadFile1 (int FunctionNumber) {
			 //
			 int vFlag;
			 int vFlag2;
			 char *pFullPath;
			 BYTE *pMassByte;
			 int vSizeArray;
			 int _N;
			 int _Wm;
			 int _Hm;
			 int _kW;
			 int _kH;

			 char *pStr;
			 int vLen;
			 char *pch1;
			 char *pch2;

			 int vNum;
			 int vNum2;

			 Base1 vBase;
			 int *pListId;

			 vFlag = 0;
			 pMassByte = NULL;
			 switch (FunctionNumber)
			 {
				case 0:
					if (!fOpenFileRes (IDR_TXT1,L"TXT",pMassByte,vSizeArray))
						vFlag = 1;
					break;
				case 1:
					pFullPath = NULL;
					fSysStringToChar(vFile1,pFullPath);
					if (!fOpenFile(pFullPath,pMassByte,vSizeArray))
						vFlag = 1;
					break;
				default:
					vFlag = 1;

			 }
			 if (vFlag == 1)
			 {
				 MessageBox::Show("Файл не найден!");
				 return;
			 }

			 fResetCarriageReturn(pMassByte,vSizeArray);

			 _N = 0;

			 fGetListIdOfBases(pListId,_N);
			 for (int vvi=0;vvi<_N;vvi++)
			 {
				 fDelBase(pListId[vvi]);
			 }

			 vNum = 0;
			 vNum2 = 0;
			 vFlag = 0;
			 vFlag2 = 0;

			 pch1 = (char*)pMassByte;
			 pch2 = (char*)pMassByte + vSizeArray;
			 do
			 {
				 pStr = pch1;
				 vLen = strlen(pStr);
				 pch1 += vLen;
				 if (pch1 >= pch2) break;
				 vNum++;
				 //
				 if (strcmp(pStr,"[SETTING_MAP]") == 0 && vFlag2 == 0)
				 {
					 vFlag2 = 1;
					 vNum2 = vNum;
				 }
				 if (strcmp(pStr,"[DATA]") == 0 && vFlag2 == 1)
				 {
					 vFlag2 = 2;
					 vNum2 = vNum;
				 }
				 if (vFlag2 == 1 && vNum > vNum2 && vLen != 0)
				 {
					 vFlag = 1;
					 if (memcmp(pStr,"Wm = ",5) == 0 &&
						 vLen > 5)
					 {
						 pStr += 5;
						 if(fCheckInteger(pStr) == 1)
						 {
							 _Wm = atoi(pStr);
						 }
						 else
						 {
							 vFlag = 2;
							 break;
						 }
					 }
					 if (memcmp(pStr,"Hm = ",5) == 0 &&
						 vLen > 5)
					 {
						 pStr += 5;
						 if(fCheckInteger(pStr) == 1)
						 {
							 _Hm = atoi(pStr);
						 }
						 else
						 {
							 vFlag = 2;
							 break;
						 }
					 }
					 if (memcmp(pStr,"kW = ",5) == 0 &&
						 vLen > 5)
					 {
						 pStr += 5;
						 if(fCheckInteger(pStr) == 1)
						 {
							 _kW = atoi(pStr);
						 }
						 else
						 {
							 vFlag = 2;
							 break;
						 }
					 }
					 if (memcmp(pStr,"kH = ",5) == 0 &&
						 vLen > 5)
					 {
						 pStr += 5;
						 if(fCheckInteger(pStr) == 1)
						 {
							 _kH = atoi(pStr);
						 }
						 else
						 {
							 vFlag = 2;
							 break;
						 }
					 }
				 }
				 //
				 if (vFlag2 == 2 && vNum > vNum2 && *pStr != ';' && vLen != 0)
				 {
					 if(fReadDataOfBase(pStr,vBase) == 1)
						 fReplaceBase(vBase);
				 }
				 //
				 while(*pch1 == NULL && pch1 < pch2)
					 pch1++;
				 //
			}
			while(pch1 < pch2);
			
			if (vFlag2 != 2 || vFlag == 0)
			{
				MessageBox::Show("Ошибка в файле!");
				return;
			}

			if (_Wm > 0 && _Hm > 0 && _kW >= 4 && _kH >= 4)
			{
				vW = _Wm * vkW;
				vH = _Hm * vkH;
				vkW = _kW;
				vkH = _kH;
				fCreateNewMap();
			}

			fRefreshListIdOfBases(-1);
			fUpdateValuesRect();
			fOnInitialUpdate();
			fRefreshRect();
		 }
// Кнопка в меню "Выход"
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 exit(0); //cout<<"Привет мир";
		 }
private: System::Void qIdB_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			 fTakeData();
		 }
private: System::Void panel1_MouseDown(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
			 //
			 fMouseDown(sender,e);
		 }
private: System::Void panel1_MouseUp(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
			 //
			 fMouseUp(sender,e);
		 }
private: System::Void panel1_MouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
			 //
			 fMouseMove(sender,e);
		 }
// Рисуем прямоугольник
private: System::Void fDrawRect (System::Drawing::Graphics ^vGraphics,
			 int _x1, int _y1, int _x2, int _y2, System::Drawing::Color _Color) {
			 //
			 System::Drawing::Pen ^vPen;
			 System::Drawing::PointF vP1;
			 System::Drawing::PointF vP2;
			 System::Drawing::PointF vP3;
			 System::Drawing::PointF vP4;

			 vPen = gcnew System::Drawing::Pen(_Color);
			 vPen->DashStyle = System::Drawing::Drawing2D::DashStyle::Solid;
			 
			 vP1.X = Convert::ToDouble(_x1);
			 vP1.Y = Convert::ToDouble(_y1);
			 vP2.X = Convert::ToDouble(_x2);
			 vP2.Y = Convert::ToDouble(_y1);
			 vP3.X = Convert::ToDouble(_x2);
			 vP3.Y = Convert::ToDouble(_y2);
			 vP4.X = Convert::ToDouble(_x1);
			 vP4.Y = Convert::ToDouble(_y2);

			 vGraphics->DrawLine(vPen, vP1, vP2);
			 vGraphics->DrawLine(vPen, vP2, vP3);
			 vGraphics->DrawLine(vPen, vP3, vP4);
			 vGraphics->DrawLine(vPen, vP4, vP1);
		 }
// Обновить область окна
private: System::Void Form1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
			 fRefreshRect();
		 }
// Обновить прямоугольник
private: System::Void fRefreshRect () {
			 HWND hWnd;
			 panel1->Refresh();

			 hWnd = (HWND)panel1->Handle.ToPointer();
			 fRefreshFieldDrawing(hWnd,vCheckF1,vCheckF3);//
			 fVisualRect(panel1);
			 //fVisualGrid(panel1);
		 }
// Отобразить рамки
private: System::Void fVisualRect (System::Object^  sender) {
			 System::Drawing::Graphics ^vGraphics;
			 Type ^vType;
			 Panel ^vPanel;

			 vType = sender->GetType();
			 if (vType->FullName == "System.Windows.Forms.Panel")
				 vPanel = (Panel ^)sender;
			 else
				 return;
			 
			 vGraphics = vPanel->CreateGraphics();

			 fDrawRect(vGraphics,vPointMouse[2]->X,vPointMouse[2]->Y,
				 vPointMouse[3]->X,vPointMouse[3]->Y,System::Drawing::Color::Yellow);
			 fDrawRect(vGraphics,vPointMouse[0]->X,vPointMouse[0]->Y,
				 vPointMouse[1]->X,vPointMouse[1]->Y,System::Drawing::Color::Red);
			 fDrawRect(vGraphics,vPointMouse[4]->X,vPointMouse[4]->Y,
				 vPointMouse[5]->X,vPointMouse[5]->Y,System::Drawing::Color::Blue);
		 }
// Отобразить сетку
private: System::Void fVisualGrid (System::Object^  sender) {
			 System::Drawing::Graphics ^vGraphics;
			 Type ^vType;
			 Panel ^vPanel;

			 int vX;
			 int vY;

			 RECT vRectClient;

			 int w1;
			 int h1;
			 int w2;
			 int h2;
			 int vWidth;
			 int vHeight;

			 int _Width;
			 int _Height;

			 System::Drawing::Color vColor;

			 vType = sender->GetType();
			 if (vType->FullName == "System.Windows.Forms.Panel")
				 vPanel = (Panel ^)sender;
			 else
				 return;

			 vGraphics = vPanel->CreateGraphics();

			 vRectClient.left = 0;
			 vRectClient.top = 0;
			 vRectClient.right = vPanel->Width;
			 vRectClient.bottom = vPanel->Height;
			 
			 h1 = (vRectClient.bottom - vRectClient.top) / (vHm+2);
			 vRectClient.top = vRectClient.top + h1;
			 vRectClient.bottom = vRectClient.bottom - h1;
			 w1 = (vRectClient.right - vRectClient.left) / (vWm+2);
			 vRectClient.left = vRectClient.left + w1;
			 vRectClient.right = vRectClient.right - w1;

			 if (vCheckF1 == 3)
			 {
				 vWidth = (vkW * vWm) + 1;
				 vHeight = (vkH * vHm) + 1;
				 w2 = (vRectClient.right - vRectClient.left) / vWidth;
				 h2 = (vRectClient.bottom - vRectClient.top) / vHeight;
				 w2 /= 2;
				 h2 /= 2;
				 if (w2 < 0 || h2 < 0)
					 return;
				 if (vCheckF1 == 3)
				 {
					 vRectClient.left += w2;
					 vRectClient.right += w2;
					 vRectClient.top += h2;
					 vRectClient.bottom += h2;
					 w1 += w2;
					 h1 += h2;
				 }
				 else
				 {
					 w2 *= 2;
					 h2 *= 2;
				 }
				 _Width = vW*2 * w2;
				 _Height = vH*2 * h2;
				 for (int vvi=0;vvi<=vW*2;vvi++)
				 {
					 vX = w1 + vvi * w2;
					 if (vvi == vW)
						 vColor = System::Drawing::Color::Red;
					 else
						 vColor = System::Drawing::Color::Black;
					 fDrawRect(vGraphics,vX,h1,vX,h1+_Height,vColor);
				 }
				 for (int vvi=0;vvi<=vH*2;vvi++)
				 {
					 vY = h1 + vvi * h2;
					 if (vvi == vH)
						 vColor = System::Drawing::Color::Red;
					 else
						 vColor = System::Drawing::Color::Black;
					 fDrawRect(vGraphics,w1,vY,w1+_Width,vY,vColor);
				 }
			 }

		 }
// Кнопка "Создать новую карту"
private: System::Void qCreateNewM_Click(System::Object^  sender, System::EventArgs^  e) {
			 int _W;
			 int _H;
			 int _kW;
			 int _kH;
			 String ^vStr;
			 vStr = qNewW->Text;
			 if (vStr->Length > 0)
			 if (fCheckInteger2(vStr) == 1)
				 _W = Convert::ToInt32(vStr);
			 if (_W <= 0)
			 {
				 MessageBox::Show("W > 0");
			 }
			 vStr = qNewH->Text;
			 if (vStr->Length > 0)
			 if (fCheckInteger2(vStr) == 1)
				 _H = Convert::ToInt32(vStr);
			 if (_H <= 0)
			 {
				 MessageBox::Show("H > 0");
			 }
			 vStr = qkW->Text;
			 if (vStr->Length > 0)
			 if (fCheckInteger2(vStr) == 1)
				 _kW = Convert::ToInt32(vStr);
			 if (_kW <= 0)
			 {
				 MessageBox::Show("kW >= 4");
			 }
			 vStr = qkH->Text;
			 if (vStr->Length > 0)
			 if (fCheckInteger2(vStr) == 1)
				 _kH = Convert::ToInt32(vStr);
			 if (_kH <= 0)
			 {
				 MessageBox::Show("kH >= 4");
			 }
			 if (_W > 0 && _H > 0 && _kW >= 4 && _kH >= 4)
			 {
				 vW = _W;
				 vH = _H;
				 vkW = _kW;
				 vkH = _kH;
				 fCreateNewMap();
			 }
			 fUpdateValuesRect();
			 fOnInitialUpdate();
			 fRefreshRect();
		 }
// Визуализация
private: System::Void qVisual(System::Object^  sender, System::Windows::Forms::KeyEventArgs^  e) {
			 //
			 fUpdateValuesRect();
			 fRefreshRect();
		 }
// Обновить рамки
private: System::Void fUpdateValuesRect () {
			 RECT vRectClient;
			 int vLeft;
			 int vUp;
			 int vRight;
			 int vDown;

			 int _w;
			 int _h;
			 int w1;
			 int h1;
			 int w2;
			 int h2;
			 int vWidth;
			 int vHeight;

			 if (!vPointMouse)
				 return;

			 vPointMouse[2]->X = 0;
			 vPointMouse[2]->Y = 0;
			 vPointMouse[3]->X = 0;
			 vPointMouse[3]->Y = 0;
			 vPointMouse[4]->X = 0;
			 vPointMouse[4]->Y = 0;
			 vPointMouse[5]->X = 0;
			 vPointMouse[5]->Y = 0;

			 vRectClient.left = 0;
			 vRectClient.top = 0;
			 vRectClient.right = panel1->Width;
			 vRectClient.bottom = panel1->Height;

			 h1 = (vRectClient.bottom - vRectClient.top) / (vHm+2);
			 vRectClient.top = vRectClient.top + h1;
			 vRectClient.bottom = vRectClient.bottom - h1;
			 w1 = (vRectClient.right - vRectClient.left) / (vWm+2);
			 vRectClient.left = vRectClient.left + w1;
			 vRectClient.right = vRectClient.right - w1;

			 if (vWm > 0 && vHm > 0)
			 {
				 if (vCheckF1 == 0)
				 {
					 vPointMouse[2]->X = w1;
					 vPointMouse[2]->Y = h1;
					 vPointMouse[3]->X = w1 * (vWm+1);
					 vPointMouse[3]->Y = h1 * (vHm+1);
				 }
			 }

			 vWidth = (vkW * vWm) + 1;
			 vHeight = (vkH * vHm) + 1;

			 if (vWidth <= (vW+1) || vHeight <= (vH+1))
			 {
				 if (vCheckF1 > 0)
				 {
					 _w = (vRectClient.right - vRectClient.left) / (vW+1);
					 _h = (vRectClient.bottom - vRectClient.top) / (vH+1);
					 _w /= 2;
					 _h /= 2;
					 if (_w < 0 || _h < 0)
						 return;
					 _w *= 2;
					 _h *= 2;

					 vRectClient.right = vRectClient.left + vWidth * _w;
					 vRectClient.bottom = vRectClient.top + vHeight * _h;

					 vPointMouse[2]->X = vRectClient.left;
					 vPointMouse[2]->Y = vRectClient.top;
					 vPointMouse[3]->X = vRectClient.right;
					 vPointMouse[3]->Y = vRectClient.bottom;
				 }
			 }

			 if (qLeftB->Text != "" &&
				 qUpB->Text != "" &&
				 qRightB->Text != "" &&
				 qDownB->Text != "")
			 {
				 vPointMouse[0]->X = 0;
				 vPointMouse[0]->Y = 0;
				 vPointMouse[1]->X = 0;
				 vPointMouse[1]->Y = 0;
				 if (fCheckInteger2(qLeftB->Text) == 1)
					 vLeft = Convert::ToInt32(qLeftB->Text);
				 if (fCheckInteger2(qUpB->Text) == 1)
					 vUp = Convert::ToInt32(qUpB->Text);
				 if (fCheckInteger2(qRightB->Text) == 1)
					 vRight = Convert::ToInt32(qRightB->Text);
				 if (fCheckInteger2(qDownB->Text) == 1)
					 vDown = Convert::ToInt32(qDownB->Text);

				 if (vLeft >= 0 && vLeft < vWm &&
					 vUp >= 0 && vUp < vHm &&
					 vRight >= 0 &&
					 vDown >= 0 &&
					 vLeft <= vRight &&
					 vUp <= vDown)
				 {
					 if (vCheckF1 == 0)
					 {
						 vPointMouse[0]->X = vRectClient.left + w1 * vLeft;
						 vPointMouse[0]->Y = vRectClient.top + h1 * vUp;
						 vPointMouse[1]->X = vRectClient.left + w1 * (vRight + 1);
						 vPointMouse[1]->Y = vRectClient.top + h1 * (vDown + 1);
					 }
					 else
					 {
						 w2 = (vRectClient.right - vRectClient.left) / vWidth;
						 h2 = (vRectClient.bottom - vRectClient.top) / vHeight;
						 w2 /= 2;
						 h2 /= 2;
						 if (w2 < 0 || h2 < 0)
							 return;
						 w2 *= 2;
						 h2 *= 2;

						 vRectClient.right = vRectClient.left + w2 * vWidth;
						 vRectClient.bottom = vRectClient.top + h2 * vHeight;

						 vPointMouse[0]->X = vRectClient.left + w2 * vLeft*vkW;
						 vPointMouse[0]->Y = vRectClient.top + h2 * vUp*vkH;
						 vPointMouse[1]->X = vRectClient.left + w2 * ((vRight + 1)*vkW+1);
						 vPointMouse[1]->Y = vRectClient.top + h2 * ((vDown + 1)*vkH+1);
					 }

					 for (int vvi=0;vvi<=1;vvi++)
					 {
						 if (vPointMouse[vvi]->X < vRectClient.left)
							 vPointMouse[vvi]->X = vRectClient.left;
						 if (vPointMouse[vvi]->Y < vRectClient.top)
							 vPointMouse[vvi]->Y = vRectClient.top;
						 if (vPointMouse[vvi]->X > vRectClient.right)
							 vPointMouse[vvi]->X = vRectClient.right;
						 if (vPointMouse[vvi]->Y > vRectClient.bottom)
							 vPointMouse[vvi]->Y = vRectClient.bottom;
					 }
				 }
			 }
			 if (qLeftR->Text != "" &&
				 qUpR->Text != "" &&
				 qRightR->Text != "" &&
				 qDownR->Text != "")
			 {
				 if (fCheckInteger2(qLeftR->Text) == 1)
					 vLeft = Convert::ToInt32(qLeftR->Text);
				 if (fCheckInteger2(qUpR->Text) == 1)
					 vUp = Convert::ToInt32(qUpR->Text);
				 if (fCheckInteger2(qRightR->Text) == 1)
					 vRight = Convert::ToInt32(qRightR->Text);
				 if (fCheckInteger2(qDownR->Text) == 1)
					 vDown = Convert::ToInt32(qDownR->Text);

				 if (vLeft >= 0 && vLeft < vW &&
					 vUp >= 0 && vUp < vH &&
					 vRight >= 0 &&
					 vDown >= 0 &&
					 vLeft <= vRight &&
					 vUp <= vDown)
				 {
					 if (vCheckF1 > 0)
					 {
						 w2 = (vRectClient.right - vRectClient.left) / vW;
						 h2 = (vRectClient.bottom - vRectClient.top) / vH;
						 w2 /= 2;
						 h2 /= 2;
						 if (w2 < 0 || h2 < 0)
							 return;
						 w2 *= 2;
						 h2 *= 2;

						 vRectClient.right = vRectClient.left + w2 * vW;
						 vRectClient.bottom = vRectClient.top + h2 * vH;

						 vPointMouse[4]->X = vRectClient.left + w2 * vLeft;
						 vPointMouse[4]->Y = vRectClient.top + h2 * vUp;
						 vPointMouse[5]->X = vRectClient.left + w2 * vRight;
						 vPointMouse[5]->Y = vRectClient.top + h2 * vDown;
					 }

					 for (int vvi=4;vvi<=5;vvi++)
					 {
						 if (vPointMouse[vvi]->X < vRectClient.left)
							 vPointMouse[vvi]->X = vRectClient.left;
						 if (vPointMouse[vvi]->Y < vRectClient.top)
							 vPointMouse[vvi]->Y = vRectClient.top;
						 if (vPointMouse[vvi]->X > vRectClient.right)
							 vPointMouse[vvi]->X = vRectClient.right;
						 if (vPointMouse[vvi]->Y > vRectClient.bottom)
							 vPointMouse[vvi]->Y = vRectClient.bottom;
					 }
				 }
			 }

			 
		 }
// Создать новую карту
private: System::Void fCreateNewMap () {
			 if (vW > 0 && vH > 0 && vkW >= 4 && vkH >= 4)
			 {
				 vWm = vW / vkW;
				 vHm = vH / vkH;
				 qWm->Text = Convert::ToString(vWm);
				 qHm->Text = Convert::ToString(vHm);
				 fMapInitialization(vWm,vHm);
				 // новая карта всегда с 1 регионом
				 vRects = 1;
				 qW->Text = Convert::ToString(vW);
				 qH->Text = Convert::ToString(vH);
				 fWorldMapInitialization(vW,vH,vRects,4);
			 }
		 }
// Читаем данные базы
private: System::Int32 fReadDataOfBase (char *_pStr, Base1 &_Base) {
			 //
			 char szBuffer[100];
			 Base1 vBase;
			 int vCount;
			 int vMaxCount;
			 char Sep;
			 int vLen;
			 char *chr;
			 char *pStr;

			 vMaxCount = 18;
			 Sep = '.';

			 pStr = _pStr;
			 chr=new char[]=_pStr;
			 vCount = 0;
			 for(int vvi=0;chr[vvi]!='\0';vvi++)
			 {
				 if (chr[vvi] == 0x20)
				 {
					 vLen = &chr[vvi]-pStr;
					 if(vLen > 0)
					 {
						 memcpy(szBuffer,pStr,vLen);
						 szBuffer[vLen] = NULL;
						 for (int vvj=0;vvj<vLen;vvj++)
						 {
							 if(szBuffer[vvj] == ',')
								 szBuffer[vvj] = '.';
						 }
						 pStr = szBuffer;
						 switch (vCount)
						 {
							case 0:
								vBase.Id = -1;
								if(fCheckInteger(pStr) == 1)
									vBase.Id = atoi(pStr);
								break;
							case 1:
								if(strcmp(pStr,"True") == 0) vBase.Open = true;
								if(strcmp(pStr,"False") == 0) vBase.Open = false;
								break;
							case 2:
								vBase.Type = 0;
								if(fCheckInteger(pStr) == 1)
									vBase.Type = atoi(pStr);
								break;
							case 3:
								vBase.Location.left = 0;
								if(fCheckInteger(pStr) == 1)
									vBase.Location.left = atoi(pStr);
								break;
							case 4:
								vBase.Location.top = 0;
								if(fCheckInteger(pStr) == 1)
									vBase.Location.top = atoi(pStr);
								break;
							case 5:
								vBase.Location.right = 0;
								if(fCheckInteger(pStr) == 1)
									vBase.Location.right = atoi(pStr);
								break;
							case 6:
								vBase.Location.bottom = 0;
								if(fCheckInteger(pStr) == 1)
									vBase.Location.bottom = atoi(pStr);
								break;
							case 7:
								vBase.Size = 0;
								if(fCheckInteger(pStr) == 1)
									vBase.Size = atoi(pStr);
								break;
							case 8:
								vBase.Allowance = 0;
								if(fCheckInteger(pStr) == 1)
									vBase.Allowance = atoi(pStr);
								break;
							case 9:
								vBase.PosDistr = 0;
								if(fCheckInteger(pStr) == 1)
									vBase.PosDistr = atoi(pStr);
								break;
							case 10:
								vBase._c2 = 0;
								if(fCheckInteger(pStr) == 1)
									vBase._c2 = atoi(pStr);
								break;
							case 11:
								vBase._v2 = 0;
								if(fCheckInteger(pStr) == 1)
									vBase._v2 = atoi(pStr);
								break;
							case 12:
								vBase.Tree = 0;
								if(fCheckDouble(pStr,Sep) == 1)
									vBase.Tree = atof(pStr);
								break;
							case 13:
								vBase.FelledTrees = 0;
								if(fCheckDouble(pStr,Sep) == 1)
									vBase.FelledTrees = atof(pStr);
								break;
							case 14:
								vBase.LvlСhange = 0;
								if(fCheckDouble(pStr,Sep) == 1)
									vBase.LvlСhange = atof(pStr);
								break;
							case 15:
								vBase.IncLvl = 0;
								if(fCheckDouble(pStr,Sep) == 1)
									vBase.IncLvl = atof(pStr);
								break;
							case 16:
								vBase.WidePass = 0;
								if(fCheckDouble(pStr,Sep) == 1)
									vBase.WidePass = atof(pStr);
								break;
							case 17:
								vBase.Blood = 0;
								if(fCheckDouble(pStr,Sep) == 1)
									vBase.Blood = atof(pStr);
								break;
						 }
						 vCount++;
					 }
					 pStr = &chr[vvi]+1;
				 }
			 }

			 if (vCount != vMaxCount)
				 return 0;

			 _Base = vBase;

			 return 1;
		 }
// Сохранить карту
private: System::Void qSaveM_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 RECT AllocationArea;
			 int vLeft;
			 int vUp;
			 int vRight;
			 int vDown;
			 
			 if(qLeftR->Text == "" ||
				 qUpR->Text == "" ||
				 qRightR->Text == "" ||
				 qDownR->Text == "")
			 {
				 vLeft = 0;
				 vUp = 0;
				 vRight = vW;
				 vDown = vH;
			 }
			 else
			 {
				 if (fCheckInteger2(qLeftR->Text) == 1)
					 vLeft = Convert::ToInt32(qLeftR->Text);
				 if (fCheckInteger2(qUpR->Text) == 1)
					 vUp = Convert::ToInt32(qUpR->Text);
				 if (fCheckInteger2(qRightR->Text) == 1)
					 vRight = Convert::ToInt32(qRightR->Text);
				 if (fCheckInteger2(qDownR->Text) == 1)
					 vDown = Convert::ToInt32(qDownR->Text);
			 }

			 AllocationArea.left = vLeft;
			 AllocationArea.top = vUp;
			 AllocationArea.right = vRight;
			 AllocationArea.bottom = vDown;
			 fSaveMapEditor(vCheckF2,AllocationArea);
			 //fOnInitialUpdate();
		 }
// Загрузить карту
private: System::Void qLoadM_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 int _W;
			 int _H;
			 if (fLoadMapEditor(vCheckF2,_W,_H))
			 {
				 vW = _W;
				 vH = _H;
				 qW->Text = Convert::ToString(vW);
				 qH->Text = Convert::ToString(vH);
				 vWm = vW / vkW;
				 vHm = vH / vkH;
				 qWm->Text = Convert::ToString(vWm);
				 qHm->Text = Convert::ToString(vHm);
				 fMapInitialization(vWm,vHm);
			 }
			 else
				 fClearMapEditable();
			 fOnInitialUpdate();
			 fMode(vCheckF1);
			 fUpdateValuesRect();
			 fRefreshRect();
		 }
// Очистить карту
private: System::Void qClearM_Click(System::Object^  sender, System::EventArgs^  e) {
			 fClearMapEditable();
			 fRefreshRect();
		 }
private: System::Void fMouseDown (System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
			 //
			 RECT vRectClient;
			 Type ^vType;
			 Panel ^vPanel;

			 int w1;
			 int h1;
			 int w2;
			 int h2;
			 int vWidth;
			 int vHeight;
			 int vWidth2;
			 int vHeight2;
			 int x;
			 int y;

			 int vTerrainType;
			 int vLevelUpland;
			 int vObject;
			 int vR;

			 float _x;
			 float _y;

			 vType = sender->GetType();
			 if (vType->FullName == "System.Windows.Forms.Panel")
				 vPanel = (Panel ^)sender;
			 else
				 return;

			 vRectClient.left = 0;
			 vRectClient.top = 0;
			 vRectClient.right = vPanel->Width;
			 vRectClient.bottom = vPanel->Height;
			 
			 h1 = (vRectClient.bottom - vRectClient.top) / (vHm+2);
			 vRectClient.top = vRectClient.top + h1;
			 vRectClient.bottom = vRectClient.bottom - h1;
			 w1 = (vRectClient.right - vRectClient.left) / (vWm+2);
			 vRectClient.left = vRectClient.left + w1;
			 vRectClient.right = vRectClient.right - w1;
			 if (vCheckF1 == 0)
			 {
				 vPressingMouse = false;
				 vPointMouse[0]->X = 0;
				 vPointMouse[0]->Y = 0;
				 vPointMouse[1]->X = 0;
				 vPointMouse[1]->Y = 0;

				 vRectClient.left = w1;
				 vRectClient.top = h1;
				 vRectClient.right = w1 * (vWm+1);
				 vRectClient.bottom = h1 * (vHm+1);

				 if (vRectClient.left < e->X &&
					 vRectClient.top < e->Y &&
					 vRectClient.right > e->X &&
					 vRectClient.bottom > e->Y)
				 {
					vPressingMouse = true;
					vPointMouse[0]->X = e->X;
					vPointMouse[0]->Y = e->Y;
					vPointMouse[1]->X = e->X;
					vPointMouse[1]->Y = e->Y;
				 }
			 }
			 if (vCheckF1 == 1 || vCheckF1 == 2 || vCheckF1 == 3)
			 {
				 if (qTerrainType->Text == "" ||
					 qLevelUpland->Text == "" ||
					 qObjectNum->Text == "")
					 return;
				 vWidth = (vkW * vWm) + 1;
				 vHeight = (vkH * vHm) + 1;
				 vWidth2 = (vW+1)%vWidth;
				 vHeight2 = (vH+1)%vHeight;
				 w2 = (vRectClient.right - vRectClient.left) / (vWidth + vWidth2);
				 h2 = (vRectClient.bottom - vRectClient.top) / (vHeight + vHeight2);
				 w2 /= 2;
				 h2 /= 2;
				 if (w2 < 0 || h2 < 0)
					 return;
				 if (vCheckF1 == 3)
				 {
					 vRectClient.left = vRectClient.left + w2;
					 vRectClient.right = vRectClient.right - w2 + vWidth2 * w2;
					 vRectClient.top = vRectClient.top + h2 + vHeight2 * h2;
					 vRectClient.bottom = vRectClient.bottom - h2;
					 if (vRectClient.left > e->X ||
						 vRectClient.top > e->Y ||
						 vRectClient.right < e->X ||
						 vRectClient.bottom < e->Y)
						 return;
					 w1 += w2;
					 h1 += h2;
				 }
				 else
				 {
					 w2 *= 2;
					 h2 *= 2;
				 }
				 if (vRectClient.left < e->X &&
					 vRectClient.top < e->Y &&
					 vRectClient.right > e->X &&
					 vRectClient.bottom > e->Y)
				 {
					 vPressingMouse = true;

					 vObject = qObjectNum->SelectedIndex;

					 if (vCheckF1 == 3)
					 {
						 x = ((float)(e->X - w1)) / ((float)w2 / 2);
						 y = ((float)(e->Y - h1)) / ((float)h2 / 2);
						 if (x > 0 && y > 0 && x < vW*4 && y < vH*4)
						 {
							 _x = (float)(x * 32);
							 _y = (float)((vH * 4 - y) * 32);
							 _x += (float)(vW * 128 / -2);
							 _y += (float)(vH * 128 / -2);
							 /*qCoordinatesMap->Text = "Coordinates:" + "(" +
								 Convert::ToString(_x) + ";" +
								 Convert::ToString(_y) + ")";*/

							 if (vObject > 0)
								 fDoodadWrite(_x,_y,vObject);
							 else
								 fDoodadRemove(_x,_y);
						 }
					 }
					 else
					 {
						 x = (e->X - w1) / w2;
						 y = (e->Y - h1) / h2;
						 
						 vTerrainType = -1;
						 vLevelUpland = -1;
						 vTerrainType = Convert::ToInt32(qTerrainType->Text);
						 vTerrainType = vTerrainType/10*16 + vTerrainType%10;
						 vLevelUpland = Convert::ToInt32(qLevelUpland->Text);
						 vR = Convert::ToInt32(qBrushSize->Text);

						 for (int c=x-vR;c<=x+vR;c++)
						 {
							 for (int v=y-vR;v<=y+vR;v++)
							 {
								 if (vCheckF1 == 1 || vCheckF1 == 2)
								 {
									 fChangeGroundMapCell(c,(vHeight-1)+vHeight2-v,vTerrainType,vLevelUpland,4);
								 }
							 }
						 }
						 //
					 }
				 }
			 }
			 fRefreshRect();
		 }
private: System::Void fMouseUp (System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
			 //
			 RECT vRectMouse;
			 RECT vRectClient;
			 Type ^vType;
			 Panel ^vPanel;
			 int vLeft;
			 int vUp;
			 int vRight;
			 int vDown;
			 
			 int w1;
			 int h1;

			 if (vPressingMouse != true)
				 return;

			 vPressingMouse = false;
			 if (vCheckF1 == 0)
			 {
				 vPointMouse[1]->X = e->X;
				 vPointMouse[1]->Y = e->Y;

				 if (vPointMouse[1]->X != vPointMouse[0]->X &&
					 vPointMouse[1]->Y != vPointMouse[0]->Y)
				 {
					 if(vPointMouse[1]->X > vPointMouse[0]->X)
					 {
						 vRectMouse.left = vPointMouse[0]->X;
						 vRectMouse.right = vPointMouse[1]->X;
					 }
					 else
					 {
						 vRectMouse.left = vPointMouse[1]->X;
						 vRectMouse.right = vPointMouse[0]->X;
					 }
					 if(vPointMouse[1]->Y > vPointMouse[0]->Y)
					 {
						 vRectMouse.top = vPointMouse[0]->Y;
						 vRectMouse.bottom = vPointMouse[1]->Y;
					 }
					 else
					 {
						 vRectMouse.top = vPointMouse[1]->Y;
						 vRectMouse.bottom = vPointMouse[0]->Y;
					 }

					 vType = sender->GetType();
					 if (vType->FullName == "System.Windows.Forms.Panel")
						 vPanel = (Panel ^)sender;
					 else
						 return;

					 vRectClient.left = 0;
					 vRectClient.top = 0;
					 vRectClient.right = vPanel->Width;
					 vRectClient.bottom = vPanel->Height;

					 h1 = (vRectClient.bottom - vRectClient.top) / (vHm+2);
					 vRectClient.top = vRectClient.top + h1;
					 vRectClient.bottom = vRectClient.bottom - h1;
					 w1 = (vRectClient.right - vRectClient.left) / (vWm+2);
					 vRectClient.left = vRectClient.left + w1;
					 vRectClient.right = vRectClient.right - w1;

					 vRectClient.left = w1 + w1/2;
					 vRectClient.top = h1 + h1/2;
					 vRectClient.right = w1 * (vWm+1) - w1/2;
					 vRectClient.bottom = h1 * (vHm+1) - h1/2;

					 if (vRectMouse.left > vRectMouse.right ||
						 vRectMouse.top > vRectMouse.bottom)
						 return;

					 if (vRectMouse.left < vRectClient.left)
						 vRectMouse.left = vRectClient.left;
					 if (vRectMouse.top < vRectClient.top)
						 vRectMouse.top = vRectClient.top;
					 if (vRectMouse.right < vRectClient.left)
						 vRectMouse.right = vRectClient.left;
					 if (vRectMouse.bottom < vRectClient.top)
						 vRectMouse.bottom = vRectClient.top;

					 if (vRectMouse.left > vRectClient.right)
						 vRectMouse.left = vRectClient.right;
					 if (vRectMouse.top > vRectClient.bottom)
						 vRectMouse.top = vRectClient.bottom;
					 if (vRectMouse.right > vRectClient.right)
						 vRectMouse.right = vRectClient.right;
					 if (vRectMouse.bottom > vRectClient.bottom)
						 vRectMouse.bottom = vRectClient.bottom;

					 vLeft = ceil((double)(vRectMouse.left - vRectClient.left) / (double)w1);
					 vUp = ceil((double)(vRectMouse.top - vRectClient.top) / (double)h1);
					 vRight = floor((double)(vRectMouse.right - vRectClient.left) / (double)w1);
					 vDown = floor((double)(vRectMouse.bottom - vRectClient.top) / (double)h1);
					 
					 if (vLeft > vRight)
						 vRight = vLeft;
					 if (vUp > vDown)
						 vDown = vUp;

					 qLeftB->Text = Convert::ToString(vLeft);
					 qUpB->Text = Convert::ToString(vUp);
					 qRightB->Text = Convert::ToString(vRight);
					 qDownB->Text = Convert::ToString(vDown);
					 fUpdateValuesRect();
					 fRefreshRect();
				 }
			 }
		 }
private: System::Void fMouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
			 //
			 RECT vRectClient;
			 Type ^vType;
			 Panel ^vPanel;

			 int w1;
			 int h1;
			 int w2;
			 int h2;
			 int vWidth;
			 int vHeight;
			 int vWidth2;
			 int vHeight2;
			 int x;
			 int y;

			 int vTerrainType;
			 int vLevelUpland;
			 int vObject;
			 int vR;

			 float _x;
			 float _y;

			 if (vPressingMouse != true)
				 return;

			 vType = sender->GetType();
			 if (vType->FullName == "System.Windows.Forms.Panel")
				 vPanel = (Panel ^)sender;
			 else
				 return;

			 vRectClient.left = 0;
			 vRectClient.top = 0;
			 vRectClient.right = vPanel->Width;
			 vRectClient.bottom = vPanel->Height;
			 
			 h1 = (vRectClient.bottom - vRectClient.top) / (vHm+2);
			 vRectClient.top = vRectClient.top + h1;
			 vRectClient.bottom = vRectClient.bottom - h1;
			 w1 = (vRectClient.right - vRectClient.left) / (vWm+2);
			 vRectClient.left = vRectClient.left + w1;
			 vRectClient.right = vRectClient.right - w1;
			 
			 if (vCheckF1 == 0)
			 {
				 vRectClient.left = w1;
				 vRectClient.top = h1;
				 vRectClient.right = w1 * (vWm+1);
				 vRectClient.bottom = h1 * (vHm+1);
				 vPointMouse[1]->X = e->X;
				 vPointMouse[1]->Y = e->Y;
				 if (vPointMouse[1]->X < vRectClient.left)
					 vPointMouse[1]->X = vRectClient.left;
				 if (vPointMouse[1]->Y < vRectClient.top)
					 vPointMouse[1]->Y = vRectClient.top;
				 if (vPointMouse[1]->X > vRectClient.right)
					 vPointMouse[1]->X = vRectClient.right;
				 if (vPointMouse[1]->Y > vRectClient.bottom)
					 vPointMouse[1]->Y = vRectClient.bottom;
			 }

			 if (vCheckF1 == 1 || vCheckF1 == 2 || vCheckF1 == 3)
			 {
				 if (qTerrainType->Text == "" ||
					 qLevelUpland->Text == "" ||
					 qObjectNum->Text == "")
					 return;
				 vWidth = (vkW * vWm) + 1;
				 vHeight = (vkH * vHm) + 1;
				 vWidth2 = (vW+1)%vWidth;
				 vHeight2 = (vH+1)%vHeight;
				 w2 = (vRectClient.right - vRectClient.left) / (vWidth + vWidth2);
				 h2 = (vRectClient.bottom - vRectClient.top) / (vHeight + vHeight2);
				 w2 /= 2;
				 h2 /= 2;
				 if (w2 < 0 || h2 < 0)
					 return;
				 if (vCheckF1 == 3)
				 {
					 vRectClient.left = vRectClient.left + w2;
					 vRectClient.right = vRectClient.right - w2 + vWidth2 * w2;
					 vRectClient.top = vRectClient.top + h2 + vHeight2 * h2;
					 vRectClient.bottom = vRectClient.bottom - h2;
					 if (vRectClient.left > e->X ||
						 vRectClient.top > e->Y ||
						 vRectClient.right < e->X ||
						 vRectClient.bottom < e->Y)
						 return;
					 w1 += w2;
					 h1 += h2;
				 }
				 else
				 {
					 w2 *= 2;
					 h2 *= 2;
				 }
				 if (vRectClient.left < e->X &&
					 vRectClient.top < e->Y &&
					 vRectClient.right > e->X &&
					 vRectClient.bottom > e->Y)
				 {

					 vObject = qObjectNum->SelectedIndex;

					 if (vCheckF1 == 3)
					 {
						 x = ((float)(e->X - w1)) / ((float)w2 / 2);
						 y = ((float)(e->Y - h1)) / ((float)h2 / 2);
						 if (x > 0 && y > 0 && x < vW*4 && y < vH*4)
						 {
							 _x = (float)(x * 32);
							 _y = (float)((vH * 4 - y) * 32);
							 _x += (float)(vW * 128 / -2);
							 _y += (float)(vH * 128 / -2);
							 /*qCoordinatesMap->Text = "Coordinates:" + "(" +
								 Convert::ToString(_x) + ";" +
								 Convert::ToString(_y) + ")";*/

							 if (vObject > 0)
								 fDoodadWrite(_x,_y,vObject);
							 else
								 fDoodadRemove(_x,_y);
						 }
					 }
					 else
					 {
						 x = (e->X - w1) / w2;
						 y = (e->Y - h1) / h2;
						 
						 vTerrainType = -1;
						 vLevelUpland = -1;
						 vTerrainType = Convert::ToInt32(qTerrainType->Text);
						 vTerrainType = vTerrainType/10*16 + vTerrainType%10;
						 vLevelUpland = Convert::ToInt32(qLevelUpland->Text);
						 vR = Convert::ToInt32(qBrushSize->Text);

						 for (int c=x-vR;c<=x+vR;c++)
						 {
							 for (int v=y-vR;v<=y+vR;v++)
							 {
								 if (vCheckF1 == 1 || vCheckF1 == 2)
								 {
									 fChangeGroundMapCell(c,(vHeight-1)+vHeight2-v,vTerrainType,vLevelUpland,4);
								 }
							 }
						 }
						 //
					 }
				 }
			 }
			 fRefreshRect();
		 }
// Выбрать карту
private: System::Void qSelectM_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			 //
			 vCheckF2 = qSelectM->SelectedIndex;
		 }
// Применить регион
private: System::Void qApplyR_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 RegionMap vRegion;
			 int vId;
			 if (qIdR->Text == "")
			 {
				 MessageBox::Show("Выберите идентификационный номер региона!");
				 return;
			 }
			 vId = Convert::ToInt32(qIdR->Text);
			 if(vId < 0)
				 return;
			 if(fCollectDataOfRegion(vRegion) == 0)
				 return;
			 vRegion.Id = vId;
			 fEditRegion(vRegion);
		 }
// Создать регион
private: System::Void qCreateR_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 RegionMap vRegion;
			 if(fCollectDataOfRegion(vRegion) == 0)
				 return;
			 fAddRegion(vRegion);
			 fRefreshListIdOfRegions(vRegion.Id);
		 }
// Забираем данные региона
private: System::Int32 fCollectDataOfRegion(RegionMap &_Region) {
			 RegionMap vRegion;
			 int vInt1;
			 int vFlag;
			 if (qTypeR->Text == "" ||
				 qLeftR->Text == "" || qUpR->Text == "" ||
				 qRightR->Text == "" || qDownR->Text == "")
			 {
				 MessageBox::Show("Отсутствуют некоторые данные!");
				 return 0;
			 }
			 if (fCheckInteger2(qTypeR->Text) == 1)
				 vInt1 = Convert::ToInt32(qTypeR->Text);
			 if (vInt1 < 0)
			 {
				 vFlag = 1;
				 MessageBox::Show("TypeR >= 0");
			 }
			 vRegion.Type = vInt1;
			 if (fCheckInteger2(qLeftR->Text) == 1)
				 vInt1 = Convert::ToInt32(qLeftR->Text);
			 if (vInt1 < 0)
			 {
				 vFlag = 1;
				 MessageBox::Show("LeftR >= 0 && LeftR < W");
			 }
			 vRegion.Rect.left = vInt1;
			 if (fCheckInteger2(qUpR->Text) == 1)
				 vInt1 = Convert::ToInt32(qUpR->Text);
			 if (vInt1 < 0)
			 {
				 vFlag = 1;
				 MessageBox::Show("UpR >= 0 && UpR < H");
			 }
			 vRegion.Rect.top = vInt1;
			 if (fCheckInteger2(qRightR->Text) == 1)
				 vInt1 = Convert::ToInt32(qRightR->Text);
			 if (vInt1 < 0)
			 {
				 vFlag = 1;
				 MessageBox::Show("RightR >= 0 && RightR < W");
			 }
			 vRegion.Rect.right = vInt1;
			 if (fCheckInteger2(qDownR->Text) == 1)
				 vInt1 = Convert::ToInt32(qDownR->Text);
			 if (vInt1 < 0)
			 {
				 vFlag = 1;
				 MessageBox::Show("DownR >= 0 && DownR < H");
			 }
			 vRegion.Rect.bottom = vInt1;
			 if (vRegion.Rect.left > vRegion.Rect.right)
			 {
				 vFlag = 1;
				 MessageBox::Show("LeftR <= RightR");
			 }
			 if (vRegion.Rect.top > vRegion.Rect.bottom)
			 {
				 vFlag = 1;
				 MessageBox::Show("UpR <= DownR");
			 }
			 if (vFlag == 1)
			 {
				 MessageBox::Show("Данные введены не верно!");
				 return 0;
			 }
			 _Region = vRegion;
			 return 1;
		 }
// Удалить регион
private: System::Void qDeleteR_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 int vIdR;

			 if (qIdR->Text == "")
				 return;
			 if (fCheckInteger2(qIdR->Text) == 1)
				 vIdR = Convert::ToInt32(qIdR->Text);
			 fDelRegion(vIdR);
			 fRefreshListIdOfRegions(-1);
			 fTakeData2();
		 }
// Обновить лист ID регионов (индентификационных номеров)
private: System::Void fRefreshListIdOfRegions(int _SelectId) {
			 //
			 int *pListId;
			 int vN;
			 int vPreviousIndex;
			 int vCount;
			 String ^vString;
			 vPreviousIndex = qIdR->SelectedIndex;
			 pListId = new int[100];
			 fGetListIdRegions(pListId,vN);
			 qIdR->Items->Clear();
			 for (int vvi=0;vvi<vN;vvi++)
			 {
				 vString = Convert::ToString(pListId[vvi]);
				 qIdR->Items->Add(vString);
				 if (pListId[vvi] == _SelectId)
					 qIdR->SelectedIndex = vvi;
			 }
			 vCount = qIdR->Items->Count;
			 if (_SelectId == -1 && vCount > 0)
			 {
				 if(vCount > vPreviousIndex)
					 qIdR->SelectedIndex = vPreviousIndex;
				 else
					 qIdR->SelectedIndex = vCount-1;
			 }
			 if (vCount == 0)
			 {
				 qIdR->Text = "";
				 qTypeR->Text = "";
				 qLeftR->Text = "";
				 qUpR->Text = "";
				 qRightR->Text = "";
				 qDownR->Text = "";
			 }
			 if (pListId)
				 delete pListId;
		 }
// Взять данные региона карты
private: System::Void fTakeData2 () {
			 RegionMap vRegion;
			 int vId;
			 if (qIdR->Text == "")
				 return;
			 vId = Convert::ToInt32(qIdR->Text);
			 fGetRegion(vRegion,vId);
			 if (vRegion.Id < 0)
				 return;
			 fFillDataOfRegions(vRegion);
			 fUpdateValuesRect();
			 fRefreshRect();
		 }
// Скинуть данные региона карты
private: System::Int32 fFillDataOfRegions (RegionMap _Region) {
			 //
			 qIdR->Text = Convert::ToString(_Region.Id);
			 qTypeR->Text = Convert::ToString(_Region.Type);
			 qLeftR->Text = Convert::ToString(_Region.Rect.left);
			 qUpR->Text = Convert::ToString(_Region.Rect.top);
			 qRightR->Text = Convert::ToString(_Region.Rect.right);
			 qDownR->Text = Convert::ToString(_Region.Rect.bottom);
			 return 1;
		 }
private: System::Void qIdR_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			 fTakeData2();
		 }
// Сохранить архив карты
private: System::Void qSave2_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 String ^vStr;
			 String ^vDir;
			 String ^vFileName;
			 int vStrLen;
			 char *pFullPath;

			 SaveFileDialog1->FileName = "*.w3x";
			 SaveFileDialog1->Filter = "Сценарий Warcraft 3 (*w3m, *.w3x)|*.w3m;*.w3x";
			 //SaveFileDialog1->InitialDirectory = System::Windows::Forms::Application::StartupPath;
			 if (SaveFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
			 {
				 vStrLen = SaveFileDialog1->FileName->Length;
				 vDir = "";
				 for(int vvi=0;vvi<vStrLen-1;vvi++)
				 {
					 vStr = SaveFileDialog1->FileName->Substring(vStrLen-vvi-1,1);
					 if (vStr == "\\")
					 {
						 vDir = SaveFileDialog1->FileName->Substring(0,vStrLen-vvi);
						 vFileName = SaveFileDialog1->FileName->Substring(vStrLen-vvi,vvi);
						 break;
					 }
				 }
				 
				 if (!System::IO::Directory::Exists(vDir))
				 {
					 MessageBox::Show("Путь указан не правильно!");
					 return;
				 }
				 vStr = vFileName->Substring(vFileName->Length-4,4);
				 if (vStr != ".w3x" && vStr != ".w3m") SaveFileDialog1->FileName += ".w3x";
				 
				 vFile2 = SaveFileDialog1->FileName;

				 fSysStringToChar(vFile2,pFullPath);
				 fSaveFileArchive(pFullPath);
			 }
		 }
// Загрузить архив карты в выбранную карту
private: System::Void qLoad2_Click(System::Object^  sender, System::EventArgs^  e) {
			 //
			 int vFlag;
			 char *pFullPath;
			 //int vLen;

			 OpenFileDialog1->FileName = "*.w3x";
			 OpenFileDialog1->Filter = "Сценарий Warcraft 3 (*w3m, *.w3x)|*.w3m;*.w3x";
m1:;
			 vFlag = 0;
			 if (OpenFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
			 {
				 if (!System::IO::File::Exists(OpenFileDialog1->FileName))
				 {
					 MessageBox::Show("Выберите файл!");
					 vFlag = 1;
				 }
			 }
			 else
				 return;
			 if (vFlag == 1) goto m1;

			 vFile2 = OpenFileDialog1->FileName;
			 /*vLen = vFile2->Length;
			 for (int vvi=0;vvi<vLen;vvi++)
			 {
				 if (vFile2->Substring(vLen-1-vvi,1) == "\\")
				 {
					 vFile2 = vFile2->Substring(vLen-1-(vvi-1),vvi);
					 break;
				 }
			 }*/

			 fSysStringToChar(vFile2,pFullPath);
			 fLoadFileArchive(pFullPath,vCheckF2);
		 }
};
}

