Skip to content

Commit

Permalink
Make DNA and DNAFactory internal, reduce intereface use
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains committed Dec 15, 2024
1 parent 6fb0c2a commit 97498d7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ImperatorToCK3/CK3/Characters/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public string? DeathReason {

public IDictionary<string, string> PrisonerIds { get; } = new Dictionary<string, string>(); // <prisoner id, imprisonment type>

public DNA? DNA { get; set; }
internal DNA? DNA { get; set; }

public Imperator.Characters.Character? ImperatorCharacter { get; set; }

Expand Down Expand Up @@ -355,7 +355,7 @@ Configuration config
}
}

public Character(
internal Character(
Imperator.Characters.Character impCharacter,
CharacterCollection characters,
ReligionMapper religionMapper,
Expand Down
4 changes: 2 additions & 2 deletions ImperatorToCK3/CK3/Characters/CharacterCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace ImperatorToCK3.CK3.Characters;

public sealed partial class CharacterCollection : ConcurrentIdObjectCollection<string, Character> {
public void ImportImperatorCharacters(
internal void ImportImperatorCharacters(
Imperator.World impWorld,
ReligionMapper religionMapper,
CultureMapper cultureMapper,
Expand Down Expand Up @@ -811,7 +811,7 @@ public void GenerateSuccessorsForOldCharacters(Title.LandedTitles titles, Cultur
});
}

public void ConvertImperatorCharacterDNA(DNAFactory dnaFactory) {
internal void ConvertImperatorCharacterDNA(DNAFactory dnaFactory) {
Logger.Info("Converting Imperator character DNA to CK3...");
foreach (var character in this) {
if (character.ImperatorCharacter is null) {
Expand Down
10 changes: 5 additions & 5 deletions ImperatorToCK3/CK3/Characters/DNA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace ImperatorToCK3.CK3.Characters;

public sealed class DNA {
public sealed class PaletteCoordinates {
internal sealed class DNA {
internal sealed class PaletteCoordinates {
// hair, skin and eye color palettes are 256x256
public int X { get; init; } = 128;
public int Y { get; init; } = 128;
Expand All @@ -32,9 +32,9 @@ public IEnumerable<string> DNALines {

public DNA(
string id,
IDictionary<string, DNAColorGeneValue> colorDNAValues,
IDictionary<string, DNAGeneValue> morphDNAValues,
IDictionary<string, DNAAccessoryGeneValue> accessoryDNAValues
Dictionary<string, DNAColorGeneValue> colorDNAValues,
Dictionary<string, DNAGeneValue> morphDNAValues,
Dictionary<string, DNAAccessoryGeneValue> accessoryDNAValues
) {
Id = id;
this.colorDNAValues = new(colorDNAValues);
Expand Down
6 changes: 3 additions & 3 deletions ImperatorToCK3/CK3/Characters/DNAFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace ImperatorToCK3.CK3.Characters;

public sealed class DNAFactory {
internal sealed class DNAFactory {
private readonly IPixelCollection<ushort> irHairPalettePixels;
private readonly IPixelCollection<ushort> irSkinPalettePixels;
private readonly IPixelCollection<ushort> irEyePalettePixels;
Expand Down Expand Up @@ -69,7 +69,7 @@ public DNAFactory(ModFilesystem irModFS, ModFilesystem ck3ModFS) {
BuildColorConversionCaches(ck3HairPalettePixels, ck3SkinPalettePixels, ck3EyePalettePixels);
}

public DNA GenerateDNA(Imperator.Characters.Character irCharacter, PortraitData irPortraitData) {
internal DNA GenerateDNA(Imperator.Characters.Character irCharacter, PortraitData irPortraitData) {
var id = $"dna_{irCharacter.Id}";

var colorDNAValues = new Dictionary<string, DNAColorGeneValue>();
Expand Down Expand Up @@ -463,7 +463,7 @@ IPixelCollection<ushort> ck3EyePalettePixels

private static void BuildColorConversionCache(
IPixelCollection<ushort> ck3PalettePixels,
IDictionary<IMagickColor<ushort>, DNA.PaletteCoordinates> ck3ColorToCoordinatesDict
ConcurrentDictionary<IMagickColor<ushort>, DNA.PaletteCoordinates> ck3ColorToCoordinatesDict
) {
foreach (var pixel in ck3PalettePixels) {
var color = pixel.ToColor();
Expand Down

0 comments on commit 97498d7

Please sign in to comment.