X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetworkOLK%2Fnet_send.cxx;h=2465d843ccdd069a40e205bae2cc898ca7fc1d02;hb=938d006188e70e891bc04e91610c7b8caaca87b6;hp=891e6f6aedfe7c00f201b33bc7425c01cc1f5b80;hpb=a71f03b18c1f03e1c362e0e56795c4b0df95cb49;p=flightgear.git diff --git a/src/NetworkOLK/net_send.cxx b/src/NetworkOLK/net_send.cxx index 891e6f6ae..2465d843c 100644 --- a/src/NetworkOLK/net_send.cxx +++ b/src/NetworkOLK/net_send.cxx @@ -40,7 +40,8 @@ #include #include -#include
+#include
+#include
//#define printf // @@ -68,13 +69,16 @@ int result; //extern const char *const sys_errlist[]; +/* -dlw- I fixed a few of the cases, but please make non externally used */ +/* symbols static to avoid possible linker conflicts */ int current_port = 10000; u_short base_port = 10000; u_short end_port = 10010; -int verbose = 0; -struct hostent *host_info, *f_host_info; -struct servent *service_info; -struct utsname myname; + +static int verbose = 0; +static struct hostent *host_info, *f_host_info; +static struct servent *service_info; +static struct utsname myname; /* Program-stuff */ int i, j; @@ -208,7 +212,7 @@ int list_not_in( char name[16]) { return i; } -void fgd_print_Mat4( sgMat4 m ) { +void fgd_print_Mat4( const sgMat4 m ) { printf("0.0 %f 0.1 %f 0.2 %f 0.3 %f\n", m[0][0], m[0][1], m[0][2], m[0][3] ); printf("1.0 %f 1.1 %f 1.2 %f 1.3 %f\n", @@ -255,7 +259,7 @@ void fgd_init(void){ /* determinating the source/sending host */ if (uname(&myname) == 0) strcpy(src_host , myname.nodename); printf("MCP: I'm running on HOST : %s ", src_host); - if (host_info = gethostbyname( src_host)) { + if ( (host_info = gethostbyname( src_host)) != NULL ) { bcopy(host_info->h_addr, (char *)&address.sin_addr,host_info->h_length); strcpy((char *) fgd_mcp_ip, (char *) inet_ntoa(address.sin_addr)); } @@ -263,7 +267,7 @@ void fgd_init(void){ FGFS_host = src_host; /* resolving the destination host, here fgd's host */ if (verbose == 2) printf(" Resolving default DEAMON: %s ->", fgd_host); - if (host_info = gethostbyname( fgd_host)) { + if ( (host_info = gethostbyname( fgd_host)) != NULL ) { bcopy(host_info->h_addr, (char *)&address.sin_addr,host_info->h_length); strcpy((char *) fgd_ip, (char *) inet_ntoa(address.sin_addr)); if (verbose == 2) { @@ -286,12 +290,12 @@ void fgd_init(void){ int net_resolv_fgd( char *fgd_host_check ) { -char *fgd_ip_check; + char *fgd_ip_check = ""; /* resolving the destination host, here fgd's host */ net_r = 0; if (verbose == 2) printf(" Resolving default DEAMON: %s ->", fgd_host_check); - if (host_info = gethostbyname( fgd_host_check)) { + if ( (host_info = gethostbyname( fgd_host_check)) != NULL ) { bcopy(host_info->h_addr, (char *)&address.sin_addr,host_info->h_length); strcpy((char *) fgd_ip_check, (char *) inet_ntoa(address.sin_addr)); fgd_ip = fgd_ip_check; @@ -382,18 +386,18 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) { speed loss/gain in network-area... */ get_latitude(), get_longitude(), get_altitude(), - get_speed(), get_roll()*RAD_TO_DEG, - get_pitch()*RAD_TO_DEG, get_heading()); + get_speed(), get_roll()*SGD_RADIANS_TO_DEGREES, + get_pitch()*SGD_RADIANS_TO_DEGREES, get_heading()); write( sock, fgd_txt, 56); break; /* Here sending the previously calculated view.Mat4 by FGFS */ case 17: if (verbose == 2) printf("Checkpoint\n"); - sgCopyMat4(sgFGD_COORD, current_view.VIEW); + sgCopyMat4(sgFGD_COORD, globals->get_current_view()->get_VIEW()); if (verbose == 2) { printf("current_view\n"); - fgd_print_Mat4( current_view.VIEW); + fgd_print_Mat4( globals->get_current_view()->get_VIEW()); printf("FGD_COORD\n"); fgd_print_Mat4( sgFGD_COORD); }