Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public char[,] WaitForMap()
- {
- char[,] map = null;
- bool end = false;
- int r = 0;
- while (!end)
- {
- string line = reader.ReadLine();
- if (line == null)
- continue;
- string[] msg = line.Split(' ');
- switch (msg[0])
- {
- case "BEGIN_MAP":
- map = new char[int.Parse(msg[1]),int.Parse(msg[2])];
- break;
- case "END_MAP":
- end = true;
- break;
- default:
- if(map != null)
- {
- for (var c = 0; c < line.Length; c++)
- {
- map[c, r] = line[c];
- }
- r++;
- }
- break;
- }
- }
- return map;
- }
Advertisement
Add Comment
Please, Sign In to add comment