X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=CarFire%2FCarFire%2FCarFire%2FMap.cs;h=f3d59d4a705a6e2e341a0177cf4e87f23fb46f7f;hb=a67a04fbbf048dc08edd2ed726aa8c6da4c26a6b;hp=26b74e9ac8fa2d9c5f557c60ea8f1bb0f4c99f1e;hpb=8438a35a901cf43ef85f226f58b5627b376a23c4;p=chaz%2Fcarfire
diff --git a/CarFire/CarFire/CarFire/Map.cs b/CarFire/CarFire/CarFire/Map.cs
index 26b74e9..f3d59d4 100644
--- a/CarFire/CarFire/CarFire/Map.cs
+++ b/CarFire/CarFire/CarFire/Map.cs
@@ -48,7 +48,7 @@ namespace CarFire
#region Public Constants
- public const float PixelsToUnitSquares = 8.0f;
+ public const float PixelsToUnitSquares = 60.0f;
#endregion
@@ -154,9 +154,9 @@ namespace CarFire
/// The metadata.
/// The grid.
/// The entities.
- public Map(Metadata metadata, char[,] grid, List entities)
+ public Map(Metadata metadata, char[,] grid, List entities, Point[] playerPositions)
{
- mData = new Modal(metadata, grid, entities);
+ mData = new Modal(metadata, grid, entities, playerPositions);
mView = new View(mData);
}
@@ -236,6 +236,19 @@ namespace CarFire
}
+ ///
+ /// Get the starting position of a player.
+ ///
+ /// The number of the player (i.e. 1-4).
+ /// This number must be a valid player number.
+ /// The starting position of the player.
+ public Point GetStartingPositionForPlayer(int playerNumber)
+ {
+ Debug.Assert(1 <= playerNumber && playerNumber <= NumPlayers.Max());
+ return mData.PlayerPositions[playerNumber];
+ }
+
+
///
/// Get all the entities loaded from the map file. Exceptions could be
/// thrown if there are entities without associated classes.
@@ -267,8 +280,9 @@ namespace CarFire
Metadata mMetadata;
char[,] mGrid;
List mEntities;
+ Point[] mPlayerPositions;
- public Modal(Metadata metadata, char[,] grid, List entities)
+ public Modal(Metadata metadata, char[,] grid, List entities, Point[] playerPositions)
{
Debug.Assert(metadata != null);
Debug.Assert(grid != null);
@@ -278,6 +292,7 @@ namespace CarFire
mMetadata = metadata;
mGrid = grid;
mEntities = entities;
+ mPlayerPositions = playerPositions;
#if DEBUG
Console.WriteLine("Loaded map {0} of type {1} written by {2}.",
@@ -290,6 +305,7 @@ namespace CarFire
public Metadata Metadata { get { return mMetadata; } }
public List Entities { get { return mEntities; } }
+ public Point[] PlayerPositions { get { return mPlayerPositions; } }
public bool IsCellOpen(int x, int y)