Skip to content

Commit d9b2d0c

Browse files
committed
Minor fix in case of shared indexes on direct nil shifts.
1 parent b021819 commit d9b2d0c

2 files changed

Lines changed: 3 additions & 31 deletions

File tree

Source/Program.cs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
using Source.Missiles;
33
using WCSharp.Api;
44
using WCSharp.Events;
5-
using WCSharp.Missiles;
6-
using WCSharp.Shared;
7-
using WCSharp.Sync;
8-
using WCSharp.Timers;
95
using static WCSharp.Api.Common;
106

117
namespace Source
@@ -25,32 +21,8 @@ public static void Main()
2521

2622
private static void Start()
2723
{
28-
PlayerUnitEvents.EnableDebug();
29-
SyncSystem.EnableDebug();
30-
Delay.EnableDebug();
31-
TimerSystem.EnableDebug();
32-
33-
TimerSystem.SetTickInterval(1f / 64);
34-
MissileSystem.SetTickInterval(1f / 64);
35-
36-
var t = timer.Create();
37-
t.Start(5f, true, () =>
38-
{
39-
var interval = TimerSystem.TickInterval > 0 ? 0 : TimerSystem.DEFAULT_TICK_INTERVAL;
40-
TimerSystem.SetTickInterval(interval);
41-
Console.WriteLine(interval);
42-
});
43-
4424
var hfoo = unit.Create(player.Create(0), FourCC("hfoo"), 0, 0, 270);
45-
46-
var trials = 1000;
47-
var sw = Os.Clock();
48-
49-
sw = Os.Clock();
50-
for (var i = 0; i < trials; i++)
51-
{
52-
}
53-
Console.WriteLine($"Baseline: {Os.Clock() - sw}");
25+
PlayerUnitEvents.Register(UnitEvent.Damaging, () => Console.WriteLine("!"), hfoo);
5426

5527
Arcing.Initialise();
5628
Curving.Initialise();

WCSharp.Shared/Extensions/SpecializedExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static class SpecializedExtensions
4141
/// <param name="list">The list to modify.</param>
4242
/// <param name="index">The index to move the final item to.</param>
4343
/// <param name="count">This should always be equal to <see cref="List{T}.Count"/>.</param>
44-
/// @CSharpLua.Template = "{0}[{1}], {0}[{2}] = {0}[{2}], nil"
44+
/// @CSharpLua.Template = "{0}[{2}], {0}[{1}] = nil, {0}[{2}]"
4545
[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
4646
public static extern void DirectNilShift<T>(this List<T> list, int index, int count);
4747

@@ -108,7 +108,7 @@ public static class SpecializedExtensions
108108
/// <param name="list">The list to modify.</param>
109109
/// <param name="first">The first index.</param>
110110
/// <param name="second">The second index.</param>
111-
/// @CSharpLua.Template = "{0}[{1}], {0}[{2}] = {0}[{2}], {0}[{1}]"
111+
/// @CSharpLua.Template = "{0}[{2}], {0}[{1}] = {0}[{1}], {0}[{2}]"
112112
[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
113113
public static extern void DirectSwap<T>(this IList<T> list, int first, int second);
114114

0 commit comments

Comments
 (0)