Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions Source.Engine/DtEncode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ public void CopyVars(ref readonly DecodeInfo decodeInfo) {
}
}

public static class PackedEntitiesManager
{
public static ReadOnlySpan<char> GetObjectClassName(int objectID) => "[unknown]";
}

public delegate void EncodeFn(object instance, ref DVariant var, SendProp prop, bf_write writeOut, int objectID);
public delegate void DecodeFn(ref DecodeInfo info);
public delegate int CompareDeltasFn(SendProp prop, bf_read p1, bf_read p2);
Expand Down Expand Up @@ -87,13 +82,13 @@ public static void EncodeFloat(SendProp prop, float incoming, bf_write outBuffer
val = 0;

if ((flags & PropFlags.RoundUp) == 0)
Warning($"(class {PackedEntitiesManager.GetObjectClassName(objectID)}): Out-of-range value ({incoming} < {prop.LowValue}) in SendPropFloat '{prop.FieldInfo}', clamping.\n");
Warning($"(class {Server.PackedEntities.GetObjectClassName(objectID)}): Out-of-range value ({incoming} < {prop.LowValue}) in SendPropFloat '{prop.GetName()}', clamping.\n");
}
else if (incoming > prop.HighValue) {
val = (uint)((1 << prop.Bits) - 1);

if ((flags & PropFlags.RoundDown) == 0)
Warning($"(class {PackedEntitiesManager.GetObjectClassName(objectID)}): Out-of-range value ({incoming} > {prop.HighValue}) in SendPropFloat '{prop.FieldInfo}', clamping.\n");
Warning($"(class {Server.PackedEntities.GetObjectClassName(objectID)}): Out-of-range value ({incoming} > {prop.HighValue}) in SendPropFloat '{prop.GetName()}', clamping.\n");
}
else {
float fRangeVal = (incoming - prop.LowValue) * prop.HighLowMul;
Expand Down
7 changes: 5 additions & 2 deletions Source.Engine/Server/PackedEntities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,10 @@ public static void WriteClassInfos(ServerClass clases, bf_write buffer) {
msg.WriteToBuffer(buffer);
}

static ReadOnlySpan<char> GetObjectClassName(int objectId) {
throw new NotImplementedException();
public static ReadOnlySpan<char> GetObjectClassName(int objectId) {
if (objectId >= 0 && objectId < sv.NumEdicts)
return sv.Edicts![objectId].GetClassName();
else
return "[unknown]";
}
}
Loading