Skip to content

Commit

Permalink
refactor: Change typeDotName to a read-only property.
Browse files Browse the repository at this point in the history
  • Loading branch information
DaleStan committed Sep 9, 2024
1 parent ecaad44 commit 547311f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Yafc.Model/Data/DataClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public enum FactorioId { }
public abstract class FactorioObject : IFactorioObjectWrapper, IComparable<FactorioObject> {
public string? factorioType { get; internal set; }
public string name { get; internal set; } = null!; // null-forgiving: Initialized to non-null by GetObject.
public string typeDotName { get; internal set; } = null!; // null-forgiving: Initialized to non-null by ExportBuiltData.
public string typeDotName => type + '.' + name;
public string locName { get; internal set; } = null!; // null-forgiving: Copied from name if still null at the end of CalculateMaps
public string? locDescr { get; internal set; }
public FactorioIconPart[]? iconSpec { get; internal set; }
Expand Down
2 changes: 1 addition & 1 deletion Yafc.Parser/Data/FactorioDataDeserializer_Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private int Skip(int from, FactorioObjectSortOrder sortOrder) {

private void ExportBuiltData() {
Database.rootAccessible = rootAccessible.ToArray();
Database.objectsByTypeName = allObjects.ToDictionary(x => x.typeDotName = x.type + "." + x.name);
Database.objectsByTypeName = allObjects.ToDictionary(x => x.typeDotName);
foreach (var alias in formerAliases) {
_ = Database.objectsByTypeName.TryAdd(alias.Key, alias.Value);
}
Expand Down

0 comments on commit 547311f

Please sign in to comment.