Skip to content

Commit ac2351c

Browse files
committed
fix writing enum string
1 parent 3bc573a commit ac2351c

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

CathodeLib/Scripts/CATHODE/Commands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ override protected bool SaveInternal()
705705
for (int i = 0; i < parameters.Count; i++)
706706
{
707707
parameterOffsets.Add(parameters[i], (int)writer.BaseStream.Position / 4);
708-
Utilities.Write<ShortGuid>(writer, CommandsUtils.GetDataTypeGUID(parameters[i].dataType));
708+
Utilities.Write<ShortGuid>(writer, CommandsUtils.GetDataTypeGUID(parameters[i].dataType == DataType.ENUM_STRING ? DataType.STRING : parameters[i].dataType));
709709
switch (parameters[i].dataType)
710710
{
711711
case DataType.TRANSFORM:

CathodeLib/Scripts/CATHODE/CommandsPAK/Components/ParameterData.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public ParameterData(DataType type)
4646
case DataType.VECTOR:
4747
return ((cVector3)x).value == ((cVector3)y).value;
4848
case DataType.ENUM:
49-
cEnum x_e = (cEnum)x;
50-
cEnum y_e = (cEnum)y;
51-
return x_e.enumIndex == y_e.enumIndex && x_e.enumID == y_e.enumID;
49+
return ((cEnum)x).enumIndex == ((cEnum)y).enumIndex && ((cEnum)x).enumID == ((cEnum)y).enumID;
50+
case DataType.ENUM_STRING:
51+
return ((cEnumString)x).value == ((cEnumString)y).value && ((cEnumString)x).enumID == ((cEnumString)y).enumID;
5252
case DataType.SPLINE:
5353
return ((cSpline)x).splinePoints == ((cSpline)y).splinePoints;
5454
case DataType.NONE:
@@ -89,8 +89,9 @@ public override int GetHashCode()
8989
case DataType.VECTOR:
9090
return ((cVector3)this).value.GetHashCode();
9191
case DataType.ENUM:
92-
cEnum x_e = (cEnum)this;
93-
return x_e.enumID.ToByteString().GetHashCode() + x_e.enumIndex;
92+
return ((cEnum)this).enumID.ToByteString().GetHashCode() + ((cEnum)this).enumIndex;
93+
case DataType.ENUM_STRING:
94+
return ((cEnumString)this).enumID.ToByteString().GetHashCode() + ((cEnumString)this).value.GetHashCode();
9495
case DataType.SPLINE:
9596
cSpline x_sd = (cSpline)this;
9697
int x_sd_i = 0;

0 commit comments

Comments
 (0)