/** * Add a list of detected ores to the tile. * # It checks if nothing has been detected so the tile can be marked empty. * # If the tile already has an ore set which matches any of the detected ores the quality is updated * # If the tile already has some results the results are merged. * # Otherwise the list is set. */ public int Add(List <Detected> detected) { foreach (Detected d in detected) { if (d.Type == TileType.Nothing) { // Nothing has been detected. Mark the tile as empty. Set(d); return(0); } else if (Found != null) { // The detected ore matches what's already there if (Found.Matches(d)) { // Update the quality if (Quality == Quality.Unknown && d.Quality != Quality.Unknown) { Found.Quality = d.Quality; } return(1); } } } // We already have something set for this tile but none of the detected ores matched it. // This should not happen so we just bail out here. if (Found != null) { return(0); } if (TileEstimate == null) { TileEstimate = new TileEstimate(); } TileEstimate.Add(detected); if (TileEstimate.Estimates.Count == 0) { return(0); } else { return(1); } }