#pragma once

#include "stdafx.h"

#include "Includes.h"

using namespace std;

OPENFILENAME ofn;

char szFile[1000];

int op_mode,Debug_ = 1,LineNumber,Track_Progress;

string Line = "";

size_t loc4;

int Loaded = -1,Button = -1,ButtonNameIndex = -1;

const int rec_t_cnt=43;

int testing = 0;

LVCOLUMN LvCol; 
LVITEM LvItem;

char* MoMEditorArray[rec_t_cnt][215][33];

const int rec_count[rec_t_cnt]={         66,         36,     215,          35,              4,                7,              11,               9,               10,              7,            6,               6,               9,              10,              6,                7,           10,         10,            7,              44,         14,                        82,	                 35,               1,                  0x3,               0x2,                   0x8,                 0x2,                   0x1,             0x8,                        0x1,                     0xA,                     0x2,                           0x1,                                 0x1,                         0x1,            0x12,                        0xF,                   0x5,                       0x5,                    0x1,            0x9,                    0x5}; 
const int  step_max[rec_t_cnt]={         10,         17,      16,          33,             33,               33,              33,              33,               33,             33,           33,              33,              33,              33,             33,               33,           33,         33,           33,              33,         12,                         2,                    19,               2,                  0x2,               0x2,                   0x2,                 0x2,                   0x2,             0x2,                        0x2,                     0x2,                     0x2,                           0x2,                                 0xB,                         0x2,             0x2,                        0x2,                   0x2,                       0x2,                    0x2,            0x2,                    0x2};
const long rec_ofs[rec_t_cnt]={       0x224,      0x224,   0x224,     0x2963C,        0x29B28,          0x29BB8,         0x29CB4,         0x29E40,          0x29F84,        0x2A0EC,      0x2A1E8,         0x2A2C0,         0x2A398,         0x2A4DC,        0x2A644,          0x2A71C,      0x2A818,    0x2A980,      0x2AAE8,         0x2ABE4,    0x2B226,                   0x2B3B8,	           0x027AE0,	       0x082C9F,                  0x0,               0x0,                   0x0,                 0x0,               0x5C02D,             0x0,                        0x0,                     0x0,                     0x0,                       0x5863D,                             0x2713E,                     0x47C35,             0x0,                        0x0,                   0x0,                       0x0,                0xbe2d4,            0x0,                    0x0};
char* directive[rec_t_cnt+1]={"ITEM POWERS","BUILDINGS","SPELLS","HER0 UNITS","GENERIC UNITS","BARBARIAN UNITS","BEASTMEN UNITS","DARK ELF UNITS","DRACONIAN UNITS","DWARVEN UNITS","GNOLL UNITS","HALFLING UNITS","HIGH ELF UNITS","HIGH MEN UNITS","KLACKON UNITS","LIZARDMEN UNITS","NOMAD UNITS","ORC UNITS","TROLL UNITS","SUMMONED UNITS","RACE DATA","ENCHANTMENT UPKEEP COSTS","HEROES SPECIAL STATS","HEALING SPELLS","BOOK AND RETORT MAX","MANA AND GOLD CAP","WIZARDS PICK POINTS","ITEM VALUE REWARDS","MINMUM CITY DISTANCE","RETORT EFFECTS","CREATE SPELL CHARGE COSTS","CREATE BASE ITEM COSTS","CREATE ITEM MAXIMUM VALUE","MANA FROM DESTROYED ITEMS","GRANTED SPELLS PER NUMBER OF BOOKS","TURNS BEFORE RANDOM EVENTS","MAP GENERATION","RESEARCH BONUS FROM BOOKS","HERO CHANCE FOR HIRE","MERCENARY CHANCE FOR HIRE","CHANCE ITEM FOR SALE","MISC Settings","FOOD BUILDING BONUSES","END"};
//                             0             1           2        3            4               5                 6                7                8                 9               10            11               12               13               14              15                16            17          18            19               20          21                         22                     23               24                    25                  26                    27                   28                     29               30                          31                       32                          33                          34                                   35                           36               37                          38                     39                          40                     41              42                     43             44                45                   46                47                       48              49            50           51          52           53               54               55             56            57              58                       59                       60                 61

