Skip to content

Commit 310b7e1

Browse files
committed
Clean up some unnecessary code
1 parent 8097f14 commit 310b7e1

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

‎Concealment/Patches/PatchReplicableRequest.cs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ static class PatchReplicableRequest
2929

3030
public static void Patch(PatchContext ctx)
3131
{
32-
//temporarily disabled because BitStream.ResetRead is throwing dumbass exceptions
3332
ctx.GetPattern(_requestMethod).Prefixes.Add(typeof(PatchReplicableRequest).GetMethod(nameof(PrefixRequest)));
3433
}
3534

@@ -46,9 +45,6 @@ public static void PrefixRequest(MyPacket packet)
4645
var g = ConcealmentPlugin.Instance.ConcealedGroups.FirstOrDefault(gr => gr.Grids.Any(q => q.EntityId == id));
4746
if (g != null && add)
4847
ConcealmentPlugin.Instance.RevealGroup(g);
49-
50-
stream.ResetWrite();
51-
stream.ResetRead();
5248
}
5349
catch (Exception ex)
5450
{
@@ -57,7 +53,7 @@ public static void PrefixRequest(MyPacket packet)
5753
}
5854
finally
5955
{
60-
//this allows us to fail gracefully
56+
//resetting stream in finally clause allows us to fail gracefully
6157
packet.BitStream.ResetWrite();
6258
packet.BitStream.ResetRead();
6359
}

‎Concealment/Utilities.cs‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,9 @@ namespace Concealment
1212
{
1313
public static class Utilities
1414
{
15-
public static ConditionalWeakTable<MyEntity, IMyReplicable> _replicables = new ConditionalWeakTable<MyEntity, IMyReplicable>();
16-
1715
public static IMyReplicable GetReplicable(MyEntity entity)
1816
{
19-
if (_replicables.TryGetValue(entity, out IMyReplicable rep))
20-
return rep;
21-
22-
rep = MyExternalReplicable.FindByObject(entity);
23-
if(rep != null)
24-
_replicables.Add(entity, rep);
25-
return rep;
17+
return MyExternalReplicable.FindByObject(entity);
2618
}
2719
}
2820
}

0 commit comments

Comments
 (0)