/// <summary> /// 지역 탐색 /// </summary> /// <param name="y"></param> /// <param name="x"></param> private void ScanArea(int y, int x) { if (y < 0 || y >= row || x < 0 || x >= col) { return; } if (Copy[y][x].UseFlag) { return; } else { if (Map[y][x].IsCheck == false) { Map[y][x].IsCheck = true; if (Copy[y][x].MineCountHint != null && Copy[y][x].MineCountHint > 0) { HintList.Add(new CellInfo(y, x, Copy[y][x].MineCountHint, true, false)); } if (Copy[y][x].MineCountHint == 0) { ScanArea(y - 1, x - 1); ScanArea(y - 1, x); ScanArea(y - 1, x + 1); ScanArea(y, x - 1); ScanArea(y, x + 1); ScanArea(y + 1, x - 1); ScanArea(y + 1, x); ScanArea(y + 1, x + 1); } } } }
public virtual bool LoadHintList(params long[] hintNums) // Note: Hint numbers are 1-based { var result = true; try { var line = ""; var hintDatFile = Globals.Path.Combine(AdventureFolderPath, "HINTDIR.DAT"); using (var file = new System.IO.StreamReader(hintDatFile)) { line = file.ReadLine(); if (!long.TryParse(line.Trim(), out _nh)) { throw new Exception("Error: TryParse function call failed for _nh"); } for (var i = 0; i < _nh; i++) { var hint = new EDXHint(); line = file.ReadLine(); hint.Question = line.Trim(); line = file.ReadLine(); var tokens = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (!long.TryParse(tokens[0], out hint._hptr)) { throw new Exception(string.Format("Error: TryParse function call failed for record number {0} _hptr", i)); } if (tokens.Length > 1) { if (!long.TryParse(tokens[1], out hint._nh)) { throw new Exception(string.Format("Error: TryParse function call failed for record number {0} _nh", i)); } } else { line = file.ReadLine(); if (!long.TryParse(line.Trim(), out hint._nh)) { throw new Exception(string.Format("Error: TryParse function call failed for record number {0} _nh", i)); } } if (hintNums == null || hintNums.Length <= 0 || hintNums.Contains(i + 1)) { HintList.Add(hint); } } } } catch (Exception ex) { ErrorMessage = ex.Message; result = false; } return(result); }
private void AddHintList(int y, int x, int?hintValue, bool useFlag) { HintList.Add(new CellInfo(y, x, hintValue, true, useFlag)); Map[y][x].IsCheck = true; }