]> git.mxchange.org Git - flightgear.git/commitdiff
It's usually not a good idea to assign a const char* to a node of a temporary propert...
authorehofman <ehofman>
Thu, 14 Oct 2004 09:49:46 +0000 (09:49 +0000)
committerehofman <ehofman>
Thu, 14 Oct 2004 09:49:46 +0000 (09:49 +0000)
src/AIModel/AIBase.hxx
src/AIModel/AIManager.cxx

index 5cc92b5b4e8dff6358d85b8219d48b1f4b5d8c32..190500d3ac0203f223d336078b36bc6cef5499eb 100644 (file)
@@ -38,10 +38,10 @@ typedef struct {
    string callsign;
 
    // can be aircraft, ship, storm, thermal or ballistic
-   const char* m_type;
-   const char* m_class;
-   const char* path;
-   const char* flightplan;
+   string m_type;
+   string m_class;
+   string path;
+   string flightplan;
 
    FGAIFlightPlan *fp;
 
index 6c50a0f5808d9268a9f9a2081ab07721c8947023..4faa4c269590c906563e94cd433d9cca330a81d0 100644 (file)
@@ -145,7 +145,7 @@ FGAIManager::createAircraft( FGAIModelEntity *entity ) {
         }
         ai_plane->setHeading(entity->heading);
         ai_plane->setSpeed(entity->speed);
-        ai_plane->setPath(entity->path);
+        ai_plane->setPath(entity->path.c_str());
         ai_plane->setAltitude(entity->altitude);
         ai_plane->setLongitude(entity->longitude);
         ai_plane->setLatitude(entity->latitude);
@@ -169,7 +169,7 @@ FGAIManager::createShip( FGAIModelEntity *entity ) {
         ++numObjects[FGAIBase::otShip];
         ai_ship->setHeading(entity->heading);
         ai_ship->setSpeed(entity->speed);
-        ai_ship->setPath(entity->path);
+        ai_ship->setPath(entity->path.c_str());
         ai_ship->setAltitude(entity->altitude);
         ai_ship->setLongitude(entity->longitude);
         ai_ship->setLatitude(entity->latitude);
@@ -194,7 +194,7 @@ FGAIManager::createBallistic( FGAIModelEntity *entity ) {
         ai_ballistic->setAzimuth(entity->azimuth);
         ai_ballistic->setElevation(entity->elevation);
         ai_ballistic->setSpeed(entity->speed);
-        ai_ballistic->setPath(entity->path);
+        ai_ballistic->setPath(entity->path.c_str());
         ai_ballistic->setAltitude(entity->altitude);
         ai_ballistic->setLongitude(entity->longitude);
         ai_ballistic->setLatitude(entity->latitude);
@@ -220,7 +220,7 @@ FGAIManager::createStorm( FGAIModelEntity *entity ) {
         ++numObjects[FGAIBase::otStorm];
         ai_storm->setHeading(entity->heading);
         ai_storm->setSpeed(entity->speed);
-        ai_storm->setPath(entity->path);
+        ai_storm->setPath(entity->path.c_str());
         ai_storm->setAltitude(entity->altitude);
         ai_storm->setLongitude(entity->longitude);
         ai_storm->setLatitude(entity->latitude);
@@ -294,19 +294,19 @@ void FGAIManager::processScenario( string &filename ) {
     FGAIModelEntity* en = s->getNextEntry();
 
     if (en) {
-      if ( !strcmp(en->m_type, "aircraft")) {
-         createAircraft( en );
+      if ( en->m_type == "aircraft") {
+        createAircraft( en );
 
-      } else if ( !strcmp(en->m_type, "ship")) {
-           createShip( en );
+      } else if ( en->m_type == "ship") {
+        createShip( en );
 
-      } else if ( !strcmp(en->m_type, "thunderstorm")) {
+      } else if ( en->m_type == "thunderstorm") {
         createStorm( en );
 
-      } else if ( !strcmp(en->m_type, "thermal")) {
+      } else if ( en->m_type == "thermal") {
         createThermal( en );
 
-      } else if ( !strcmp(en->m_type, "ballistic")) {
+      } else if ( en->m_type == "ballistic") {
         createBallistic( en );
       }      
     }