I have a rather strange problem, for the life of me I can't figure out what I did wrong, but here goes.
I have an array of map tile information such as mapTile[i,n] really they're just strings containing the sprite sheet, and position of the tile that should be displayed. the strings are relatively small, maybe 7 chars long.
when I create a blank map, i write the first line containing the maps name, height and width, and the event file associated with the map.
then I loop through the tiles writing each on its own line, the problem is it cuts off at the same place each time, I'm not sure if there is a maximum number of lines etc, but I see no problem with my code. and it cuts off in the middle of a string. anyway heres my code:
C# |
Any help would be greatly appreciated.
I've been testing with a 100x100 map size. it cuts off at line 9898 and on that line only the first 4 char's are written.

Kirtan PatelRank #292 · 8.6K reputationPosted Jan 16, 2011, 5:34 PM EST
public void CreateNewMap(string Filename, int width, int height) { int count = 0; TextWriter tw = new StreamWriter(Filename + ".dat"); string firstline = Filename + "#" + width + "#" + height + "#72"; tw.WriteLine(firstline); for (int i = 0; i . { for (int n = 0; n "0;0;0#0"); count++; } } tw.Close(); MessageBox.Show(count.ToString()); }Michael Cline5 reputationPosted Jan 16, 2011, 6:08 PM EST
Kirtan PatelRank #292 · 8.6K reputationPosted Jan 16, 2011, 7:07 PM EST
Vijay YadavRank #1,637 · 943 reputationPosted Jan 18, 2011, 1:14 AM EST
Your code is running fine.
Check it once again
Thanks
Vijay
Sam HobbsRank #107 · 20.5K reputationPosted Jan 18, 2011, 10:58 AM EST
Also, try using a "using" block for files. It seems like a cumbersome thing to do and I don't like it but it is the C# way to do things. The purpose of a "using" block is to ensure that clean-up is done as needed.