using System.Diagnostics;\r
using Microsoft.Xna.Framework;\r
using Microsoft.Xna.Framework.Graphics;\r
+using System.Reflection;\r
\r
namespace CarFire\r
{\r
\r
#region Public Constants\r
\r
- public const float PixelsToUnitSquares = 64.0f;\r
+ public const float PixelsToUnitSquares = 8.0f;\r
\r
#endregion\r
\r
public int GridHeight;\r
}\r
\r
+ /// <summary>\r
+ /// The container class for information about an entity defined in the map.\r
+ /// </summary>\r
+ public class RawEntity\r
+ {\r
+ public char Id;\r
+ public Point Position;\r
+ public Dictionary<string, string> Attributes = new Dictionary<string, string>();\r
+ }\r
+\r
#endregion\r
\r
\r
// TODO: This should return whatever object we end up using for tilesets.\r
public string Tileset { get { return mData.Metadata.Tileset; } }\r
\r
+ /// <summary>\r
+ /// Get a list of the raw entity containers loaded with the map.\r
+ /// </summary>\r
+ public List<RawEntity> RawEntities { get { return mData.Entities; } }\r
+\r
\r
/// <summary>\r
/// Get and set the coordinate of the grid cell that should be in\r
/// Construct a map with the provided map data.\r
/// </summary>\r
/// <param name="data">Map data.</param>\r
- public Map(Metadata metadata, char[,] grid, Dictionary<char, Dictionary<string, string>> entities)\r
+ public Map(Metadata metadata, char[,] grid, List<RawEntity> entities)\r
{\r
mData = new Modal(metadata, grid, entities);\r
mView = new View(mData);\r
/// <summary>\r
/// Determine whether or not a cell can be occupied by a game entity.\r
/// </summary>\r
- /// <param name="x">X,Y-coordinates.</param>\r
+ /// <param name="point">X,Y-coordinates.</param>\r
/// <returns>True if cell can be occupied, false otherwise.</returns>\r
public bool IsCellOpen(Point point)\r
{\r
\r
\r
/// <summary>\r
- /// Get the entities loaded from the map file.\r
+ /// Get all the entities loaded from the map file. Exceptions could be\r
+ /// thrown if there are entities without associated classes.\r
/// </summary>\r
- /// <returns>Dictionary of entities. The keys are the entity\r
- /// identifiers and the value is a dictionary of key-value pairs\r
- /// associated with that entity.</returns>\r
- public Dictionary<char, Dictionary<string, string>> GetEntities()\r
+ /// <returns>List of entity objects loaded.</returns>\r
+ public List<object> GetAllEntities()\r
{\r
- return mData.Entities;\r
+ return mData.GetAllEntities();\r
+ }\r
+\r
+ /// <summary>\r
+ /// Get the entities of a certain type loaded from the map file. Exceptions\r
+ /// could be thrown if there are entities without associated classes.\r
+ /// </summary>\r
+ /// <typeparam name="T">Type of the entity you want a list of.</typeparam>\r
+ /// <returns>List of entity objects loaded.</returns>\r
+ public List<T> GetEntities<T>()\r
+ {\r
+ return mData.GetEntities<T>();\r
}\r
\r
#endregion\r
{\r
Metadata mMetadata;\r
char[,] mGrid;\r
- Dictionary<char, Dictionary<string, string>> mEntities;\r
+ List<RawEntity> mEntities;\r
\r
- public Modal(Metadata metadata, char[,] grid, Dictionary<char, Dictionary<string, string>> entities)\r
+ public Modal(Metadata metadata, char[,] grid, List<RawEntity> entities)\r
{\r
Debug.Assert(metadata != null);\r
Debug.Assert(grid != null);\r
\r
\r
public Metadata Metadata { get { return mMetadata; } }\r
- public Dictionary<char, Dictionary<string, string>> Entities { get { return mEntities; } }\r
+ public List<RawEntity> Entities { get { return mEntities; } }\r
\r
\r
public bool IsCellOpen(int x, int y)\r
// TODO: Still need to define characters for types of scenery.\r
return mGrid[x, y] == ' ';\r
}\r
+\r
+\r
+ public List<object> GetAllEntities()\r
+ {\r
+ List<object> list = new List<object>();\r
+\r
+ foreach (RawEntity raw in mEntities)\r
+ {\r
+ if (raw.Attributes.ContainsKey("type"))\r
+ {\r
+ string typename = raw.Attributes["type"];\r
+\r
+ object[] args = new object[3];\r
+ args[0] = raw.Id;\r
+ args[1] = raw.Position;\r
+ args[2] = raw.Attributes;\r
+\r
+ object entity = Activator.CreateInstance(System.Type.GetType("CarFire." + typename), args);\r
+ if (entity != null) list.Add(entity);\r
+ else Console.WriteLine("Entity of type " + typename + " not loaded because an entity class can't be found.");\r
+ }\r
+ else\r
+ {\r
+ Console.WriteLine("Ignoring entity with identifier " + raw.Id + " since it has no type key.");\r
+ }\r
+ }\r
+\r
+ return list;\r
+ }\r
+\r
+ public List<T> GetEntities<T>()\r
+ {\r
+ System.Type type = typeof(T);\r
+ List<T> list = new List<T>();\r
+\r
+ string typename = typeof(T).Name;\r
+ foreach (RawEntity raw in mEntities)\r
+ {\r
+ if (raw.Attributes.ContainsKey("type") && typename == raw.Attributes["type"])\r
+ {\r
+ object[] args = new object[3];\r
+ args[0] = raw.Id;\r
+ args[1] = raw.Position;\r
+ args[2] = raw.Attributes;\r
+\r
+ T entity = (T)Activator.CreateInstance(type, args);\r
+ if (entity != null) list.Add(entity);\r
+ else Console.WriteLine("Entity of type " + typename + " not loaded because an entity class can't be found.");\r
+ }\r
+ }\r
+\r
+ return list;\r
+ }\r
}\r
\r
class View\r
using Microsoft.Xna.Framework;\r
using Microsoft.Xna.Framework.Content;\r
using Microsoft.Xna.Framework.Graphics;\r
+using System.Reflection;\r
\r
namespace CarFire\r
{\r
\r
protected override Map Read(ContentReader input, Map existingInstance)\r
{\r
- mInput = new LineReader(input);\r
- ReadSectionHeaders();\r
- return new Map(mMetadata, mGrid, mEntities);\r
+ mImpl = new Impl(input);\r
+ return mImpl.GetMap();\r
}\r
\r
#endregion\r
\r
\r
- #region Private Methods\r
+ #region Private Types\r
\r
- void ReadSectionHeaders()\r
+ /// <summary>\r
+ /// This private class wraps around ContentReader to make it more\r
+ /// convenient to use it as an input stream reader.\r
+ /// </summary>\r
+ class LineReader\r
{\r
- mMetadata = new Map.Metadata();\r
+ ContentReader mInput;\r
+ int mLineNumber = 0;\r
+ int mExpectedNumberOfLines;\r
+\r
+ public LineReader(ContentReader input)\r
+ {\r
+ mInput = input;\r
+ mExpectedNumberOfLines = mInput.ReadInt32();\r
+ }\r
\r
- while (!mInput.End)\r
+ public string ReadLine()\r
{\r
- string line = mInput.ReadLine();\r
+ mLineNumber++;\r
+ return mInput.ReadString();\r
+ }\r
\r
- while (line != null)\r
+ public int LineNumber { get { return mLineNumber; } }\r
+\r
+ public bool End { get { return mLineNumber >= mExpectedNumberOfLines; } }\r
+ }\r
+\r
+\r
+ /// <summary>\r
+ /// This class is the actual implementation. The implementation is wrapped\r
+ /// in a subclass because the invoker seems to only be able to invoke public\r
+ /// methods, and this needs to invoke methods that shouldn't be public.\r
+ /// </summary>\r
+ class Impl\r
+ {\r
+ public Impl(ContentReader input)\r
+ {\r
+ mInput = new LineReader(input);\r
+ ReadSectionHeaders();\r
+ PostProcess();\r
+ }\r
+\r
+ public Map GetMap()\r
+ {\r
+ return new Map(mMetadata, mGrid, mEntities);\r
+ }\r
+\r
+\r
+ public void ReadSectionHeaders()\r
+ {\r
+ mMetadata = new Map.Metadata();\r
+\r
+ while (!mInput.End)\r
{\r
- if (!IsLineSignificant(line)) break;\r
+ string line = mInput.ReadLine();\r
\r
- string section = Parse.IniSectionHeader(line);\r
- if (section != null)\r
+ while (line != null)\r
{\r
- if (section == "metadata")\r
+ if (!IsLineSignificant(line)) break;\r
+\r
+ string section = Parse.IniSectionHeader(line);\r
+ if (section != null)\r
{\r
- line = ReadMetadataSection();\r
+ if (section == "metadata")\r
+ {\r
+ line = ReadMetadataSection();\r
+ }\r
+ else if (section == "maptable")\r
+ {\r
+ line = ReadMapTableSection();\r
+ }\r
+ else if (section.Length == 1 && IsValidEntityIdentifier(section[0]))\r
+ {\r
+ line = ReadEntitySection(section[0]);\r
+ }\r
+ else\r
+ {\r
+ throw new ParserException("Unexpected section on line " + mInput.LineNumber + ": " + section);\r
+ }\r
}\r
- else if (section == "maptable")\r
+ else\r
{\r
- line = ReadMapTableSection();\r
+ throw new ParserException("Unexpected text on line " + mInput.LineNumber + ": " + line);\r
}\r
- else if (section.Length == 1)\r
+ }\r
+ }\r
+ }\r
+\r
+ string ReadMetadataSection()\r
+ {\r
+ while (!mInput.End)\r
+ {\r
+ string line = mInput.ReadLine();\r
+ if (!IsLineSignificant(line)) continue;\r
+\r
+ string[] pair = Parse.KeyValuePair(line);\r
+ if (pair != null)\r
+ {\r
+ try\r
{\r
- line = ReadEntitySection(section[0]);\r
+ string methodName = "set_" + pair[0].ToLowerInvariant();\r
+ object[] args = new object[1];\r
+ args[0] = pair[1];\r
+ GetType().InvokeMember(methodName, BindingFlags.InvokeMethod, null, this, args);\r
}\r
- else\r
+#pragma warning disable 0168\r
+ catch (System.MissingMethodException ex)\r
+#pragma warning restore 0168\r
{\r
- throw new ParserException("Unexpected section on line " + mInput.LineNumber + ": " + section);\r
+ throw new ParserException("Unexpected key on line " + mInput.LineNumber + ": " + pair[0]);\r
}\r
}\r
else\r
{\r
- throw new ParserException("Unexpected text on line " + mInput.LineNumber + ": " + line);\r
+ return line;\r
}\r
}\r
+\r
+ return null;\r
}\r
- }\r
\r
- string ReadMetadataSection()\r
- {\r
- while (!mInput.End)\r
+ string ReadMapTableSection()\r
{\r
- string line = mInput.ReadLine();\r
- if (!IsLineSignificant(line)) continue;\r
+ if (mMetadata == null || mMetadata.GridWidth == 0 || mMetadata.GridHeight == 0)\r
+ {\r
+ throw new ParserException("Unexpected section on line " + mInput.LineNumber +\r
+ ": You must define the map dimensions before this section.");\r
+ }\r
\r
- string[] pair = Parse.KeyValuePair(line);\r
- if (pair != null)\r
+ mGrid = new char[mMetadata.GridWidth, mMetadata.GridHeight];\r
+\r
+ int y;\r
+ for (y = 0; y < mMetadata.GridHeight && !mInput.End; y++)\r
{\r
- if (pair[0] == "type")\r
+ string line = mInput.ReadLine();\r
+\r
+ if (line.Length < mMetadata.GridWidth)\r
{\r
- Map.Type type = Parse.Constant<Map.Type>(pair[1]);\r
- if (type != default(Map.Type))\r
- {\r
- mMetadata.Type = type;\r
- }\r
- else\r
- {\r
- throw new ParserException("Unexpected type on line " + mInput.LineNumber + ": " + pair[1]);\r
- }\r
+ throw new ParserException("Unexpected EOL on line " + mInput.LineNumber +\r
+ ": The number of characters should match the width dimension (" + mMetadata.GridWidth + ").");\r
}\r
- else if (pair[0] == "dimensions")\r
+\r
+ for (int x = 0; x < mMetadata.GridWidth; x++)\r
{\r
- Point? dimensions = Parse.Coordinates(pair[1]);\r
- if (dimensions != null)\r
- {\r
- mMetadata.GridWidth = dimensions.Value.X;\r
- mMetadata.GridHeight = dimensions.Value.Y;\r
- if (mMetadata.GridWidth <= 0 || mMetadata.GridHeight <= 0)\r
- {\r
- throw new ParserException("Invalid dimensions on line " + mInput.LineNumber + ": " + pair[1]);\r
- }\r
- }\r
- else\r
- {\r
- throw new ParserException("Unexpected value on line " + mInput.LineNumber + ": " + pair[1]);\r
- }\r
+ mGrid[x, y] = line[x];\r
}\r
- else if (pair[0] == "tileset")\r
+ }\r
+\r
+ if (y < mMetadata.GridHeight)\r
+ {\r
+ throw new ParserException("Unexpected EOF on line " + mInput.LineNumber +\r
+ ": The number of lines in this section should match the height dimension (" + mMetadata.GridHeight + ").");\r
+ }\r
+\r
+ return null;\r
+ }\r
+\r
+ string ReadEntitySection(char identifier)\r
+ {\r
+ Dictionary<string, string> pairs = new Dictionary<string, string>();\r
+ mEntitySections[identifier] = pairs;\r
+\r
+ while (!mInput.End)\r
+ {\r
+ string line = mInput.ReadLine();\r
+\r
+ string[] pair = Parse.KeyValuePair(line);\r
+ if (pair != null)\r
{\r
- string tileset = Parse.String(pair[1]);\r
- if (tileset != null)\r
- {\r
- mMetadata.Tileset = tileset;\r
- }\r
- else\r
- {\r
- throw new ParserException("Unexpected tileset on line " + mInput.LineNumber + ": " + pair[1]);\r
- }\r
+ pairs[pair[0]] = pair[1];\r
}\r
- else if (pair[0] == "numplayers")\r
+ else\r
{\r
- string[] list = Parse.List(pair[1]);\r
- if (list != null)\r
+ return line;\r
+ }\r
+ }\r
+\r
+ return null;\r
+ }\r
+\r
+\r
+ void PostProcess()\r
+ {\r
+ if (mMetadata == null || mGrid == null)\r
+ {\r
+ throw new ParserException("Missing a required section. Make sure the metadata and grid are there.");\r
+ }\r
+\r
+ mEntities = new List<Map.RawEntity>();\r
+ mPlayerPositions = new Point[mMetadata.NumPlayers.Max() + 1];\r
+\r
+ // create entities defined completely\r
+ foreach (char identifier in mEntitySections.Keys)\r
+ {\r
+ Dictionary<string, string> pairs = mEntitySections[identifier];\r
+ if (pairs.ContainsKey("create"))\r
+ {\r
+ string[] list = Parse.List(pairs["create"]);\r
+ foreach (string positionString in list)\r
{\r
- foreach (string atom in list)\r
+ Point? position = Parse.Coordinates(positionString);\r
+ if (position != null)\r
{\r
- int[] range = Parse.Range(atom);\r
- if (range != null)\r
- {\r
- for (int i = range[0]; i <= range[1]; i++)\r
- {\r
- mMetadata.NumPlayers.Add(i);\r
- }\r
- continue;\r
- }\r
- int? integer = Parse.Integer(atom);\r
- if (integer != null)\r
- {\r
- mMetadata.NumPlayers.Add(integer.Value);\r
- continue;\r
- }\r
-\r
- throw new ParserException("Unexpected atom on line " + mInput.LineNumber + ": " + atom);\r
+ Map.RawEntity createEntity = new Map.RawEntity();\r
+ createEntity.Id = identifier;\r
+ createEntity.Position = position.Value;\r
+ createEntity.Attributes = pairs;\r
+ mEntities.Add(createEntity);\r
}\r
- if (mMetadata.NumPlayers.Count == 0)\r
+ else\r
{\r
- throw new ParserException("No numbers given on line " + mInput.LineNumber + ": " + pair[1]);\r
+ throw new ParserException("Unexpected value of key `create' defined for entity " + identifier + ".");\r
}\r
}\r
- else\r
- {\r
- throw new ParserException("Unexpected value on line " + mInput.LineNumber + ": " + pair[1]);\r
- }\r
+ pairs.Remove("create");\r
}\r
- else if (pair[0] == "author")\r
- {\r
- string author = Parse.String(pair[1]);\r
- if (author != null)\r
- {\r
- mMetadata.Author = author;\r
- }\r
- else\r
- {\r
- throw new ParserException("Unexpected value on line " + mInput.LineNumber + ": " + pair[1]);\r
- }\r
- }\r
- else if (pair[0] == "levelname")\r
+ }\r
+\r
+ // create entities with positions defined on the grid\r
+ // and get player starting positions\r
+ for (int x = 0; x < mMetadata.GridWidth; x++)\r
+ {\r
+ for (int y = 0; y < mMetadata.GridHeight; y++)\r
{\r
- string level = Parse.String(pair[1]);\r
- if (level != null)\r
+ char identifier = mGrid[x, y];\r
+ if (IsValidEntityIdentifier(identifier))\r
{\r
- mMetadata.Name = level;\r
+ if (mEntitySections.ContainsKey(identifier))\r
+ {\r
+ Map.RawEntity createEntity = new Map.RawEntity();\r
+ createEntity.Id = identifier;\r
+ createEntity.Position = new Point(x, y);\r
+ createEntity.Attributes = mEntitySections[identifier];\r
+ mEntities.Add(createEntity);\r
+ }\r
+ else\r
+ {\r
+ throw new ParserException("Unexpected entity (" + identifier +\r
+ ") placed on the grid at [" + x + "," + y + "] but not defined.");\r
+ }\r
+ mGrid[x, y] = mDefaultTile;\r
}\r
- else\r
+ else if ('1' <= identifier && identifier <= '9')\r
{\r
- throw new ParserException("Unexpected value on line " + mInput.LineNumber + ": " + pair[1]);\r
+ int playerNum = identifier - 48;\r
+ if (playerNum < mPlayerPositions.Count())\r
+ {\r
+ mPlayerPositions[playerNum] = new Point(x, y);\r
+ }\r
+ mGrid[x, y] = mDefaultTile;\r
}\r
}\r
- else\r
- {\r
- throw new ParserException("Unexpected key on line " + mInput.LineNumber + ": " + pair[0]);\r
- }\r
}\r
- else\r
+\r
+ // check if all needed player positions are defined\r
+ for (int i = 1; i < mPlayerPositions.Count(); i++)\r
{\r
- return line;\r
+ if (mPlayerPositions[i] == default(Point))\r
+ {\r
+ throw new ParserException("Not enough player positions were defined on the grid; " +\r
+ "are missing a spot for player " + i + ".");\r
+ }\r
}\r
}\r
\r
- return null;\r
- }\r
\r
- string ReadMapTableSection()\r
- {\r
- if (mMetadata == null || mMetadata.GridWidth == 0 || mMetadata.GridHeight == 0)\r
+ bool IsLineSignificant(string line)\r
{\r
- throw new ParserException("Unexpected section on line " + mInput.LineNumber +\r
- ": You must define the map dimensions before this section.");\r
+ if (line.Trim().Length == 0 || Parse.IniComment(line) != null) return false;\r
+ return true;\r
}\r
\r
- mGrid = new char[mMetadata.GridWidth, mMetadata.GridHeight];\r
-\r
- int y;\r
- for (y = 0; y < mMetadata.GridHeight && !mInput.End; y++)\r
+ bool IsValidEntityIdentifier(char id)\r
{\r
- string line = mInput.ReadLine();\r
+ if (('a' <= id && id <= 'z') || ('A' <= id && id <= 'Z')) return true;\r
+ return false;\r
+ }\r
\r
- if (line.Length < mMetadata.GridWidth)\r
- {\r
- throw new ParserException("Unexpected EOL on line " + mInput.LineNumber +\r
- ": The number of characters should match the width dimension (" + mMetadata.GridWidth + ").");\r
- }\r
\r
- for (int x = 0; x < mMetadata.GridWidth; x++)\r
- {\r
- mGrid[x, y] = line[x];\r
- }\r
+ public void set_author(string atom)\r
+ {\r
+ string value = Parse.String(atom);\r
+ if (value != null) mMetadata.Author = value;\r
+ else throw new ParserException("Unexpected value on line " + mInput.LineNumber + ": " + atom);\r
}\r
\r
- if (y < mMetadata.GridHeight)\r
+ public void set_levelname(string atom)\r
{\r
- throw new ParserException("Unexpected EOF on line " + mInput.LineNumber +\r
- ": The number of lines in this section should match the height dimension (" + mMetadata.GridHeight + ").");\r
+ string value = Parse.String(atom);\r
+ if (value != null) mMetadata.Name = value;\r
+ else throw new ParserException("Unexpected value on line " + mInput.LineNumber + ": " + atom);\r
}\r
\r
- return null;\r
- }\r
-\r
- string ReadEntitySection(char entity)\r
- {\r
- Dictionary<string, string> pairs = new Dictionary<string, string>();\r
- mEntities[entity] = pairs;\r
-\r
- while (!mInput.End)\r
+ public void set_type(string atom)\r
{\r
- string line = mInput.ReadLine();\r
+ Map.Type value = Parse.Constant<Map.Type>(atom);\r
+ if (value != default(Map.Type)) mMetadata.Type = value;\r
+ else throw new ParserException("Unexpected type on line " + mInput.LineNumber + ": " + atom);\r
+ }\r
\r
- string[] pair = Parse.KeyValuePair(line);\r
- if (pair != null)\r
+ public void set_dimensions(string atom)\r
+ {\r
+ Point? dimensions = Parse.Coordinates(atom);\r
+ if (dimensions != null)\r
{\r
- pairs[pair[0]] = pair[1];\r
+ mMetadata.GridWidth = dimensions.Value.X;\r
+ mMetadata.GridHeight = dimensions.Value.Y;\r
+ if (mMetadata.GridWidth <= 0 || mMetadata.GridHeight <= 0)\r
+ {\r
+ throw new ParserException("Invalid dimensions on line " + mInput.LineNumber + ": " + atom);\r
+ }\r
}\r
else\r
{\r
- return line;\r
+ throw new ParserException("Unexpected value on line " + mInput.LineNumber + ": " + atom);\r
}\r
}\r
\r
- return null;\r
- }\r
-\r
-\r
- bool IsLineSignificant(string line)\r
- {\r
- if (line.Trim().Length == 0 || Parse.IniComment(line) != null) return false;\r
- return true;\r
- }\r
-\r
- #endregion\r
-\r
-\r
- #region Private Types\r
-\r
- /// <summary>\r
- /// This private class wraps around ContentReader to make it more\r
- /// convenient to use it as an input stream reader.\r
- /// </summary>\r
- class LineReader\r
- {\r
- ContentReader mInput;\r
- int mLineNumber = 0;\r
- int mExpectedNumberOfLines;\r
+ public void set_tileset(string atom)\r
+ {\r
+ string value = Parse.String(atom);\r
+ if (value != null) mMetadata.Tileset = value;\r
+ else throw new ParserException("Unexpected tileset on line " + mInput.LineNumber + ": " + atom);\r
+ }\r
\r
- public LineReader(ContentReader input)\r
+ public void set_defaulttile(string atom)\r
{\r
- mInput = input;\r
- mExpectedNumberOfLines = mInput.ReadInt32();\r
+ char? value = Parse.Char(atom);\r
+ if (value != null) mDefaultTile = value.Value;\r
+ else throw new ParserException("Unexpected tile value on line " + mInput.LineNumber + ": " + atom);\r
}\r
\r
- public string ReadLine()\r
+ public void set_numplayers(string atom)\r
{\r
- mLineNumber++;\r
- return mInput.ReadString();\r
+ string[] list = Parse.List(atom);\r
+ if (list != null)\r
+ {\r
+ foreach (string item in list)\r
+ {\r
+ int[] range = Parse.Range(item);\r
+ if (range != null)\r
+ {\r
+ for (int i = range[0]; i <= range[1]; i++)\r
+ {\r
+ mMetadata.NumPlayers.Add(i);\r
+ }\r
+ continue;\r
+ }\r
+ int? integer = Parse.Integer(item);\r
+ if (integer != null)\r
+ {\r
+ mMetadata.NumPlayers.Add(integer.Value);\r
+ continue;\r
+ }\r
+\r
+ throw new ParserException("Unexpected atom on line " + mInput.LineNumber + ": " + item);\r
+ }\r
+ if (mMetadata.NumPlayers.Count == 0)\r
+ {\r
+ throw new ParserException("No numbers given on line " + mInput.LineNumber + ": " + atom);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ throw new ParserException("Unexpected value on line " + mInput.LineNumber + ": " + atom);\r
+ }\r
}\r
\r
- public int LineNumber { get { return mLineNumber; } }\r
\r
- public bool End { get { return mLineNumber >= mExpectedNumberOfLines; } }\r
+ Map.Metadata mMetadata;\r
+ char[,] mGrid;\r
+ List<Map.RawEntity> mEntities;\r
+ Point[] mPlayerPositions;\r
+\r
+ Dictionary<char, Dictionary<string, string>> mEntitySections = new Dictionary<char, Dictionary<string, string>>();\r
+ char mDefaultTile = ' ';\r
+\r
+ LineReader mInput;\r
}\r
\r
#endregion\r
\r
#region Private Variables\r
\r
- Map.Metadata mMetadata;\r
- char[,] mGrid;\r
- Dictionary<char, Dictionary<string, string>> mEntities = new Dictionary<char, Dictionary<string, string>>();\r
-\r
- LineReader mInput;\r
+ Impl mImpl;\r
\r
#endregion\r
}\r