char* ver_info="%version=0.2500000";

string txt_fname = "";
string debug_fname = "MoM_Editor_Debug.txt";
string exe_fname = "WIZARDS.EXE";
string exe2_fname = "MAGIC.EXE";
string exe3_fname = "ITEMMAKE.EXE";
string build_fname = "BUILDDAT.LBX";
string item_fname = "ITEMPOW.LBX";
string spell_fname = "SPELLDAT.LBX";

ofstream Debug;

const int Building_Additives[17]={0,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50};
const int Item_Power_Additives[10]={0,18,19,20,22,24,26,27,28,29};
const int Spells_Additives[16]={0,19,20,21,22,23,24,25,26,28,30,31,32,33,34,35};
const int Units_Additives[33]={0,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34};
const int Race_Additives[12]={0,2,4,6,8,10,12,14,16,18,20,22};
const int HeroSpecial_Additives[19]={0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11};
const int BookRetort_Additives[5]={0x633E6,0x633E0,0x63410,0x63405,0x633FA};
const int GoldMana_Additives[4]={0x95A14,0x959F4,0x95A25,0x95A05};
const int Picks_Additives[8]={0x3394B,0x469F0,0x469FC,0x46A08,0x467F3,0x46802,0x46812,0x46822};
const int BookItems_Additives[2]={0x62D82,0x62E32}; //dwords
const int Retort_Effects_Additives[8]={0x982DE,0x98290,0x972DF,0x97306,0x97433,0x9732B,0x97368,0x973A5}; //dwords
const int Create_Spell_Charges_Costs_Additives[2]={0x8C0E4,0x72A0};//2 = itemmake.exe
const int Create_Base_Costs_Additives[2]={0x2F078,0x29B46};//2 = itemmake.exe - dwords
const int Create_Base_Costs_Steps_Additives[11]={0,0,2,4,6,8,10,12,14,16,18};// i31 dwords
const int Create_Caps_Additives[2]={0x8C488,0x8C481};//dwords
const int Spells_Per_Book_Additives[11]={0,0,2,4,6,8,10,12,14,16,18};// i31 dwords
const int Map_Generation_One_Additives[18]={0x3EAF1,0x3DD83,0x39A94,0x39B6F,0x39988,0x39671,0x3966C,0x39589,0x39575,0x396A4,0x39341,0x393E3,0x38433,0x38424,0x38412,0x3835B,0x38354,0x3834D};
const int Map_Generation_Two_Additives[12]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x36D73};//towers+6
const int Research_From_Books_Additives[15]={0x97339,0x9734A,0x9734D,0x97376,0x97387,0x9738A,0x973B3,0x973C4,0x973C7,0x973DC,0x973ED,0x973F0,0x97405,0x97416,0x97419};//dwords : 
const int Hero_Join_Additives[5]={0xbe57b,0xbe581,0xbe59d,0xbe5a1,0xbe5a9};
const int Merc_Join_Additives[5]={0xbe38e,0xbe3a7,0xbe3b1,0xbe3b5,0xbe3bd}; 
const int Misc_Additives[9]={0x99F4B,0x99F51,0x9A651,0xBCB2F,0xF41AB,0x90D99,0xBDB00,0xC01EA,0xB550E};
const int Food_Bonuses_Additives[5]={0xC0078,0xC02CC,0xC02F7,0xC026E,0xC0228};

