]> git.mxchange.org Git - flightgear.git/blobdiff - src/NetworkOLK/net_send.cxx
- adjusted for no-value constructor for FGPanel
[flightgear.git] / src / NetworkOLK / net_send.cxx
index 80724cc78cda982ea8ffe15831f1b8f182b1fd2e..b417c1d725a40b75d7cfdb788884e1bf823940d4 100644 (file)
@@ -32,6 +32,7 @@
 /*************************************************************/
 
 #include <stdio.h>
+#include <strings.h>
 #include "fgd.h"
 
 /* I prefer NHV's decl. */
@@ -39,7 +40,7 @@
 
 #include <Cockpit/hud.hxx>
 #include <plib/ssg.h>
-#include <Main/views.hxx>
+#include <Main/globals.hxx>
 
 //#define printf //
 
@@ -51,13 +52,21 @@ struct sockaddr_in address;
 struct sockaddr_in my_address;
 int result;
 
-#if defined( __CYGWIN__ )
+//#if defined( __CYGWIN__ )
 #include <errno.h>
-#else
-extern int errno;
-#endif
+//const char *const *sys_errlist = _sys_errlist;
+//#else
+//extern int errno;
+//extern const char *const sys_errlist[];
+//#endif
 
-extern const char *const sys_errlist[];
+//#if defined( __CYGWIN__ )
+//#include <errno.h>
+//#else
+//extern int errno;
+//#endif
+
+//extern const char *const sys_errlist[];
 
 int current_port  = 10000; 
 u_short base_port = 10000;
@@ -81,8 +90,8 @@ extern char *FGFS_host, *net_callsign;
 
 /* List-stuff */
 
-const int True  = 0;
-const int False= -1;
+const int listTrue  = 0;
+const int listFalse= -1;
 
 struct list_ele {
    /* unsigned */ char ipadr[16], callsign[16];
@@ -189,17 +198,17 @@ struct list_ele *clr_ele;
 
 int list_not_in( char name[16]) {
    
-   i = True;
+   i = listTrue;
    test = head->next;
-   while ((test != tail) && (i==True)) {
-     i = (strcmp(test->ipadr, name) ? True : False);
+   while ((test != tail) && (i==listTrue)) {
+     i = (strcmp(test->ipadr, name) ? listTrue : listFalse);
      test = test->next;
      if (verbose != 0) printf("list_not_in : %d\n",i);
    }
    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", 
@@ -277,7 +286,7 @@ 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;
@@ -322,7 +331,9 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
     sock = socket(PF_INET, SOCK_STREAM, 0);
     if (sock == -1)
      {
-       fprintf(stderr, "Error assigning master socket: %s\n",sys_errlist[errno]);
+//     fprintf(stderr, "Error assigning master socket: %s\n",sys_errlist[errno]);
+                fprintf(stderr, "Error assigning master socket: %s\n",
+                                strerror(errno));
         /* must check how severe this really is */
        // exit(-1);
      } 
@@ -371,18 +382,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);
                  }