]> git.mxchange.org Git - simgear.git/blobdiff - simgear/timing/timezone.cxx
Add cloud movement direction and speed
[simgear.git] / simgear / timing / timezone.cxx
index 29ef5df0ef5f2c865a21f7ff145651b432f33572..aac090a4466dfb4824b2a2e311758be801d012fe 100644 (file)
@@ -21,7 +21,7 @@
 
 /*************************************************************************
  *
- * Timezone is derived from geocoord, and stores the timezone centerpoint,
+ * SGTimeZone is derived from geocoord, and stores the timezone centerpoint,
  * as well as the countrycode and the timezone descriptor. The latter is 
  * used in order to get the local time. 
  *
 #include <stdio.h>
 #include "timezone.h"
 
-Timezone::Timezone(float la, float lo, char* cc, char* desc) :
-    GeoCoord(la, lo)
+SGTimeZone::SGTimeZone(float la, float lo, char* cc, char* desc) :
+    SGGeoCoord(la, lo)
 { 
-    countryCode = strdup(cc);
-    descriptor = strdup(desc);
+    countryCode = cc;
+    descriptor = desc;
 }
 
 /* Build a timezone object from a textline in zone.tab */
-Timezone::Timezone(const char *infoString) :
-    GeoCoord()
+SGTimeZone::SGTimeZone(const char *infoString) :
+    SGGeoCoord()
 {
     int i = 0;
     while (infoString[i] != '\t')
@@ -50,7 +50,7 @@ Timezone::Timezone(const char *infoString) :
     char latlon[128];
     strncpy(buffer, infoString, i);
     buffer[i] = 0;
-    countryCode = strdup(buffer);
+    countryCode = buffer;
     i ++;
     int start = i;
     while (infoString[i] != '\t') {
@@ -107,22 +107,22 @@ Timezone::Timezone(const char *infoString) :
     size = i - start;
     strncpy(buffer, (&infoString[start]), size);
     buffer[size] = 0;
-    descriptor = strdup(buffer);
+    descriptor = buffer;
 }
 
 /* the copy constructor */
-Timezone::Timezone(const Timezone& other)
+SGTimeZone::SGTimeZone(const SGTimeZone& other)
 {
     lat = other.getLat();
     lon = other.getLon();
-    countryCode = strdup(other.countryCode);
-    descriptor = strdup(other.descriptor);
+    countryCode = other.countryCode;
+    descriptor = other.descriptor;
 }
 
 
-/********* Member functions for TimezoneContainer class ********/
+/********* Member functions for SGTimeZoneContainer class ********/
 
-TimezoneContainer::TimezoneContainer(const char *filename)
+SGTimeZoneContainer::SGTimeZoneContainer(const char *filename)
 {
     char buffer[256];
     FILE* infile = fopen(filename, "rb");
@@ -137,28 +137,23 @@ TimezoneContainer::TimezoneContainer(const char *filename)
             if (feof(infile)) {
                 break;
             }
-#ifdef _MSC_VER
-            if( buffer[0] == '#' )
-               continue;
-#else
             for (char *p = buffer; *p; p++) {
                 if (*p == '#') {
                     *p = 0;
                     break;
                 }    
             }
-#endif
             if (buffer[0]) {
-                data.push_back(new Timezone(buffer));
+                data.push_back(new SGTimeZone(buffer));
             }
         }
         if ( errno ) {
-            perror( "TimezoneContainer()" );
+            perror( "SGTimeZoneContainer()" );
             errno = 0;
         }
     }
 }
 
-TimezoneContainer::~TimezoneContainer()
+SGTimeZoneContainer::~SGTimeZoneContainer()
 {
 }