I was decompiling an open-source project (because the source for the latest version hasn't been released yet). Using RedGate's Reflector tool, it gave me this block of code:
if(somecondition == true)
{
ref Vector3i vectoriRef;
float num17 = length - num;
Vector3i end = vectori3;
(vectoriRef = (Vector3i) &end)[1] = vectoriRef[1] - ((int) num17);
}
somecondition
is a boolean. length
and num
are floats defined outside the code. vectori3
is also defined outside the code and is of type Vector3i. The type Vector3i is essentially this code, but with x, y, and z stored as integers.
When I try to compile this decompiled code, I get the following errors:
Any thoughts on how I can fix this code so it compiles correctly and does whatever it was intended to do?
UPDATE: It turns out the source is available in their repository, but you have to follow a maze of links and clues to even find it. Thanks to everyone who posted!
At first glance
if (somecondition)
{
vectori3[1] -= (int)(length - num);
}
I'm not clear about the explicit reference syntax - I've never seen that before, and can't get VS to accept it - but the last line splits out into
vectoriRef = (Vector3i) &end;
vectoriRef[1] = vectoriRef[1] - ((int) num17);