X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2Fnative.cxx;h=0057040537e30b8450a46e80afc373b3fc60efc5;hb=a1031b052dd40ca3a4ea68dcd7f572b7d9e4bb24;hp=ece831ba4b7c7ddceb5b1f3d44b354ba9cb18d95;hpb=c9813d1b5d79b4aad13c263690a0223086af25ac;p=flightgear.git diff --git a/src/Network/native.cxx b/src/Network/native.cxx index ece831ba4..005704053 100644 --- a/src/Network/native.cxx +++ b/src/Network/native.cxx @@ -20,12 +20,16 @@ // // $Id$ +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include "native.hxx" +#include FGNative::FGNative() { } @@ -54,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; @@ -71,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; } } }