char* Overland_Spell_Names[82]={"Immolation","Guardian Wind","Berserk","Cloak of Fear","Black Channels","Wraithform","Regeneration","Pathfinding","Water Walking","Resist Elements","Elemental Armor","Stone Skin","Iron Skin","Endurance","Spell Lock","Invisibility","Wind Walking","Flight","Resist Magic","Magic Immunity","Flame Blade","Eldritch Weapon","True Sight","Holy Weapon","Heroism","Bless","Lion Heart","Giant Strength","Planar Trave","Holy Armor","Righteousness","Invulnerability","Wall of Fire","Chaos Rift","Dark Rituals","Evil Presence","Cursed Lands","Pestilence","Cloud of Shadow","Famine","Flying Fortress","Nature Ward","Sorcery Ward","Chaos Ward","Life Ward","Death Ward","Nature's Eye","Earth Gate","Stream of Life","Gaia's Blessing","Inspirations","Prosperity","Astral Gate","Heavenly Light","Consecration","Wall of Darkness","Altar of Battle","Nightshade","Eternal Night","Evil Omens","Zombie Mastery","Aura of Majesty","Wind Mastery","Suppress Magic","Time Stop","Nature Awareness","Nature's Wrath","Herb Mastery","Chaos Surge","Doom Mastery","Great Wasting","Meteor Storm","Armageddon","Tranquility","Life Force","Crusade","Just Cause","Holy Arms","Planar Sea","Charm of Life","Detect Magic","Awareness"};
char* Hero_Special_Names[35]={"Dwarf","Barbarian","Sage","Dervish","Beastmaster","Bard","Orc Warrior","Healer","Huntress","Thief","Druid","War Monk","Warrior Mage","Magician","Assassin","Wind Mage","Ranger","Draconian","Witch","Golden One","Ninja","Rogue","Amazon","Warlock","Unknown","Illusionist","Swordsman","Priestess","Paladin","Black Knight","Elven Archer","Knight","Necromancer","Chaos Warrior","Chosen"};
char* Healing_Name[1]={"Heal Amount"};
char* Book_Retort_Max_Name[3]={"Book Max","Retort Max","Reward Book Over Retort %"};
char* Mana_Gold_Max_Name[2]={"Mana Max","Gold Max"};
char* Wizard_Picks_Names[8]={"Player Picks","AI Picks On Easy or Normal","AI Picks On Hard","AI Picks On Impossible","Extra AI Picks On Easy or Normal","Extra Extra AI Picks On Hard","Extra AI Picks On Impossible","Extra AI Picks On Impossible + 1"};
char* Item_Over_Books_Names[2]={"Item Value From 1 Book","Item Value from 2 Books"};
char* Minimum_City_Distance_Name[1]={"Settle City Distance Minimum"};
char* Retort_Effects_Names[8]={"Runemaster Casting Cost % Discount","Artificer Create Item % Discount","Sage Master Research Bonus %","Conjurer Research Bonus %","Runemaster Research Bonus %","Chaos Master Research Bonus %","Nature Master Research Bonus %","Sorcery Master Research Bonus %"};
char* Create_Spell_Charges_Name[1]={"Spell Charges Cost"};
char* Create_Base_Costs_Name[10]={"Sword","Mace","Axe","Bow","Staff","Wand","Misc","Shield","Chain","Plate"};
char* Create_Caps_Name[2]={"Create Item Value Max","Create Artifact Value Max"};
char* Destroy_Items_Name[2]={"25% or 50% Mana From Items"};
char* Spells_Per_Book_Name[2]={"Spells Per Number of Books"};
char* Random_Events_Name[2]={"# Turns Before Chance of Random Events"};
char* Map_Generation_Names[18]={"Distance To Connect Cities With Roads","Chance of Same Race on Continent","Lower Primary Monsters","Number of Secondary Monsters In Lair","Number of Monsters In Lair","Weak Lair Monster Cash On Myrror","Weak Lair Monster Cash On Arcanus","Normal Lair Monster Cash On Myrror","Normal Lair Monster Cash On Arcanus","Number of Weak Lairs","Number of Normal Lairs","Number of Towers","Landmass Large Continent Minimum Tiles","Landmass Medium Continent Minimum Tiles","Landmass Small Continent Minimum Tiles","Landmass Large Continent Total Tiles","Landmass Medium Continent Total Tiles","Landmass Small Continent Total Tiles"};
char* Research_From_Books_Names[15]={"Minimum Chaos Books For Research Bonus","Added To Chaos Books For Research Bonus","Chaos Books Research Bonus %","Minimum Nature Books For Research Bonus","Added To Nature Books For Research Bonus","Nature Books Research Bonus %","Minimum Sorcery Books For Research Bonus","Added To Sorcery Books For Research Bonus","Sorcery Books Research Bonus %","Minimum Life Books For Research Bonus","Added To Life Books For Research Bonus","Life Books Research Bonus %","Minimum Death Books For Research Bonus","Added To Death Books For Research Bonus","Death Books Research Bonus %"};
char* Hero_Join_Names[6]={"Var i","Var j","Var k","Var l","Var m","Var n"};
char* Merc_Join_Names[5]={"Var i","Var j","Var k","Var l","Var m"};
char* Item_Sales_Names[1]={"Chance To Be Offered An Item For Sale"};
char* Misc_Names[9]={"City Walls Defense","Broken Wall Defense","Large Shield","Noble Gold Per Turn","Ai Aggressive After X # Turns","Max Spells On A Unit","Max City Size","Implicit Animist Guild Race","Cast Spell Mana Pump Power"};
char* Food_Bonuses_Names[5]={"Wild Game","Grainery","Farmers Market","Forresters Guild","Animist Guild - Food Per Farmer"};

