/*
         * Towns:
         * Number| Tile
         * ------+-------------------
         * 0 | Grass
         * 1 | Desert
         * 2 | Water
         * 3 | Treasure Chest
         * 4 | Solid Stone Wall
         * 5 | Stairs Up
         * 6 | Red Brick Floor
         * 7 | Stairs Down
         * 8 | Forest
         * 9 | Poisonous Swamp
         * A | Barrier
         * B | Locked Door
         * C | Weapon Shop Sign
         * D | Inn Sign
         * E | Bridge
         * F | Desk
         */
        private void loadMap()
        {
            ClassDWBackend classDWBackend = new ClassDWBackend(path);

            string brecconaryHexData = classDWBackend.getBrecconaryData();

            int  x        = 1;
            bool hasError = false;

            foreach (char ch in brecconaryHexData)
            {
                try
                {
                    PictureBox currentPictureBox = (PictureBox)FormBrecconary.ActiveForm.Controls.Find("pictureBox" + x, true)[0];

                    switch (ch)
                    {
                    case '0':
                        currentPictureBox.Image     = Properties.Resources._0_grass;
                        currentPictureBox.Image.Tag = "0-Grass";
                        break;

                    case '1':
                        currentPictureBox.Image     = Properties.Resources._1_desert;
                        currentPictureBox.Image.Tag = "1-Desert";
                        break;

                    case '2':
                        currentPictureBox.Image     = Properties.Resources._2_water;
                        currentPictureBox.Image.Tag = "2-Water";
                        break;

                    case '3':
                        currentPictureBox.Image     = Properties.Resources._3_treasurechest;
                        currentPictureBox.Image.Tag = "3-TreasureChest";
                        break;

                    case '4':
                        currentPictureBox.Image     = Properties.Resources._4_solidstonewall2;
                        currentPictureBox.Image.Tag = "4-SolidStoneWall2";
                        break;

                    case '5':
                        currentPictureBox.Image     = Properties.Resources._5_stairsup;
                        currentPictureBox.Image.Tag = "5-StairsUp";
                        break;

                    case '6':
                        currentPictureBox.Image     = Properties.Resources._6_redbrickfloor;
                        currentPictureBox.Image.Tag = "6-RedBrickFloor";
                        break;

                    case '7':
                        currentPictureBox.Image     = Properties.Resources._7_stairsdown;
                        currentPictureBox.Image.Tag = "7-StairsDown";
                        break;

                    case '8':
                        currentPictureBox.Image     = Properties.Resources._8_forest;
                        currentPictureBox.Image.Tag = "8-Forest";
                        break;

                    case '9':
                        currentPictureBox.Image     = Properties.Resources._9_poisonousswamp;
                        currentPictureBox.Image.Tag = "9-PoisonousSwamp";
                        break;

                    case 'A':
                        currentPictureBox.Image     = Properties.Resources.a_barrier;
                        currentPictureBox.Image.Tag = "A-Barrier";
                        break;

                    case 'B':
                        currentPictureBox.Image     = Properties.Resources.b_lockeddoor;
                        currentPictureBox.Image.Tag = "B-LockedDoor";
                        break;

                    case 'C':
                        currentPictureBox.Image     = Properties.Resources.c_weaponshopsign;
                        currentPictureBox.Image.Tag = "C-WeaponShopSign";
                        break;

                    case 'D':
                        currentPictureBox.Image     = Properties.Resources.d_innsign;
                        currentPictureBox.Image.Tag = "D-InnSign";
                        break;

                    case 'E':
                        currentPictureBox.Image     = Properties.Resources.e_bridge;
                        currentPictureBox.Image.Tag = "E-Bridge";
                        break;

                    case 'F':
                        currentPictureBox.Image     = Properties.Resources.f_desk;
                        currentPictureBox.Image.Tag = "F-Desk";
                        break;

                    default:
                        break;
                    }

                    currentPictureBox.Refresh();
                    currentPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    currentPictureBox.Visible  = true;

                    x++;
                }
                catch (Exception ex)
                {
                    hasError = true;
                    break;
                }
            }

            if (hasError)
            {
                MessageBox.Show("Failed to populate map tiles. Try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }