diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt index 6080b59e..e3ff31ef 100644 --- a/simgear/CMakeLists.txt +++ b/simgear/CMakeLists.txt @@ -5,7 +5,6 @@ foreach( mylibfolder bucket debug ephemeris - hla io magvar math @@ -24,14 +23,18 @@ foreach( mylibfolder endforeach( mylibfolder ) -if (NOT SIMGEAR_HEADLESS) +if(NOT SIMGEAR_HEADLESS) add_subdirectory(environment) add_subdirectory(screen) add_subdirectory(scene) add_subdirectory(sound) -endif() +endif(NOT SIMGEAR_HEADLESS) +if(ENABLE_RTI) + add_subdirectory(hla) +endif(ENABLE_RTI) + set(HEADERS compiler.h constants.h sg_inlines.h ${PROJECT_BINARY_DIR}/simgear/version.h) install (FILES ${HEADERS} DESTINATION include/simgear/) diff --git a/simgear/hla/HLAFederate.cxx b/simgear/hla/HLAFederate.cxx index 14f6c0ce..96e31fc3 100644 --- a/simgear/hla/HLAFederate.cxx +++ b/simgear/hla/HLAFederate.cxx @@ -107,6 +107,18 @@ HLAFederate::timeAdvanceRequest(const SGTimeStamp& dt) return _rtiFederate->timeAdvanceRequest(dt); } +bool +HLAFederate::queryFederateTime(SGTimeStamp& timeStamp) +{ + return _rtiFederate->queryFederateTime(timeStamp); +} + +bool +HLAFederate::queryLookahead(SGTimeStamp& timeStamp) +{ + return _rtiFederate->queryLookahead(timeStamp); +} + bool HLAFederate::tick() { diff --git a/simgear/hla/HLAFederate.hxx b/simgear/hla/HLAFederate.hxx index 64ea2b4e..241f6093 100644 --- a/simgear/hla/HLAFederate.hxx +++ b/simgear/hla/HLAFederate.hxx @@ -58,6 +58,9 @@ public: bool timeAdvanceRequestBy(const SGTimeStamp& dt); bool timeAdvanceRequest(const SGTimeStamp& dt); + bool queryFederateTime(SGTimeStamp& timeStamp); + bool queryLookahead(SGTimeStamp& timeStamp); + /// Process messages bool tick(); bool tick(const double& minimum, const double& maximum); diff --git a/simgear/hla/RTI13Ambassador.hxx b/simgear/hla/RTI13Ambassador.hxx index 0415c4ad..502a39f7 100644 --- a/simgear/hla/RTI13Ambassador.hxx +++ b/simgear/hla/RTI13Ambassador.hxx @@ -381,37 +381,18 @@ public: // } // return false; // } - // bool queryFederateTime(double& time) - // { - // try { - // RTIfedTime fedTime; - // _rtiAmbassador.queryFederateTime(fedTime); - // time = fedTime.getTime(); - // return true; - // } catch (RTI::FederateNotExecutionMember& e) { - // } catch (RTI::ConcurrentAccessAttempted& e) { - // } catch (RTI::SaveInProgress& e) { - // } catch (RTI::RestoreInProgress& e) { - // } catch (RTI::RTIinternalError& e) { - // } - // return false; - // } - - // bool queryLookahead(double& time) - // { - // try { - // RTIfedTime fedTime; - // _rtiAmbassador.queryLookahead(fedTime); - // time = fedTime.getTime(); - // return true; - // } catch (RTI::FederateNotExecutionMember& e) { - // } catch (RTI::ConcurrentAccessAttempted& e) { - // } catch (RTI::SaveInProgress& e) { - // } catch (RTI::RestoreInProgress& e) { - // } catch (RTI::RTIinternalError& e) { - // } - // return false; - // } + void queryFederateTime(SGTimeStamp& timeStamp) + { + RTIfedTime fedTime; + _rtiAmbassador.queryFederateTime(fedTime); + timeStamp = toTimeStamp(fedTime); + } + void queryLookahead(SGTimeStamp& timeStamp) + { + RTIfedTime fedTime; + _rtiAmbassador.queryLookahead(fedTime); + timeStamp = toTimeStamp(fedTime); + } RTI13ObjectClass* createObjectClass(const std::string& name, HLAObjectClass* hlaObjectClass) { diff --git a/simgear/hla/RTI13Federate.cxx b/simgear/hla/RTI13Federate.cxx index 8dad3367..d3f9eebc 100644 --- a/simgear/hla/RTI13Federate.cxx +++ b/simgear/hla/RTI13Federate.cxx @@ -451,6 +451,64 @@ RTI13Federate::timeAdvanceRequest(const SGTimeStamp& fedTime) return true; } +bool +RTI13Federate::queryFederateTime(SGTimeStamp& timeStamp) +{ + if (!_ambassador.valid()) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time."); + return false; + } + + try { + _ambassador->queryFederateTime(timeStamp); + } catch (RTI::FederateNotExecutionMember& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason); + return false; + } catch (RTI::ConcurrentAccessAttempted& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason); + return false; + } catch (RTI::SaveInProgress& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason); + return false; + } catch (RTI::RestoreInProgress& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason); + return false; + } catch (RTI::RTIinternalError& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason); + return false; + } + return true; +} + +bool +RTI13Federate::queryLookahead(SGTimeStamp& timeStamp) +{ + if (!_ambassador.valid()) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead."); + return false; + } + + try { + _ambassador->queryLookahead(timeStamp); + } catch (RTI::FederateNotExecutionMember& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::ConcurrentAccessAttempted& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::SaveInProgress& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::RestoreInProgress& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::RTIinternalError& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason); + return false; + } + return true; +} + bool RTI13Federate::tick() { diff --git a/simgear/hla/RTI13Federate.hxx b/simgear/hla/RTI13Federate.hxx index 3aa32aaf..acad0fce 100644 --- a/simgear/hla/RTI13Federate.hxx +++ b/simgear/hla/RTI13Federate.hxx @@ -60,6 +60,9 @@ public: virtual bool timeAdvanceRequestBy(const SGTimeStamp& dt); virtual bool timeAdvanceRequest(const SGTimeStamp& fedTime); + virtual bool queryFederateTime(SGTimeStamp& timeStamp); + virtual bool queryLookahead(SGTimeStamp& timeStamp); + /// Process messages virtual bool tick(); virtual bool tick(const double& minimum, const double& maximum); diff --git a/simgear/hla/RTI13ObjectInstance.cxx b/simgear/hla/RTI13ObjectInstance.cxx index 8fefc882..87f6a42d 100644 --- a/simgear/hla/RTI13ObjectInstance.cxx +++ b/simgear/hla/RTI13ObjectInstance.cxx @@ -319,21 +319,21 @@ RTI13ObjectInstance::updateAttributeValues(const RTIData& tag) } } catch (RTI::ObjectNotKnown& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::AttributeNotDefined& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::AttributeNotOwned& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::FederateNotExecutionMember& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::ConcurrentAccessAttempted& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::SaveInProgress& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::RestoreInProgress& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::RTIinternalError& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } // That means clear() @@ -377,23 +377,23 @@ RTI13ObjectInstance::updateAttributeValues(const SGTimeStamp& timeStamp, const R } } catch (RTI::ObjectNotKnown& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::AttributeNotDefined& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::AttributeNotOwned& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::InvalidFederationTime& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::FederateNotExecutionMember& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::ConcurrentAccessAttempted& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::SaveInProgress& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::RestoreInProgress& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } catch (RTI::RTIinternalError& e) { - SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not delete object instance: " << e._name << " " << e._reason); + SG_LOG(SG_NETWORK, SG_WARN, "RTI: could not update attribute values object instance: " << e._name << " " << e._reason); } // That means clear() diff --git a/simgear/hla/RTIFederate.hxx b/simgear/hla/RTIFederate.hxx index 4b5d2d83..bdb68faa 100644 --- a/simgear/hla/RTIFederate.hxx +++ b/simgear/hla/RTIFederate.hxx @@ -65,6 +65,9 @@ public: virtual bool timeAdvanceRequestBy(const SGTimeStamp& dt) = 0; virtual bool timeAdvanceRequest(const SGTimeStamp& fedTime) = 0; + virtual bool queryFederateTime(SGTimeStamp& timeStamp) = 0; + virtual bool queryLookahead(SGTimeStamp& timeStamp) = 0; + /// Process messages virtual bool tick() = 0; virtual bool tick(const double& minimum, const double& maximum) = 0; diff --git a/simgear/props/props_io.cxx b/simgear/props/props_io.cxx index 9fea4497..0877390e 100644 --- a/simgear/props/props_io.cxx +++ b/simgear/props/props_io.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include "props.hxx" #include "props_io.hxx" @@ -170,12 +171,15 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts) // Check for an include. attval = atts.getValue("include"); if (attval != 0) { - SGPath path(SGPath(_base).dir()); - path.append(attval); try { - readProperties(path.str(), _root, 0, _extended); + SGPath path = simgear::ResourceManager::instance()->findPath(attval, SGPath(_base).dir()); + if (path.isNull()) + { + throw sg_io_exception("Cannot open file", sg_location(attval)); + } + readProperties(path.str(), _root, 0, _extended); } catch (sg_io_exception &e) { - setException(e); + setException(e); } } @@ -242,12 +246,15 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts) bool omit = false; attval = atts.getValue("include"); if (attval != 0) { - SGPath path(SGPath(_base).dir()); - path.append(attval); try { - readProperties(path.str(), node, 0, _extended); + SGPath path = simgear::ResourceManager::instance()->findPath(attval, SGPath(_base).dir()); + if (path.isNull()) + { + throw sg_io_exception("Cannot open file", sg_location(attval)); + } + readProperties(path.str(), node, 0, _extended); } catch (sg_io_exception &e) { - setException(e); + setException(e); } attval = atts.getValue("omit-node"); diff --git a/simgear/sound/sample_openal.hxx b/simgear/sound/sample_openal.hxx index b2afba4f..b5267bb1 100644 --- a/simgear/sound/sample_openal.hxx +++ b/simgear/sound/sample_openal.hxx @@ -118,7 +118,7 @@ public: * @param _loop Define whether this sound should be played in a loop. */ void play( bool loop = false ) { - _playing = true; _loop = loop; _changed = true; + _playing = true; _loop = loop; _changed = true; _static_changed = true; } /**