protected void ChangeState(Map m, MapLoadingState state) { m.state = state; }
private void LoadTiles() { string mapfile = Path.Combine(mapfolder, "map"); state = MapLoadingStateSize.Instance; try { using (StreamReader sr = new StreamReader(mapfile)) { while (!sr.EndOfStream) { string[] line = sr.ReadLine().TrimEnd('\r', '\t', ' ', '\n').Split(' '); state.Load(line, this); } } } catch (FileNotFoundException ex) { throw new MapLoadException("Cannot find map file (" + mapfile + ")", ex); } catch (IndexOutOfRangeException ex) { throw new MapLoadException("Incorrect format", ex); } catch (Exception ex) { throw new MapLoadException("Exception during loading a map", ex); } }