public BCMHubCell([NotNull] RWG2.HubCell hubCell, Vector2i gridPos) { GridPos = new BCMVector2(gridPos); CellRule = hubCell.CellRule.Name; HubRule = hubCell.HubRule.Name; WildernessRule = hubCell.WildernessRule.Name; //WILDERNESS LOTS var wildLots = hubCell.lots; if (wildLots != null) { foreach (var wl in wildLots) { Lots.Add(new BCMLot(wl, BCMLotType.Wilderness)); } } //HUB LOTS var hubLots = new List <RWG2.HubCell.Lot>(); if (hubCell.HubGenerator != null) { var lots = hubCell.HubGenerator.GetLots(); if (lots != null) { hubLots = lots; } Township = hubCell.HubGenerator.township.ToString(); } foreach (var hl in hubLots) { Lots.Add(new BCMLot(hl, BCMLotType.Hub)); } }
private void GetHubCellData() { GetCellsRange(out int r, out int xOff, out int yOff); var hcdDir = GameUtils.GetSaveGameDir() + "/HubCellData/"; for (var x = -r + xOff; x <= r + xOff; x++) { for (var y = -r + yOff; y <= r + yOff; y++) { var gridPos = new Vector2i(x, y); if (_loaded.Contains(gridPos)) { continue; } var hcdFile = string.Format($"{hcdDir}{x}.{y}.hcd"); if (!File.Exists(hcdFile)) { continue; } var binaryReader = new BinaryReader(File.OpenRead(hcdFile)); var hubCell = new RWG2.HubCell(gridPos); hubCell.Read(binaryReader); binaryReader.Close(); _loaded.Add(gridPos); _hubCellData.Add(new BCMHubCell(hubCell, gridPos)); } } }