LPCTSTR ListBoxButtons[rec_t_cnt]={"Item Powers","Buildings","Spells","Hero Units","Generic Units","Barbarian Units","Beastmen Units","Dark Elf Units","Draconian Units","Dwarven Units","Gnoll units","Halfling Units","High Elf Units","High Men Units","Klackon Units","Lizardmen Units","Nomad Units","Orc Units","Troll Units","Summoned Units","Race Data","Enchantment Upkeep","Hero Stats","Healing Spells","Book & Retort Max","Gold & Mana Max","Wizards Picks","Item Rewards Value","City Distance","Retort Effects","Create Spell Charges Costs","Create Item Base Costs","Create Item Maximum Costs","Mana From Destroyed Items","Spells Per Number of Books","Random Event Chance Starts Turn","Map Generation","Research Bonus From Books","Hero Join","Mercenary Join","Item Sale Chance","Misc Values","Food Buildings"};

char* ItemPowersHelp[10]={"Name","Placed On (1)","Placed On (2)","Mana Cost","Power Type","Bonus/Require","Specials (1)","Specials (2)","Specials (3)","Specials (4)"};
char* BuildingsHelp[17]={"Name","Requierment (1)","Requierment (2)","Replaces","Reg XP","Veteran XP","Magical","Upkeep","Food/Pop Bonus","Unknown","Unknown","Mana","Research","Build Cost","Unknown","Unknown","Unknown"};
char* SpellsHelp[16]={"Name","Unknown","Unknown","Unknown","Book","Realm","Eligibility","Unknown","Cost","Research","Sound","Unknown","Summon","Unknown","Unknown","Unknown"};
char* UnitsHelp[33]={"Name","Melee","Ranged","Range Type","Ranged Ammo","To Hit","Defense","Resist","Move Rate","Cost","Summoned","Race Code","Building","Item Slot","Unknown","Unknown","Hit Points","Unknown","Transport","# Figure's","Construction","Unknown","Move Flags","Unknown","Imunities","Attributes (1)","Attributes (2)","Unknown","Attributes (3)","Attributes (4)","Specials (1)","Specials (2)","Unknown"};
char* RaceDataHelp[12]={"Name","# of Banned Buildings","1st Banned Building","2nd Banned Building","3rd Banned Building","4th Banned Building","5th Banned Building","6th Banned Building","7th Banned Building","Outpost Growth","City Growth","Housing Picture"};
char* EnchantmentHelp[2]={"Name","Cost Per Turn"};
char* HeroSpecialHelp[19]={"Name","Number of Random Picks","Unknown","Random Pick Type","Unknown","Inherent Abilities(1)","Inherent Abilities(2)","Inherent Abilities(3)","Inherent Abilities(4)","Casting Skill","Unknown","Known Spell","Unknown","Known Spell","Unknown","Known Spell","Unknown","Known Spell","Unknown"};
char* Wizard_Picks_Help[8]={"Player Picks","AI Picks On Easy or Normal","AI Picks On Hard","AI Picks On Impossible","Extra AI Picks On Easy or Normal","Extra Extra AI Picks On Hard","Extra AI Picks On Impossible","Extra AI Picks On Impossible + 1"};
char* Item_Over_Books_Help[2]={"Item Value From 1 Book","Item Value from 2 Books"};
char* Minimum_City_Distance_Help[1]={"Settle City Distance Minimum"};
char* Retort_Effects_Help[2]={"Runemaster Casting Cost % Discount","Artificer Create Item % Discount"};
char* Create_Spell_Charges_Help[1]={"Spell Charges Cost"};
char* Create_Base_Costs_Help[10]={"Sword","Mace","Axe","Bow","Staff","Wand","Misc","Shield","Chain","Plate"};
char* Create_Caps_Help[2]={"Create Item Value Max","Create Artifact Value Max"};
char* Destroy_Items_Help[2]={"25% or 50% Mana From Items"};
char* Spells_Per_Book_Help[10]={"2 Books","3 Books","4 Books","5 Books","6 Books","7 Books","8 Books","9 Books","10 Books","11 Books"};
char* Random_Events_Help[2]={"# Turns Before Chance of Random Events"};
char* Map_Generation_Help[18]={""};
char* Research_From_Books_Help[15]={""};
char* Hero_Join_Help[7]={"Hero For Hire Formula","Variable","Variable","Variable","Variable","Variable","Variable"};
char* Merc_Join_Help[6]={"Mercenary For Hire Formula","Variable","Variable","Variable","Variable","Variable"};
char* Misc_Help[9]={""};
char* Food_Bonuses_Help[5]={""};


