C to vb.net problem

(1/3) > >>

CH4ØZ:
Bueno, tengo este C (en realidad es el peón, pero es un metamod de C) y el código i no se traducen en vb.net, alguien me puede ayudar con esto:

Código
GetPointZPos(Float: point_X, Float: point_Y, &Float: point_Z)
{
if(!(-3000.0 < point_X < 3000.0 || -3000.0 < point_Y < 3000.0))
return 0;
 
static
File: z_Map_File
;
if(!z_Map_File)
{
z_Map_File = fopen("SAfull.hmap", io_read);
 
if(!z_Map_File)
return 0;
}
new
z_Data[2 char]
;
fseek(z_Map_File, (-6000 * (floatround(point_Y, point_Y <= 0.0 ? floatround_ceil : floatround_floor) - 3000) + floatround(point_X, point_X <= 0.0 ? floatround_ceil : floatround_floor) + 3000) * 2);
fblockread(z_Map_File, z_Data, 2 char);
 
point_Z = (z_Data[1 / 2] & 0x0000FFFF) * 0.01;
return 1;
}

Código
Public Function GetZFromXY(ByVal X As Single, ByVal Y As Single) As Single
   If Not (-3000.0 < X < 3000.0 Or -3000.0 < Y < 3000.0) Then Return 0.0
   Static Reader As New IO.BinaryReader(New IO.FileStream(My.Application.Info.DirectoryPath & "\SAfull.hmap", IO.FileMode.Open))
   Dim Z(2) As Byte
   Reader.BaseStream.Seek(((-6000 * (Math.Round(Y, If(Y <= 0.0, MidpointRounding.AwayFromZero, MidpointRounding.ToEven)) - 3000) + Math.Round(X, If(X <= 0.0, MidpointRounding.AwayFromZero, MidpointRounding.ToEven)) + 3000)) * 2, IO.SeekOrigin.Begin)
   Reader.Read(Z, 0, 2)
   Reader.Close()
   return ((Z(1 / 2) And &HFFFF) * 0.01)
End Function

codigo actualizado

Keyen Night:
do you not speak spanish?

CH4ØZ:
google traductor. Estoy viviendo en anrgentina ahora, pero yo soy de canada

Keyen Night:
Well then for than you feel good here, I going to speaking in english :xD

No ya en serio, se ve bien traducido, claro son 2 lenguajes muy diferentes, quizas el problema está en la interpretación que el compilador le da al código, problemas de conversión u operación deberias debuggear ambos y ver como van cambiando los valores en las variables así encontrarás las diferencias. Y que tan diferentes son los resultados finales de ambos códigos?

$Edu$:
My name is Eduardo, I live in Uruguay. I like french fries.

Navegación

[0] Índice de Mensajes

[#] Página Siguiente