Skip to content

Commit 379f819

Browse files
build fix for platforms that do not have default parameter support.
1 parent b2a2185 commit 379f819

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

box2d/b2InternalClasses.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,24 @@ public static T[] Create(int length, bool pow)
4949
return new T[length];
5050
}
5151

52+
#if WINDOWS_PHONE || XBOX
53+
public static void Resize(ref T[] array, int length)
54+
{
55+
Resize(ref array, length, true);
56+
}
57+
58+
public static void Resize(ref T[] array, int length, bool pow)
59+
{
60+
Free(array);
61+
array = Create(length, pow);
62+
}
63+
#else
5264
public static void Resize(ref T[] array, int length, bool pow = true)
5365
{
5466
Free(array);
5567
array = Create(length, pow);
5668
}
57-
69+
#endif
5870
public static void Free(T[] array)
5971
{
6072
PoolEntry entry;
@@ -106,7 +118,31 @@ public static void FreeAll()
106118
{
107119
_unuseIndex = 0;
108120
}
121+
#if WINDOWS_PHONE || XBOX
122+
public void Free()
123+
{
124+
Free(false);
125+
}
109126

127+
public void Free(bool skipAssert)
128+
{
129+
if (index < _unuseIndex - 1)
130+
{
131+
var tmp = _created[--_unuseIndex];
132+
133+
tmp.index = index;
134+
_created[index] = tmp;
135+
136+
index = _unuseIndex;
137+
_created[_unuseIndex] = (T)this;
138+
}
139+
else
140+
{
141+
_unuseIndex--;
142+
}
143+
}
144+
}
145+
#else
110146
public void Free(bool skipAssert = false)
111147
{
112148
if (index < _unuseIndex - 1)
@@ -125,6 +161,7 @@ public void Free(bool skipAssert = false)
125161
}
126162
}
127163
}
164+
#endif
128165

129166
internal class b2IntStack : b2ReusedObject<b2IntStack>
130167
{

0 commit comments

Comments
 (0)