const int ItemPowersEditControlID[10]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10};
const int BuildingsEditControlID[17]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16,IDC_EDIT17};
const int SpellsEditControlID[16]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT18,IDC_EDIT19,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16};
const int UnitsEditControlID[33]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16,IDC_EDIT17,IDC_EDIT18,IDC_EDIT19,IDC_EDIT20,IDC_EDIT21,IDC_EDIT22,IDC_EDIT23,IDC_EDIT24,IDC_EDIT25,IDC_EDIT26,IDC_EDIT27,IDC_EDIT28,IDC_EDIT29,IDC_EDIT30,IDC_EDIT31,IDC_EDIT32,IDC_EDIT33};
const int RaceDataEditControlID[12]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT12,IDC_EDIT13};
const int EnchantmentEditControlID[2]={IDC_EDIT1,IDC_EDIT2};
const int HeroSpecialEditControlID[19]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16,IDC_EDIT17,IDC_EDIT18,IDC_EDIT19};
const int Wizard_Picks_EditControlID[8][2]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16};
const int Item_Over_Books_EditControlID[2]={};
const int Minimum_City_Distance_EditControlID[1]={};
const int Retort_Effects_EditControlID[2]={};
const int Create_Spell_Charges_EditControlID[1]={};
const int Create_Base_Costs_EditControlID[10][2]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16,IDC_EDIT17,IDC_EDIT18,IDC_EDIT19,IDC_EDIT20};
const int Create_Caps_EditControlID[2]={};
const int Destroy_Items_EditControlID[2]={};
const int Spells_Per_Book_EditControlID[11]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11};
const int Random_Events_EditControlID[2]={};
const int Map_Generation_EditControlID[18][2]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16,IDC_EDIT17,IDC_EDIT18,IDC_EDIT19,IDC_EDIT20,IDC_EDIT21,IDC_EDIT22,IDC_EDIT23,IDC_EDIT24,IDC_EDIT25,IDC_EDIT26,IDC_EDIT27,IDC_EDIT28,IDC_EDIT29,IDC_EDIT30,IDC_EDIT31,IDC_EDIT32,IDC_EDIT33,IDC_EDIT34,IDC_EDIT35,IDC_EDIT36};
const int Research_From_Books_EditControlID[15][2]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16,IDC_EDIT17,IDC_EDIT18,IDC_EDIT19,IDC_EDIT20,IDC_EDIT21,IDC_EDIT22,IDC_EDIT23,IDC_EDIT24,IDC_EDIT25,IDC_EDIT26,IDC_EDIT27,IDC_EDIT28,IDC_EDIT29,IDC_EDIT30};
const int Hero_Join_EditControlID[6][2]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12};
const int Merc_Join_EditControlID[5][2]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10};
const int Misc_EditControlID[9][2]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10,IDC_EDIT11,IDC_EDIT12,IDC_EDIT13,IDC_EDIT14,IDC_EDIT15,IDC_EDIT16,IDC_EDIT17,IDC_EDIT18};
const int Food_Bonuses_EditControlID[5][2]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4,IDC_EDIT5,IDC_EDIT6,IDC_EDIT7,IDC_EDIT8,IDC_EDIT9,IDC_EDIT10};

