X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2Fnative.cxx;h=0057040537e30b8450a46e80afc373b3fc60efc5;hb=4be1661305609819703015360b79bbb7e4ae87d6;hp=c627cb15f3f32fd62a19d98c038348165d36784e;hpb=f65abb8a610f2a714a426b443076adc722d8065e;p=flightgear.git diff --git a/src/Network/native.cxx b/src/Network/native.cxx index c627cb15f..005704053 100644 --- a/src/Network/native.cxx +++ b/src/Network/native.cxx @@ -29,6 +29,7 @@ #include "native.hxx" +#include FGNative::FGNative() { } @@ -57,15 +58,21 @@ bool FGNative::open() { return true; } +/** + * The design of FGNative requires direct, memcpy access to FGInterface, + * unfortunately. Since this is the only remaining place that does, the + * extern lives here, rather than a header file. + * + */ +extern FGInterface* evil_global_fdm_state; // process work for this port bool FGNative::process() { SGIOChannel *io = get_io_channel(); - int length = sizeof(*cur_fdm_state); + int length = sizeof(FGInterface); if ( get_direction() == SG_IO_OUT ) { - // cout << "size of cur_fdm_state = " << length << endl; - buf = *cur_fdm_state; + buf = *evil_global_fdm_state; if ( ! io->write( (char *)(& buf), length ) ) { SG_LOG( SG_IO, SG_ALERT, "Error writing data." ); return false; @@ -74,12 +81,12 @@ bool FGNative::process() { if ( io->get_type() == sgFileType ) { if ( io->read( (char *)(& buf), length ) == length ) { SG_LOG( SG_IO, SG_DEBUG, "Success reading data." ); - *cur_fdm_state = buf; + *evil_global_fdm_state = buf; } } else { while ( io->read( (char *)(& buf), length ) == length ) { SG_LOG( SG_IO, SG_DEBUG, "Success reading data." ); - *cur_fdm_state = buf; + *evil_global_fdm_state = buf; } } }