diff --git a/owlps-client/owlps-client.c b/owlps-client/owlps-client.c index 33c616f..4d465a3 100644 --- a/owlps-client/owlps-client.c +++ b/owlps-client/owlps-client.c @@ -410,14 +410,21 @@ void make_packet() printf("Direction = %d, X = %f, Y = %f, Z = %f\n", packet[offset - 1], options.x, options.y, options.z) ; #endif // DEBUG + // Convert the coordinates to the network endianess options.x = owl_htonf(options.x) ; options.y = owl_htonf(options.y) ; options.z = owl_htonf(options.z) ; + // Copy the coordinates to the packet memcpy(&packet[offset], &options.x, sizeof(float)) ; offset += sizeof(float) ; memcpy(&packet[offset], &options.y, sizeof(float)) ; offset += sizeof(float) ; memcpy(&packet[offset], &options.z, sizeof(float)) ; + // Convert the coordinates back to the host endianess (mandatory + // in flood mode) + options.x = owl_ntohf(options.x) ; + options.y = owl_ntohf(options.y) ; + options.z = owl_ntohf(options.z) ; } else // Standard packet