const int ItemPowersHelpControlID[10]={IDC_EDIT11,IDC_BUTTON1,IDC_BUTTON2,IDC_EDIT12,IDC_BUTTON3,IDC_BUTTON4,IDC_BUTTON5,IDC_BUTTON6,IDC_BUTTON7,IDC_BUTTON8};
const int BuildingsHelpControlID[17]={IDC_STATIC1,IDC_BUTTON1,IDC_BUTTON2,IDC_BUTTON3,IDC_BUTTON4,IDC_BUTTON5,IDC_BUTTON6,IDC_STATIC2,IDC_STATIC3,IDC_STATIC4,IDC_STATIC5,IDC_STATIC6,IDC_STATIC7,IDC_STATIC8,IDC_STATIC9,IDC_STATIC10,IDC_STATIC11};
const int SpellsHelpControlID[16]={IDC_STATIC1,IDC_STATIC2,IDC_STATIC3,IDC_STATIC4,IDC_BUTTON1,IDC_BUTTON2,IDC_BUTTON3,IDC_STATIC5,IDC_BUTTON4,IDC_STATIC6,IDC_BUTTON5,IDC_STATIC7,IDC_BUTTON6,IDC_STATIC8,IDC_STATIC9,IDC_STATIC10};
const int UnitsHelpControlID[33]={IDC_STATIC1,IDC_STATIC2,IDC_STATIC3,IDC_BUTTON1,IDC_STATIC4,IDC_STATIC5,IDC_STATIC6,IDC_STATIC7,IDC_BUTTON2,IDC_BUTTON3,IDC_BUTTON4,IDC_BUTTON5,IDC_BUTTON6,IDC_BUTTON7,IDC_STATIC8,IDC_STATIC9,IDC_BUTTON8,IDC_STATIC10,IDC_BUTTON9,IDC_BUTTON10,IDC_BUTTON11,IDC_STATIC11,IDC_BUTTON12,IDC_STATIC12,IDC_BUTTON13,IDC_BUTTON14,IDC_BUTTON15,IDC_STATIC13,IDC_BUTTON16,IDC_BUTTON17,IDC_BUTTON18,IDC_BUTTON19,IDC_STATIC14};
const int RaceDataHelpControlID[12]={IDC_STATIC1,IDC_BUTTON1,IDC_BUTTON2,IDC_BUTTON3,IDC_BUTTON4,IDC_BUTTON5,IDC_BUTTON6,IDC_BUTTON7,IDC_BUTTON8,IDC_BUTTON9,IDC_BUTTON11,IDC_BUTTON12};
const int EnchantmentHelpControlID[2]={IDC_STATIC1,IDC_STATIC2};
const int HeroSpecialHelpControlID[19]={IDC_STATIC1,IDC_STATIC2,IDC_STATIC3,IDC_STATIC4,IDC_STATIC5,IDC_BUTTON1,IDC_BUTTON2,IDC_BUTTON3,IDC_BUTTON4,IDC_STATIC6,IDC_STATIC7,IDC_BUTTON5,IDC_STATIC8,IDC_BUTTON6,IDC_STATIC9,IDC_BUTTON7,IDC_STATIC10,IDC_BUTTON8,IDC_STATIC11};
const int Wizard_Picks_HelpControlID[8]={};
const int Item_Over_Books_HelpControlID[2]={};
const int Minimum_City_Distance_HelpControlID[1]={};
const int Retort_Effects_HelpControlID[2]={};
const int Create_Spell_Charges_HelpControlID[1]={};
const int Create_Base_Costs_HelpControlID[10]={};
const int Create_Caps_HelpControlID[2]={};
const int Destroy_Items_HelpControlID[2]={};
const int Spells_Per_Book_HelpControlID[10]={IDC_STATIC1,IDC_STATIC2,IDC_STATIC3,IDC_STATIC4,IDC_STATIC5,IDC_STATIC17,IDC_STATIC18,IDC_STATIC19,IDC_STATIC20,IDC_STATIC21};
const int Random_Events_HelpControlID[2]={};
const int Map_Generation_HelpControlID[2]={};
const int Research_From_Books_HelpControlID[2]={};
const int Hero_Join_HelpControlID[1]={};
const int Merc_Join_HelpControlID[1]={};
const int Misc_HelpControlID[9]={};
const int Food_Bonuses_HelpControlID[5]={};

CDialogEx *m_SettingsDlg;
CProgressCtrl * m_progress;

CDialogEx *m_SectionDlg;
CListBox* m_SelectBox;

CDialogEx* m_ItemPwrDlg;
CDialogEx* m_ItemPwrEditDlg;
CListBox* m_ItemPwrBox;

CDialogEx* m_BuildingDlg;
CDialogEx* m_BuildingEditDlg;
CListBox* m_BuildingBox;

CDialogEx* m_SpellDlg;
CDialogEx* m_SpellEditDlg;
CListBox* m_SpellBox;

CDialogEx* m_UnitsDlg;
CDialogEx* m_UnitsEditDlg;
CListBox* m_UnitsBox;

CDialogEx* m_RaceDataDlg;
CDialogEx* m_RaceDataEditDlg;
CListBox* m_RaceDataBox;

CDialogEx* m_UpkeepDlg;
CDialogEx* m_UpkeepEditDlg;
CListBox* m_UpkeepBox;

CDialogEx* m_HeroStatsDlg;
CDialogEx* m_HeroStatsEditDlg;
CListBox* m_HeroStatsBox;

CDialogEx* m_HealingDlg;

CDialogEx* m_RetortDlg;

CDialogEx* m_GoldManaDlg;

CDialogEx* m_SpellIDDlg;

CDialogEx* m_WizardPicksDlg;

CDialogEx* m_ItemRewardsDlg;

CDialogEx* m_CityDistanceDlg;

CDialogEx* m_RetortEffectsDlg;

CDialogEx* m_SpellChargesDlg;

CDialogEx* m_CreateItemDlg;

CDialogEx* m_ItemMaximumDlg;

CDialogEx* m_DestroyedItemsDlg;

CDialogEx* m_SpellsPerBookDlg;

CDialogEx* m_RandomEventsDlg;

CDialogEx* m_MapGenerationDlg;

CDialogEx* m_BookResearchDlg;

CDialogEx* m_HireHeroDlg;

CDialogEx* m_HireMercDlg;

CDialogEx* m_ItemBuyChanceDlg;

CDialogEx* m_MiscDlg;

CDialogEx* m_FoodBonusesDlg;

void CallMessageBox(string a = "",string b = "",string c = "", string d = "",string e = "",string f = "",string g = "",string h = "",string i = "",string j = "",string k = "",string l = "")
{
	a.append(b);//2
	a.append(c);//3
	a.append(d);//4
	a.append(e);//5
	a.append(f);//6
	a.append(g);//7
	a.append(h);//8
	a.append(i);//9
	a.append(j);//10
	a.append(k);//11
	a.append(l);//12
   MessageBox(NULL,a.c_str()," ",NULL);
}
