It's usually not a good idea to assign a const char* to a node of a temporary property tree, use string instead.
This commit is contained in:
parent
fa7f2468c2
commit
77d3a549a7
2 changed files with 15 additions and 15 deletions
|
@ -38,10 +38,10 @@ typedef struct {
|
||||||
string callsign;
|
string callsign;
|
||||||
|
|
||||||
// can be aircraft, ship, storm, thermal or ballistic
|
// can be aircraft, ship, storm, thermal or ballistic
|
||||||
const char* m_type;
|
string m_type;
|
||||||
const char* m_class;
|
string m_class;
|
||||||
const char* path;
|
string path;
|
||||||
const char* flightplan;
|
string flightplan;
|
||||||
|
|
||||||
FGAIFlightPlan *fp;
|
FGAIFlightPlan *fp;
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ FGAIManager::createAircraft( FGAIModelEntity *entity ) {
|
||||||
}
|
}
|
||||||
ai_plane->setHeading(entity->heading);
|
ai_plane->setHeading(entity->heading);
|
||||||
ai_plane->setSpeed(entity->speed);
|
ai_plane->setSpeed(entity->speed);
|
||||||
ai_plane->setPath(entity->path);
|
ai_plane->setPath(entity->path.c_str());
|
||||||
ai_plane->setAltitude(entity->altitude);
|
ai_plane->setAltitude(entity->altitude);
|
||||||
ai_plane->setLongitude(entity->longitude);
|
ai_plane->setLongitude(entity->longitude);
|
||||||
ai_plane->setLatitude(entity->latitude);
|
ai_plane->setLatitude(entity->latitude);
|
||||||
|
@ -169,7 +169,7 @@ FGAIManager::createShip( FGAIModelEntity *entity ) {
|
||||||
++numObjects[FGAIBase::otShip];
|
++numObjects[FGAIBase::otShip];
|
||||||
ai_ship->setHeading(entity->heading);
|
ai_ship->setHeading(entity->heading);
|
||||||
ai_ship->setSpeed(entity->speed);
|
ai_ship->setSpeed(entity->speed);
|
||||||
ai_ship->setPath(entity->path);
|
ai_ship->setPath(entity->path.c_str());
|
||||||
ai_ship->setAltitude(entity->altitude);
|
ai_ship->setAltitude(entity->altitude);
|
||||||
ai_ship->setLongitude(entity->longitude);
|
ai_ship->setLongitude(entity->longitude);
|
||||||
ai_ship->setLatitude(entity->latitude);
|
ai_ship->setLatitude(entity->latitude);
|
||||||
|
@ -194,7 +194,7 @@ FGAIManager::createBallistic( FGAIModelEntity *entity ) {
|
||||||
ai_ballistic->setAzimuth(entity->azimuth);
|
ai_ballistic->setAzimuth(entity->azimuth);
|
||||||
ai_ballistic->setElevation(entity->elevation);
|
ai_ballistic->setElevation(entity->elevation);
|
||||||
ai_ballistic->setSpeed(entity->speed);
|
ai_ballistic->setSpeed(entity->speed);
|
||||||
ai_ballistic->setPath(entity->path);
|
ai_ballistic->setPath(entity->path.c_str());
|
||||||
ai_ballistic->setAltitude(entity->altitude);
|
ai_ballistic->setAltitude(entity->altitude);
|
||||||
ai_ballistic->setLongitude(entity->longitude);
|
ai_ballistic->setLongitude(entity->longitude);
|
||||||
ai_ballistic->setLatitude(entity->latitude);
|
ai_ballistic->setLatitude(entity->latitude);
|
||||||
|
@ -220,7 +220,7 @@ FGAIManager::createStorm( FGAIModelEntity *entity ) {
|
||||||
++numObjects[FGAIBase::otStorm];
|
++numObjects[FGAIBase::otStorm];
|
||||||
ai_storm->setHeading(entity->heading);
|
ai_storm->setHeading(entity->heading);
|
||||||
ai_storm->setSpeed(entity->speed);
|
ai_storm->setSpeed(entity->speed);
|
||||||
ai_storm->setPath(entity->path);
|
ai_storm->setPath(entity->path.c_str());
|
||||||
ai_storm->setAltitude(entity->altitude);
|
ai_storm->setAltitude(entity->altitude);
|
||||||
ai_storm->setLongitude(entity->longitude);
|
ai_storm->setLongitude(entity->longitude);
|
||||||
ai_storm->setLatitude(entity->latitude);
|
ai_storm->setLatitude(entity->latitude);
|
||||||
|
@ -294,19 +294,19 @@ void FGAIManager::processScenario( string &filename ) {
|
||||||
FGAIModelEntity* en = s->getNextEntry();
|
FGAIModelEntity* en = s->getNextEntry();
|
||||||
|
|
||||||
if (en) {
|
if (en) {
|
||||||
if ( !strcmp(en->m_type, "aircraft")) {
|
if ( en->m_type == "aircraft") {
|
||||||
createAircraft( en );
|
createAircraft( en );
|
||||||
|
|
||||||
} else if ( !strcmp(en->m_type, "ship")) {
|
} else if ( en->m_type == "ship") {
|
||||||
createShip( en );
|
createShip( en );
|
||||||
|
|
||||||
} else if ( !strcmp(en->m_type, "thunderstorm")) {
|
} else if ( en->m_type == "thunderstorm") {
|
||||||
createStorm( en );
|
createStorm( en );
|
||||||
|
|
||||||
} else if ( !strcmp(en->m_type, "thermal")) {
|
} else if ( en->m_type == "thermal") {
|
||||||
createThermal( en );
|
createThermal( en );
|
||||||
|
|
||||||
} else if ( !strcmp(en->m_type, "ballistic")) {
|
} else if ( en->m_type == "ballistic") {
|
||||||
createBallistic( en );
|
createBallistic( en );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue