Skip to content

Commit

Permalink
fix for species with no color information (fixes #1278)
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Jul 18, 2022
1 parent 2b9b886 commit 76f3c00
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ARKBreedingStats/species/CreatureColored.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal static string SpeciesImageName(string speciesName, bool replacePolar =
/// Returns the image file path to the image with the according colorization.
/// </summary>
private static string ColoredCreatureCacheFilePath(string speciesName, byte[] colorIds, bool listView = false)
=> Path.Combine(_imgCacheFolderPath, speciesName.Substring(0, Math.Min(speciesName.Length, 5)) + "_" + Convert.ToBase64String(colorIds.Select(ci => (byte)ci).Concat(Encoding.UTF8.GetBytes(speciesName)).ToArray()).Replace('/', '-') + (listView ? "_lv" : string.Empty) + Extension);
=> Path.Combine(_imgCacheFolderPath, speciesName.Substring(0, Math.Min(speciesName.Length, 5)) + "_" + Convert.ToBase64String(colorIds.Select(ci => ci).Concat(Encoding.UTF8.GetBytes(speciesName)).ToArray()).Replace('/', '-') + (listView ? "_lv" : string.Empty) + Extension);

/// <summary>
/// Checks if an according species image exists in the cache folder, if not it tries to creates one. Returns false if there's no image.
Expand Down Expand Up @@ -79,7 +79,7 @@ public static Bitmap GetColoredCreature(byte[] colorIds, Species species, bool[]
if (string.IsNullOrEmpty(species?.name))
onlyColors = true;
else
speciesName = SpeciesImageName(species?.name);
speciesName = SpeciesImageName(species.name);

if (onlyColors || string.IsNullOrEmpty(ImageFolder))
return DrawPieChart(colorIds, enabledColorRegions, size, pieSize);
Expand Down Expand Up @@ -461,7 +461,7 @@ private static bool ApplyColorsUnsafe(byte[][] rgb, bool[] enabledColorRegions,

public static string RegionColorInfo(Species species, byte[] colorIds)
{
if (species == null || colorIds == null) return null;
if (species?.colors == null || colorIds == null) return null;

var creatureRegionColors = new StringBuilder("Colors:");
var cs = species.colors;
Expand Down

0 comments on commit 76f3c00

Please sign in to comment.