void IfcConnectionSurfaceGeometry::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<Ifc4Entity> >& map ) { const int num_args = (int)args.size(); if( num_args<2 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcConnectionSurfaceGeometry, expecting 2, having " << num_args << ". Object id: " << getId() << std::endl; throw Ifc4Exception( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>2 ){ std::cout << "Wrong parameter count for entity IfcConnectionSurfaceGeometry, expecting 2, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_SurfaceOnRelatingElement = IfcSurfaceOrFaceSurface::readStepData( args[0], map ); m_SurfaceOnRelatedElement = IfcSurfaceOrFaceSurface::readStepData( args[1], map ); }
Property* IsotropicInstantaneousCoefficientOfThermalExpansion::clone(PropertyModel *propmodel, ParameterModel* paramodel) { IsotropicInstantaneousCoefficientOfThermalExpansion* prop; if (propmodel && paramodel) { prop = new IsotropicInstantaneousCoefficientOfThermalExpansion(propmodel, paramodel, getId()); } else { prop = new IsotropicInstantaneousCoefficientOfThermalExpansion(*this); } prop->setSorting(getSorting()); return prop; }
void IfcIShapeProfileDef::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcRoadEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<10 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcIShapeProfileDef, expecting 10, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcRoadException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>10 ){ std::cout << "Wrong parameter count for entity IfcIShapeProfileDef, expecting 10, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_ProfileType = IfcProfileTypeEnum::readStepData( args[0] ); m_ProfileName = IfcLabel::readStepData( args[1] ); readEntityReference( args[2], m_Position, map ); m_OverallWidth = IfcPositiveLengthMeasure::readStepData( args[3] ); m_OverallDepth = IfcPositiveLengthMeasure::readStepData( args[4] ); m_WebThickness = IfcPositiveLengthMeasure::readStepData( args[5] ); m_FlangeThickness = IfcPositiveLengthMeasure::readStepData( args[6] ); m_FilletRadius = IfcNonNegativeLengthMeasure::readStepData( args[7] ); m_FlangeEdgeRadius = IfcNonNegativeLengthMeasure::readStepData( args[8] ); m_FlangeSlope = IfcPlaneAngleMeasure::readStepData( args[9] ); }
const ErrorRef& ErrorList::findById(const int32_t id) const { for (auto it=mAll.begin(), end=mAll.end(); it!=end; ++it) { if (it->getId() == id) return *it; } return EMPTY_ERROR; }
void IfcBeamType::readStepArguments( const std::vector<std::string>& args, const std::map<int,shared_ptr<IfcPPEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<10 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcBeamType, expecting 10, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcPPException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>10 ){ std::cout << "Wrong parameter count for entity IfcBeamType, expecting 10, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_GlobalId = IfcGloballyUniqueId::createObjectFromStepData( args[0] ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::createObjectFromStepData( args[2] ); m_Description = IfcText::createObjectFromStepData( args[3] ); m_ApplicableOccurrence = IfcIdentifier::createObjectFromStepData( args[4] ); readEntityReferenceList( args[5], m_HasPropertySets, map ); readEntityReferenceList( args[6], m_RepresentationMaps, map ); m_Tag = IfcLabel::createObjectFromStepData( args[7] ); m_ElementType = IfcLabel::createObjectFromStepData( args[8] ); m_PredefinedType = IfcBeamTypeEnum::createObjectFromStepData( args[9] ); }
void IfcBoundaryFaceCondition::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<Ifc2x3Entity> >& map ) { const int num_args = (int)args.size(); if( num_args<4 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcBoundaryFaceCondition, expecting 4, having " << num_args << ". Object id: " << getId() << std::endl; throw Ifc2x3Exception( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>4 ){ std::cout << "Wrong parameter count for entity IfcBoundaryFaceCondition, expecting 4, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_Name = IfcLabel::readStepData( args[0] ); m_LinearStiffnessByAreaX = IfcModulusOfSubgradeReactionMeasure::readStepData( args[1] ); m_LinearStiffnessByAreaY = IfcModulusOfSubgradeReactionMeasure::readStepData( args[2] ); m_LinearStiffnessByAreaZ = IfcModulusOfSubgradeReactionMeasure::readStepData( args[3] ); }
void Search::endRun() { SearchManager::getInstance().receiveObserverSearch(getId()); }
void IfcPerson::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<Ifc2x3Entity> >& map ) { const int num_args = (int)args.size(); if( num_args<8 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcPerson, expecting 8, having " << num_args << ". Object id: " << getId() << std::endl; throw Ifc2x3Exception( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>8 ){ std::cout << "Wrong parameter count for entity IfcPerson, expecting 8, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_Id = IfcIdentifier::readStepData( args[0] ); m_FamilyName = IfcLabel::readStepData( args[1] ); m_GivenName = IfcLabel::readStepData( args[2] ); readTypeList( args[3], m_MiddleNames ); readTypeList( args[4], m_PrefixTitles ); readTypeList( args[5], m_SuffixTitles ); readEntityReferenceList( args[6], m_Roles, map ); readEntityReferenceList( args[7], m_Addresses, map ); }
void Process::deliveryManager() { bool delivered = false; for(it_map iter = notdelivered.begin(); iter != notdelivered.end(); iter++) { // cout<<iter->second[0]<<endl; for(int x = 0; x<iter->second.size();x++) { // for(std::vector<string>::iterator it = iter->second.begin(); it != iter->second.end(); ++it) // { string message = iter->second[x]; int sender = getSender(message); int messagenum = getMessageNum(message); if(commtype == "Broadcast") { vector<int> ts = getVectorClock_vec(getMessageVC_str(message)); if((D[sender]==ts[sender]-1)) { bool deliver = true; for(int k=0; k<ports.size(); k++) { if (k==sender) continue; if(!(D[k]>=ts[k])) { deliver = false; break; } } if (deliver) { //deliver. update log D[sender] = ts[sender]; updateVectorClock_receive(getMessageVC_str(message)); vector<string> tokens = split(message, ','); string toLog = "P"; string temporary = iToString(getId()); toLog += temporary; toLog += " DLR p_"; toLog += tokens[0]; toLog += ":"; toLog += tokens[1]; // toLog += " new VC "; // toLog += getVectorClock_str(); double curtimeoff = difftime(time(0),getStartTime()); addToLog(curtimeoff, toLog); // cout<<"delivered"<<endl; iter->second.erase(iter->second.begin()+x); delivered = true; break; } } } if(commtype == "Unicast") { vector< vector<int> > ts = getVectorClock_matrix(getMessageVC_str(message)); // cout<<"in delivery manager"<<endl; if((rec[sender]==ts[sender][myid]-1)) { bool deliver = true; // cout<<"in first condition"<<endl; for(int k=0; k<ports.size(); k++) { if (k==sender) continue; if(!(rec[k]>=ts[k][myid])) { deliver = false; break; } } if (deliver) { // cout<<"delivering"<<endl; //deliver. update log rec[sender] = ts[sender][myid]; updateVectorClock_receive(getMessageVC_str(message)); vector<string> tokens = split(message, ','); string toLog = "P"; string temporary = iToString(getId()); toLog += temporary; toLog += " DLR p_"; toLog += tokens[0]; toLog += ":"; toLog += tokens[1]; // toLog += "; recvec: "; // toLog += getRec_str(); // toLog += " new VC "; // toLog += getVectorClock_str(); double curtimeoff = difftime(time(0),getStartTime()); addToLog(curtimeoff, toLog); // cout<<"delivered"<<endl; iter->second.erase(iter->second.begin()+x); delivered = true; break; } } } } } if (delivered) deliveryManager(); return; }
void IfcRelSequence::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcAlignmentP6Entity> >& map ) { const int num_args = (int)args.size(); if( num_args<9 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcRelSequence, expecting 9, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcAlignmentP6Exception( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>9 ){ std::cout << "Wrong parameter count for entity IfcRelSequence, expecting 9, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_GlobalId = IfcGloballyUniqueId::readStepData( args[0] ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::readStepData( args[2] ); m_Description = IfcText::readStepData( args[3] ); readEntityReference( args[4], m_RelatingProcess, map ); readEntityReference( args[5], m_RelatedProcess, map ); readEntityReference( args[6], m_TimeLag, map ); m_SequenceType = IfcSequenceEnum::readStepData( args[7] ); m_UserDefinedSequenceType = IfcLabel::readStepData( args[8] ); }
void IfcStructuralLoadLinearForce::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<Ifc2x3Entity> >& map ) { const int num_args = (int)args.size(); if( num_args<7 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcStructuralLoadLinearForce, expecting 7, having " << num_args << ". Object id: " << getId() << std::endl; throw Ifc2x3Exception( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>7 ){ std::cout << "Wrong parameter count for entity IfcStructuralLoadLinearForce, expecting 7, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_Name = IfcLabel::readStepData( args[0] ); m_LinearForceX = IfcLinearForceMeasure::readStepData( args[1] ); m_LinearForceY = IfcLinearForceMeasure::readStepData( args[2] ); m_LinearForceZ = IfcLinearForceMeasure::readStepData( args[3] ); m_LinearMomentX = IfcLinearMomentMeasure::readStepData( args[4] ); m_LinearMomentY = IfcLinearMomentMeasure::readStepData( args[5] ); m_LinearMomentZ = IfcLinearMomentMeasure::readStepData( args[6] ); }
void IfcRelReferencedInSpatialStructure::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcRoadEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<6 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcRelReferencedInSpatialStructure, expecting 6, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcRoadException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>6 ){ std::cout << "Wrong parameter count for entity IfcRelReferencedInSpatialStructure, expecting 6, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_GlobalId = IfcGloballyUniqueId::readStepData( args[0] ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::readStepData( args[2] ); m_Description = IfcText::readStepData( args[3] ); readEntityReferenceList( args[4], m_RelatedElements, map ); readEntityReference( args[5], m_RelatingStructure, map ); }
void IfcShapeAspect::readStepArguments( const std::vector<std::string>& args, const std::map<int,shared_ptr<IfcPPEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<5 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcShapeAspect, expecting 5, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcPPException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>5 ){ std::cout << "Wrong parameter count for entity IfcShapeAspect, expecting 5, having " << num_args << ". Object id: " << getId() << std::endl; } #endif readEntityReferenceList( args[0], m_ShapeRepresentations, map ); m_Name = IfcLabel::createObjectFromStepData( args[1] ); m_Description = IfcText::createObjectFromStepData( args[2] ); if( _stricmp( args[3].c_str(), ".F." ) == 0 ) { m_ProductDefinitional = LOGICAL_FALSE; } else if( _stricmp( args[3].c_str(), ".T." ) == 0 ) { m_ProductDefinitional = LOGICAL_TRUE; } else if( _stricmp( args[3].c_str(), ".U." ) == 0 ) { m_ProductDefinitional = LOGICAL_UNKNOWN; } m_PartOfProductDefinitionShape = IfcProductRepresentationSelect::createObjectFromStepData( args[4], map ); }
void IfcBooleanClippingResult::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcAlignmentP6Entity> >& map ) { const int num_args = (int)args.size(); if( num_args<3 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcBooleanClippingResult, expecting 3, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcAlignmentP6Exception( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>3 ){ std::cout << "Wrong parameter count for entity IfcBooleanClippingResult, expecting 3, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_Operator = IfcBooleanOperator::readStepData( args[0] ); m_FirstOperand = IfcBooleanOperand::readStepData( args[1], map ); m_SecondOperand = IfcBooleanOperand::readStepData( args[2], map ); }
void PrivateChatChannel::closeChannel() { for (const auto& it : users) { it.second->sendClosePrivate(getId()); } }
void Process::sendBroadcast(int msg) { int sockfd, portno, n; struct sockaddr_in serv_addr; struct hostent *server; char buffer[256]; string tmp = iToString(getId()); tmp += ","; tmp += iToString(msg); string logstring = "P"; logstring += iToString(getId()); logstring += " BRC p_"; logstring += iToString(getId()); logstring += ":"; logstring += iToString(msg); // logstring += " with VC "; updateVectorClock_sendBc(); // logstring += getVectorClock_str(); double timedifference = difftime(time(0) ,getStartTime()); addToLog(timedifference, logstring); for(std::vector<int>::iterator it = ports[getId()].begin(); it != ports[getId()].end(); ++it) { sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) error("ERROR opening socket"); string host = "localhost"; server = gethostbyname(host.c_str()); // if (server == NULL) { // fprintf(stderr,"ERROR, no such host\n"); // exit(0); // } bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length); serv_addr.sin_port = htons(*it); if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) { perror("ERROR connecting"); continue; } bzero(buffer,256); string toSend= tmp; toSend += ","; //lock mutex? toSend += getVectorClock_str(); toSend += ","; toSend += doubleToString(timedifference); // cout<<"sending "<<toSend<<"to "<<*it<<endl; strcpy(buffer, toSend.c_str()); n = write(sockfd,buffer,strlen(buffer)); if (n < 0) error("ERROR writing to socket"); } return; }
void IfcRelConnectsPorts::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcBridgeEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<7 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcRelConnectsPorts, expecting 7, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcBridgeException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>7 ){ std::cout << "Wrong parameter count for entity IfcRelConnectsPorts, expecting 7, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_GlobalId = IfcGloballyUniqueId::readStepData( args[0] ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::readStepData( args[2] ); m_Description = IfcText::readStepData( args[3] ); readEntityReference( args[4], m_RelatingPort, map ); readEntityReference( args[5], m_RelatedPort, map ); readEntityReference( args[6], m_RealizingElement, map ); }
//for unicast void Process::sendUnicast(int dest, int msg) { int sockfd, portno, n; struct sockaddr_in serv_addr; struct hostent *server; char buffer[256]; string tmp = iToString(getId()); tmp += ","; tmp += iToString(msg); string logstring = "P"; logstring += iToString(getId()); logstring += "->P"; logstring += iToString(dest); logstring += " p_"; logstring += iToString(getId()); logstring += ":"; logstring += iToString(msg); updateVectorClock_sendUc(dest); // logstring += getVectorClock_str(); double timedifference = difftime(time(0) ,getStartTime()); addToLog(timedifference, logstring); sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) error("ERROR opening socket"); string host = "localhost"; server = gethostbyname(host.c_str()); // if (server == NULL) { // fprintf(stderr,"ERROR, no such host\n"); // exit(0); // } bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length); serv_addr.sin_port = htons(getPortOf(dest)); if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) { perror("ERROR connecting"); return; } bzero(buffer,256); string toSend= tmp; toSend += ","; //lock mutex? toSend += getVectorClock_str(); toSend += ","; toSend += doubleToString(timedifference); // cout<<"sending "<<toSend<<"to "<<dest<<endl; strcpy(buffer, toSend.c_str()); n = write(sockfd,buffer,strlen(buffer)); if (n < 0) error("ERROR writing to socket"); // cout<<"sent successfully"<<endl; return; }
bool hasId(Obj * obj)const { return !getId(obj).empty(); }
void Instrument::prepareCustomRadialMenu(CreatureObject* player, uint8 itemCount) { // NOTE: player is also of type CreatureObject* !!! PlayerObject* playerObject = dynamic_cast<PlayerObject*>(player); mRadialMenu.reset(); mRadialMenu = RadialMenuPtr(new RadialMenu()); // RadialMenu* radial = new RadialMenu(); //string mInstrumentString = instrument->getName(); uint32 instrumentNr = this->getItemType(); if ((instrumentNr == ItemType_Nalargon) || (instrumentNr == ItemType_omni_box) || (instrumentNr == ItemType_nalargon_max_reebo)) { uint32 radId = 1; // We have to know if this is the real one or the copy. if (playerObject->getPlacedInstrumentId() == this->getId()) { // We are handling the copy if ((playerObject->getId() == this->getOwner()) && this->getPlaced()) { if ((playerObject->getPerformingState() == PlayerPerformance_Music)) { mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback, "@radial_performance:stop_playing"); } else { mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback, "@radial_performance:play_instrument"); } } else { // radial->addItem(radId++,0,radId_examine,radAction_Default); // radial->addItem(radId++,0,radId_itemPickup,radAction_Default); return; } mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default); mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemPickup,radAction_Default); } else { // We may be handling the original instrument. auto equip_service = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::equipment::EquipmentService>("EquipmentService"); auto inventory = dynamic_cast<Inventory*>(equip_service->GetEquippedObject(playerObject, "inventory")); if (inventory) { if (inventory->getId() == this->getParentId()) { // We have our real instrument in the inventory. // We can't drop if outside in the world. if (player->getParentId() == 0) { // Outside mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default); mRadialMenu->addItem(static_cast<uint8>(radId),0,radId_itemDestroy, radAction_Default); } else { mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default); mRadialMenu->addItem(static_cast<uint8>(radId),0,radId_itemDrop,radAction_Default); mRadialMenu->addItem(static_cast<uint8>(radId),0,radId_itemDestroy, radAction_Default); } if (playerObject->getPlacedInstrumentId() == 0) { // We do not have any other placed intrument out. mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback,"Use"); } } else if (dynamic_cast<CellObject*>(gWorldManager->getObjectById(this->getParentId()))) { // It's either a original instrument, or someone else instrument, copy or original. // Time for some dirty... the original instrument does not have an owner. // Let's take advantage of that shortcoming. // Is this my instrument? if (this->getOwner() == player->getId()) { // Yes, are we handling the original instrument. // if (cell->getId() == this->getParentId()) { if ((playerObject->getPerformingState() == PlayerPerformance_Music)) { mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback, "@radial_performance:stop_playing"); } else { mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback, "@radial_performance:play_instrument"); } mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default); mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemPickup,radAction_Default); } } else { // This is not my instrument. // gMessageLib->sendSystemMessage(playerObject,L"","error_message","insufficient_permissions"); mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default); // radial->addItem(radId++,0,radId_itemPickup,radAction_Default); } } } } } // mRadialMenu = RadialMenuPtr(radial); // RadialMenuPtr radialPtr(radial); // mRadialMenu = radialPtr; }
void IfcWorkTime::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcBridgeEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<6 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcWorkTime, expecting 6, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcBridgeException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>6 ){ std::cout << "Wrong parameter count for entity IfcWorkTime, expecting 6, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_Name = IfcLabel::readStepData( args[0] ); m_DataOrigin = IfcDataOriginEnum::readStepData( args[1] ); m_UserDefinedDataOrigin = IfcLabel::readStepData( args[2] ); readEntityReference( args[3], m_RecurrencePattern, map ); m_Start = IfcDate::readStepData( args[4] ); m_Finish = IfcDate::readStepData( args[5] ); }
void Instrument::handleObjectMenuSelect(uint8 messageType,Object* srcObject) { if(PlayerObject* player = dynamic_cast<PlayerObject*>(srcObject)) { switch(messageType) { case radId_itemUse: { if (player->getPlacedInstrumentId() == this->getId()) { float range = gWorldConfig->getConfiguration<float>("Zone_Player_ItemUse",(float)6.0); if (!gWorldManager->objectsInRange(player->getId(), this->getId(), range)) { // We where out of range. (using 6.0 m as default range,this value not verified). // TODO: Find the proper error-message, the one below is a "made up". gMessageLib->SendSystemMessage(::common::OutOfBand("system_msg", "out_of_range"), player); return; } if ((player->getId() == this->getOwner()) && this->getPlaced()) { if ((player->getPerformingState() == PlayerPerformance_Music)) { gEntertainerManager->stopEntertaining(player); } else { // Start to play the copy. gEntertainerManager->usePlacedInstrument(player,this); } } else { // Create a new copy of the instrument. // gEntertainerManager->useInstrument(player,this); } } else { // We are handling the original instrument. auto equip_service = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::equipment::EquipmentService>("EquipmentService"); auto inventory = dynamic_cast<Inventory*>(equip_service->GetEquippedObject(player, "inventory")); if (inventory && inventory->getId() == this->getParentId()) { if (player->getPlacedInstrumentId() == 0) { // Create a new copy of the instrument. gEntertainerManager->useInstrument(player,this); } else if (dynamic_cast<CellObject*>(gWorldManager->getObjectById(this->getParentId()))) { // Is this my instrument? if (this->getOwner() == player->getId()) { if (!gWorldManager->objectsInRange(player->getId(), this->getId(), 6.0)) { // We where out of range. (using 6.0 m as default range,this value not verified). // TODO: Find the proper error-message, the one below is a "made up". gMessageLib->SendSystemMessage(::common::OutOfBand("system_msg", "out_of_range"), player); return; } if ((player->getPerformingState() == PlayerPerformance_Music)) { gEntertainerManager->stopEntertaining(player); } else { // Start to play the original. gEntertainerManager->usePlacedInstrument(player,this); } } } } } } break; default: { } break; } } }
bool UserCharacter::handleMessage(const Telegram& msg) { int damage = 0; //first see if the current goal accepts the message if (getBrain()->handleMessage(msg)) return true; //handle any messages not handles by the goals switch (msg.msg) { case MSG_TAKE_THAT_MF: //just return if already dead or spawning if (isDead()) return true; else { damage = dereferenceToType<int>(msg.extra_info); //the extra info field of the telegram carries the amount of damage // 아직 유저가 죽는것 안함. // reduceHealth(dereferenceToType<int>(msg.extra_info)); AbstCharacter* attacker = (AbstCharacter*)EntityMgr.getEntityFromID(msg.sender); getSensoryMemory()->updateWithDamageSource(attacker, damage); //if this bot is now dead let the shooter know if (isDead()) { int worth = getWorth(); Dispatcher.dispatchMsg( SEND_MSG_IMMEDIATELY, getId(), msg.sender, MSG_YOU_GOT_ME, (void*)&worth); // 내 가치를 죽인애한테 gold로 준다. } } return true; case MSG_YOU_GOT_ME: // 내가 누굴 죽였다고 메시지를 받음 setScore(getScore() + 1); // gold 추가 addGold(dereferenceToType<int>(msg.extra_info)); //the bot this bot has just killed should be removed as the target _target_system->clearTarget(); return true; case MSG_GUN_SHOT_SOUND: //add the source of this sound to the bot's percepts getSensoryMemory()->updateWithSoundSource((AbstCharacter*)msg.extra_info); return true; case MSG_USER_HAS_REMOVED_BOT: { AbstCharacter* pRemovedBot = (AbstCharacter*)msg.extra_info; getSensoryMemory()->removeBotFromMemory(pRemovedBot); //if the removed bot is the target, make sure the target is cleared if (pRemovedBot == getTargetSys()->getTarget()) { getTargetSys()->clearTarget(); } return true; } default: return false; } }
void IfcAlignment2DVertical::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcRoadEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<1 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcAlignment2DVertical, expecting 1, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcRoadException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>1 ){ std::cout << "Wrong parameter count for entity IfcAlignment2DVertical, expecting 1, having " << num_args << ". Object id: " << getId() << std::endl; } #endif readEntityReferenceList( args[0], m_Segments, map ); }
void IfcApproval::readStepArguments( const std::vector<std::string>& args, const std::map<int,shared_ptr<IfcPPEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<9 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcApproval, expecting 9, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcPPException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>9 ){ std::cout << "Wrong parameter count for entity IfcApproval, expecting 9, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_Identifier = IfcIdentifier::createObjectFromStepData( args[0] ); m_Name = IfcLabel::createObjectFromStepData( args[1] ); m_Description = IfcText::createObjectFromStepData( args[2] ); m_TimeOfApproval = IfcDateTime::createObjectFromStepData( args[3] ); m_Status = IfcLabel::createObjectFromStepData( args[4] ); m_Level = IfcLabel::createObjectFromStepData( args[5] ); m_Qualifier = IfcText::createObjectFromStepData( args[6] ); m_RequestingApproval = IfcActorSelect::createObjectFromStepData( args[7], map ); m_GivingApproval = IfcActorSelect::createObjectFromStepData( args[8], map ); }
void IfcStructuralSurfaceReaction::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcTunnelEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<10 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcStructuralSurfaceReaction, expecting 10, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcTunnelException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>10 ){ std::cout << "Wrong parameter count for entity IfcStructuralSurfaceReaction, expecting 10, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_GlobalId = IfcGloballyUniqueId::readStepData( args[0] ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::readStepData( args[2] ); m_Description = IfcText::readStepData( args[3] ); m_ObjectType = IfcLabel::readStepData( args[4] ); readEntityReference( args[5], m_ObjectPlacement, map ); readEntityReference( args[6], m_Representation, map ); readEntityReference( args[7], m_AppliedLoad, map ); m_GlobalOrLocal = IfcGlobalOrLocalEnum::readStepData( args[8] ); m_PredefinedType = IfcStructuralSurfaceActivityTypeEnum::readStepData( args[9] ); }
Property* OrthotropicSecantCoefficientOfThermalExpansion::clone(PropertyModel *propmodel, ParameterModel* paramodel) { OrthotropicSecantCoefficientOfThermalExpansion* prop; if (propmodel && paramodel) { prop = new OrthotropicSecantCoefficientOfThermalExpansion(propmodel, paramodel, getId()); } else { prop = new OrthotropicSecantCoefficientOfThermalExpansion(*this); } prop->setSorting(getSorting()); return prop; }
void IfcCurveStyleFont::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<Ifc2x3Entity> >& map ) { const int num_args = (int)args.size(); if( num_args<2 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcCurveStyleFont, expecting 2, having " << num_args << ". Object id: " << getId() << std::endl; throw Ifc2x3Exception( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>2 ){ std::cout << "Wrong parameter count for entity IfcCurveStyleFont, expecting 2, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_Name = IfcLabel::readStepData( args[0] ); readEntityReferenceList( args[1], m_PatternList, map ); }
void IfcRoof::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcRoadEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<9 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcRoof, expecting 9, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcRoadException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>9 ){ std::cout << "Wrong parameter count for entity IfcRoof, expecting 9, having " << num_args << ". Object id: " << getId() << std::endl; } #endif m_GlobalId = IfcGloballyUniqueId::readStepData( args[0] ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::readStepData( args[2] ); m_Description = IfcText::readStepData( args[3] ); m_ObjectType = IfcLabel::readStepData( args[4] ); readEntityReference( args[5], m_ObjectPlacement, map ); readEntityReference( args[6], m_Representation, map ); m_Tag = IfcIdentifier::readStepData( args[7] ); m_PredefinedType = IfcRoofTypeEnum::readStepData( args[8] ); }
std::string Event::str() const { std::ostringstream stream; stream << "#" << getId() << " (" << Helpers::eventTypeName(getType()) << ")"; return stream.str(); }