void updatePlatforms(player_s* p) { int i; for(i=0;i<NUMPLATFORMS;i++) { if(platform[i].used)updatePlatform(&platform[i], p); } }
//------------------------------------------------------------------------------ // entityStateManager() -- (Output support) // -- Update the entity object for this NIB(Player) //------------------------------------------------------------------------------ bool Nib::entityStateManager(const double curExecTime) { bool ok = true; if (getPlayer()->isMode(simulation::Player::ACTIVE) && isPlayerStateUpdateRequired(curExecTime)) { // Need to update this entity object ... NetIO* netIO = static_cast<NetIO*>(getNetIO()); RTI::RTIambassador* rtiAmb = netIO->getRTIambassador(); // --- // First, make sure this entity has been registered // --- if (!isRegistered()) { try { RTI::ObjectClassHandle theClassHandle = netIO->getObjectClassHandle( getClassIndex() ); makeObjectName(); setObjectHandle( rtiAmb->registerObjectInstance( theClassHandle, getObjectName() ) ); netIO->addNibToObjectTables(this, simulation::NetIO::OUTPUT_NIB); std::cout << "rprfom::Nib::updateEntity(): Register entity: " << getObjectName() << " handle = " << getObjectHandle() << std::endl; } catch (RTI::Exception& e) { std::cerr << &e << std::endl; ok = false; } } // --- // Next, update the entity's attribute values ... // --- if ( ok && isRegistered()) { try { // Create the attribute-value pair set RTI::AttributeHandleValuePairSet* attrs = nullptr; attrs = RTI::AttributeSetFactory::create( NetIO::NUM_OBJECT_ATTRIBUTES ); // Load the set with updated attribute values updateBasicEntity(attrs,curExecTime); updatePhysicalEntity(attrs,curExecTime); updatePlatform(attrs,curExecTime); // Send attributes to the RTI //std::cout << "RprFom::Nib::updateEntity(): Update entity: " << getObjectName() << " handle = " << getObjectHandle() << std::endl; ok = netIO->updateAttributeValues(getObjectHandle(), attrs); delete attrs; } catch (RTI::Exception& e) { std::cerr << &e << std::endl; ok = false; } } } // end -- if active player needs an update return ok; }