Core/Refactor: Part 2

This commit is contained in:
hondacrx
2018-05-07 22:07:35 -04:00
parent 216db1c23a
commit 9b40067017
93 changed files with 321 additions and 388 deletions
@@ -168,15 +168,16 @@ namespace Game.DataStorage
continue;
}
Func<uint, uint> ValidateAndSetCurve = value =>
uint ValidateAndSetCurve(uint value)
{
if (value != 0 && !CliDB.CurveStorage.ContainsKey(value))
{
Log.outError(LogFilter.Sql, "Table `spell_areatrigger` has listed areatrigger (MiscId: {0}, Id: {1}) with invalid Curve ({2}), set to 0!", miscTemplate.MiscId, areatriggerId, value);
return 0;
}
return value;
};
}
miscTemplate.MoveCurveId = ValidateAndSetCurve(areatriggerSpellMiscs.Read<uint>(2));
miscTemplate.ScaleCurveId = ValidateAndSetCurve(areatriggerSpellMiscs.Read<uint>(3));
@@ -720,13 +720,8 @@ namespace Game.DataStorage
public FieldStructureEntry(short bits, ushort offset)
{
this.Bits = bits;
this.Offset = offset;
}
public void SetLength(FieldStructureEntry nextField)
{
this.Length = Math.Max(1, (int)Math.Floor((nextField.Offset - this.Offset) / (double)this.ByteCount));
Bits = bits;
Offset = offset;
}
}
@@ -755,13 +750,13 @@ namespace Game.DataStorage
struct OffsetDuplicate
{
public int HiddenIndex { get; set; }
public int VisibleIndex { get; set; }
public int HiddenIndex { get; }
public int VisibleIndex { get; }
public OffsetDuplicate(int hidden, int visible)
{
this.HiddenIndex = hidden;
this.VisibleIndex = visible;
HiddenIndex = hidden;
VisibleIndex = visible;
}
}
+1 -1
View File
@@ -174,7 +174,7 @@ namespace Game.DataStorage
uint oldMSTime = Time.GetMSTime();
foreach (CinematicCameraRecord cameraEntry in CliDB.CinematicCameraStorage.Values)
{
string filename = dataPath + "/cameras/" + string.Format("FILE{0:x8}.xxx", cameraEntry.FileDataID);
string filename = dataPath + "/cameras/" + $"FILE{cameraEntry.FileDataID:x8}.xxx";
try
{