static void PrintArea(ref Base.AreaBehaviour areaExamined)
        {
            int width  = areaExamined.GetLocationWidth();
            int height = areaExamined.GetLocationHeight();

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    Base.LocationTile lT = areaExamined.GetLocationTile(x, y);
                    Console.Write(lT.GetGround().ToString() + lT.GetStructure().ToString() + lT.GetStructureAttribute().ToString() + lT.GetIndividualInTile().ToString() + ";");
                }
                Console.Write("\n"); //New line
            }
        }
Beispiel #2
0
        static void LoadArea(ref StreamWriter sw, string area)
        {
            //translates string to the enumeration value of string.
            Base.AreaNames curArea;
            Enum.TryParse(area, out curArea);

            int xArea = 0;
            int yArea = 0;

            bool looping = true;

            for (int x = 0; x < Base.GameControl.areasInUse.GetLength(0) && looping; x++)
            {
                for (int y = 0; y < Base.GameControl.areasInUse.GetLength(1) && looping; y++)
                {
                    if (Base.GameControl.areasInUse[x, y].GetName() == curArea)
                    {
                        looping = false;
                        xArea   = x;
                        yArea   = y;
                    }
                }
            }

            int height = Base.GameControl.areasInUse[xArea, yArea].GetLocationHeight();
            int width  = Base.GameControl.areasInUse[xArea, yArea].GetLocationWidth();

            //sw.WriteLine("!Location ");
            sw.Flush();
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    Base.LocationTile lT = Base.GameControl.areasInUse[xArea, yArea].GetLocationTile(x, y);
                    sw.Write((int)lT.GetGround());
                    sw.Write((int)lT.GetStructure());
                    sw.Write((int)lT.GetStructureAttribute());
                    sw.Write((int)lT.GetIndividualInTile());
                    sw.Write(";");

                    //sw.Write(lT.GetGround().ToString() + lT.GetStructure().ToString() + lT.GetStructureAttribute().ToString() + lT.GetIndividualInTile().ToString() + ";");
                    sw.Flush();
                }
                sw.Write("\n");
                sw.Flush();
            }

            Console.WriteLine("Doing Individuals");
            //Individuals
            //ID number THEN name number
            sw.WriteLine("!Individuals");
            int individualCount = Base.GameControl.areasInUse[xArea, yArea].GetTotalIndividual();

            Console.WriteLine(individualCount);
            for (int i = 0; i < individualCount; i++)
            {
                Console.WriteLine("Doing Individual number" + i);
                int currentPerson = Base.GameControl.areasInUse[xArea, yArea].GetIndividual(i);
                sw.Write(currentPerson);
                sw.Write(" ");
                sw.Write((int)Base.GameControl.peopleDatabase[currentPerson].GetFirstName());
                sw.Write("\n");
                sw.Flush();
            }
            Console.WriteLine("Completed");
        }