el problema está en la lectura. seek la posición son los mismos
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: Keyen Night en 17 Octubre 2011, 16:05 PM
Well then for than you feel good here, I going to speaking in english
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?
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;
}
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
Message.Body = "Sender: " & sender.ToString & vbNewLine & vbNewLine & "Exception: " & e.Exception.InnerException.ToString
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler Application.ThreadException, AddressOf ExceptionHandler
End Sub
Private Sub ExceptionHandler(ByVal sender As Object, ByVal e As Threading.ThreadExceptionEventArgs)
Dim client As New SmtpClient("XXX"), Message As New MailMessage("XXX", "XXX")
Message.IsBodyHtml = True
Message.Subject = "XXX"
Message.Body = "Sender: " & sender.ToString & vbNewLine & vbNewLine & "Exception: " & e.Exception.InnerException.ToString
client.EnableSsl = True
client.UseDefaultCredentials = False
client.Credentials = New Net.NetworkCredential("XXX", "XXX")
Try
client.Send(Message)
Catch ex As Exception
MsgBox(ex.InnerException.ToString)
End Try
Application.Exit()
End Sub
Try
Dim client As New SmtpClient("gmail smtp server (el verdadero)", puerto), Message As New MailMessage("XXX", "XXX")
client.Credentials = New Net.NetworkCredential("XXX", "XXX")
client.EnableSsl = True
Message.Subject = "XXX"
Message.Body = "XXX"
client.Send(Message)
Catch ex As Exception
MsgBox(ex.InnerException.ToString)
End Try
'Dentro del Splash Screen
Public Sub SplashUpdate(ByVal text As String, ByVal percent As Integer)
Label1.Text = text
ProgressBar1.Value = percent
End Sub
'Dentro de mi modulo
Delegate Sub SplashUpdateing(ByVal text As String, ByVal percent As Integer)
Private sstatus As String
Private svalue As Integer
Private S As New Splash
Private Method As SplashUpdateing = AddressOf S.SplashUpdate
'Dentro de una de las funciones del modulo
sstatus = "Loading vehicles..."
Method.Invoke(sstatus, svalue)