boyserk84 / zombie-real-time-strategy-game

Automatically exported from code.google.com/p/zombie-real-time-strategy-game
0 stars 0 forks source link

Null exception when change the tile type #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Go to XNAUITestGame.cs
2. Modify Initilize() at line 80 change from cell.AddChild(new Grass()); to 
cell.AddChild(new Mountain())
3. Build and run the game
4. Null Exception raised when tell a unit to move.

What is the expected output? What do you see instead?
Expected out: game should behave the same regardless of type of tile. 
Output: Null Exception raised. Program crashed.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by nkem...@gmail.com on 4 Apr 2011 at 9:18

GoogleCodeExporter commented 9 years ago
This is likely because the mountain tile is not a tile type that you can move 
into, and a move command is likely being returned as null, and as a result 
there is a null object that should be surrounded by "if (varname != null).

I'll verify.

Original comment by marc.cel...@gmail.com on 4 Apr 2011 at 9:49

GoogleCodeExporter commented 9 years ago
PS If this is the case, the expected behavior is to move to the closest valid 
tile.

Original comment by marc.cel...@gmail.com on 4 Apr 2011 at 9:50