git-svn-id: https://bd85.net/svn/cs3505_group@152 92bb83a3-7c8f-8a45-bc97-515c4e399668
authorCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Mon, 26 Apr 2010 18:13:03 +0000 (18:13 +0000)
committerCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Mon, 26 Apr 2010 18:13:03 +0000 (18:13 +0000)
CarFire/CarFire/CarFire/Game.cs
CarFire/CarFire/CarFire/Map.cs
CarFire/CarFire/CarFire/PathFinder.cs

index a269367..7a1971c 100644 (file)
@@ -333,6 +333,7 @@ namespace CarFire
             State.mDisplay = new Display(this);\r
             State.mDisplay.LoadContent(mContentManager);\r
 \r
+            // Load the tilemap.\r
             Texture2D mapTiles = mContentManager.Load<Texture2D>("graphics/wallAndFloorTilesNoEdgeScale");\r
             Tilemap tilemap = new Tilemap(mapTiles, 10, 7);\r
             tilemap.SetTile(' ', new Point(4, 5), TileFlags.Default);\r
@@ -368,12 +369,13 @@ namespace CarFire
             tilemap.SetTile('>', new Point(7, 5), TileFlags.Default);\r
             tilemap.SetTile('/', new Point(8, 5), TileFlags.Default);\r
             tilemap.SetTile('?', new Point(9, 5), TileFlags.Default);\r
+            Map.Tilemap = tilemap;\r
 \r
+            // Load the first map.\r
             State.Map = mContentManager.Load<Map>("Maps/level1");\r
-            State.Map.Tilemap = tilemap;\r
             State.Entities = State.Map.GetAllEntities(this);\r
 \r
-            State.AIData = new AI(this);\r
+            //State.AIData = new AI(this);\r
 \r
             /*\r
             mPlayers.Clear();\r
index ae49c8a..bc3fbbf 100644 (file)
@@ -136,11 +136,7 @@ namespace CarFire
         /// character to coordinate mappings.  This effects what the map looks\r
         /// like when it is drawn.\r
         /// </summary>\r
-        public Tilemap Tilemap\r
-        {\r
-            get { return mData.Tilemap; }\r
-            set { mData.Tilemap = value; }\r
-        }\r
+        public static Tilemap Tilemap;\r
 \r
         /// <summary>\r
         /// Get and set the zoom of the map view.  The default zoom is\r
@@ -355,7 +351,6 @@ namespace CarFire
             public List<RawEntity> Entities { get { return mEntities; } }\r
             public Point[] PlayerPositions { get { return mPlayerPositions; } }\r
             public bool[,] Grid { get { return mBooleanGrid; } }\r
-            public Tilemap Tilemap;\r
 \r
 \r
             public Model(Metadata metadata, char[,] grid, char defaultTile,\r
@@ -365,6 +360,7 @@ namespace CarFire
                 Debug.Assert(grid != null);\r
                 Debug.Assert(entities != null);\r
                 Debug.Assert(metadata.GridWidth * metadata.GridHeight == grid.Length);\r
+                Debug.Assert(Tilemap != null);\r
 \r
                 mMetadata = metadata;\r
                 mCleanGrid = grid;\r
@@ -542,14 +538,14 @@ namespace CarFire
 \r
             public void Draw(SpriteBatch spriteBatch)\r
             {\r
-                if (mData.Tilemap == null) throw new Exception("Cannot draw map without first setting the tilemap.");\r
+                if (Tilemap == null) throw new Exception("Cannot draw map without first setting the tilemap.");\r
                 mViewport = spriteBatch.GraphicsDevice.Viewport;\r
 \r
                 for (int y = 0; y < mData.Metadata.GridHeight; y++)\r
                 {\r
                     for (int x = 0; x < mData.Metadata.GridWidth; x++)\r
                     {\r
-                        mData.Tilemap.Draw(spriteBatch, mData.GetCell(x, y), GetRectangleFromCoordinates(x, y));\r
+                        Tilemap.Draw(spriteBatch, mData.GetCell(x, y), GetRectangleFromCoordinates(x, y));\r
                     }\r
                 }\r
             }\r
index c37e518..02c645c 100644 (file)
@@ -152,13 +152,12 @@ namespace CarFire
 #endif\r
                 foreach (Point point in neighbors)\r
                 {\r
-                    Cell inQueue = mCells[point.X, point.Y];\r
-\r
                     if (0 <= point.X && point.X < mGridWidth && 0 <= point.Y && point.Y < mGridHeight &&\r
                         mGrid[point.X, point.Y])\r
                     {\r
                         int cost = cell.G + costFunction(cell.Point, point);\r
 \r
+                        Cell inQueue = mCells[point.X, point.Y];\r
                         if (inQueue == null)\r
                         {\r
                             Cell neighbor = new Cell(point, cost, heuristic(point, finish), cell);\r
This page took 0.028658 seconds and 4 git commands to generate.