Enemy::Enemy(World *world, const std::vector<CL_Point>& wp, float speed, float hitpoints, int value, bool boss, bool alive) : GameObject(world), wayPoints(wp), speed(speed), defaultSpeed(speed), hitpoints(hitpoints), value(value), boss(boss), alive(alive) { // wenn weniger als zwei Wegpunkte übergeben werden -> Abbruch if (wayPoints.size() < 2) return; // Position auf ersten Wegpunkt setzen setPosition(wayPoints[0]); wayPoints.erase(wayPoints.begin()); // Ziel auf zweiten Wegpunkt setzen setTarget(wayPoints[0]); wayPoints.erase(wayPoints.begin()); }
PropertyFieldColour::PropertyFieldColour(IPropertyObj * obj, const Property * prop, PropertyGroup * _parent) : BaseLayout("PropertyFieldColour.layout", _parent->getClient()) , IPropertyField(obj, prop) , mText(nullptr) , mField(nullptr) { assignWidget(mText, "Text"); assignWidget(mField, "Field"); mText->setCaption(prop->name.c_wstr()); setTarget(obj); mField->eventMouseButtonPressed += MyGUI::newDelegate(this, &PropertyFieldColour::notifyMouseButtonPressed); }
UIDownloaderAdditions::UIDownloaderAdditions() { /* Prepare instance: */ if (!m_spInstance) m_spInstance = this; /* Prepare source/target: */ const QString &strName = QString("VBoxGuestAdditions_%1.iso").arg(vboxGlobal().vboxVersionStringNormalized()); const QString &strSource = QString("http://download.virtualbox.org/virtualbox/%1/").arg(vboxGlobal().vboxVersionStringNormalized()) + strName; const QString &strTarget = QDir(vboxGlobal().homeFolder()).absoluteFilePath(strName); /* Set source/target: */ setSource(strSource); setTarget(strTarget); }
void UnitBase::doMove2Pos(int xPos, int yPos, bool bForced) { if(attackMode == CAPTURE || attackMode == HUNT) { doSetAttackMode(GUARD); } if((xPos != destination.x) || (yPos != destination.y)) { clearPath(); findTargetTimer = 0; } setTarget(NULL); setDestination(xPos,yPos); setForced(bForced); setGuardPoint(xPos,yPos); }
void AttackComponent::handleMessage(CCMessage *message) { CCLOG("AttackComponent::handleMessage"); CCLOG("get message %d",message->getType()); GameEntity* target; switch(message->getType()){ case ATTACK: target=(GameEntity*)message->getData(); if(target){ setTarget(target); } attack(); break; case DIE: didTargetDie(); break; case SET_ATTACK_TARGET: setTarget((GameEntity*)message->getData()); break; } }
void IDBDatabase::connectionToServerLost(const IDBError& error) { LOG(IndexedDB, "IDBDatabase::connectionToServerLost - %" PRIu64, m_databaseConnectionIdentifier); ASSERT(currentThread() == originThreadID()); m_closePending = true; m_closedInServer = true; for (auto& transaction : m_activeTransactions.values()) transaction->connectionClosedFromServer(error); auto errorEvent = Event::create(m_eventNames.errorEvent, true, false); errorEvent->setTarget(this); if (auto* context = scriptExecutionContext()) context->eventQueue().enqueueEvent(WTFMove(errorEvent)); auto closeEvent = Event::create(m_eventNames.closeEvent, true, false); closeEvent->setTarget(this); if (auto* context = scriptExecutionContext()) context->eventQueue().enqueueEvent(WTFMove(closeEvent)); }
void MainWindow::on_pushButton_4_clicked() { //Prediction by Input (Recent selected Number) nvInput[0]=1.0; //Constant value = 1 // nvInput[45]=0.0; for(int i=0; i<45;i++) { nvInput[i+1]=0.0; } //번호 입력 /* int number; number = ui->spinBox->value();nvInput[number] = 1.0; number = ui->spinBox_2->value();nvInput[number] = 1.0; number = ui->spinBox_3->value();nvInput[number] = 1.0; number = ui->spinBox_4->value();nvInput[number] = 1.0; number = ui->spinBox_5->value();nvInput[number] = 1.0; number = ui->spinBox_6->value();nvInput[number] = 1.0; */ setTarget(0,0); forward(); QString text=""; QString temp; int rank[45]; for(int j=0;j<45;j++) { rank[j]=0; for(int k=0;k<45;k++) { if(j!=k) { if(nvOutput[j] < nvOutput[k]) rank[j]=rank[j]+1; } } } for(int i=0;i<45;i++) { if(rank[i]==0 || rank[i]==1 || rank[i]==2 || rank[i]==3 || rank[i]==4 || rank[i]==5) {temp=QString("%1[%2] \n").arg(i+1).arg(rank[i]).arg(nvOutput[i]); text.append(temp);} } ui->textBrowser->append(text); }
void Guard::update(sf::Time dT, std::vector<Wall> walls) { sf::Vector2f diff(this->getPosition() - _target); if(!_atTarget) { if(!_walking) { _walking = true; _animator.playAnimation("walking", true); } sf::Vector2f movement(0.f, 0.f); float rotation = std::atan2(diff.y, diff.x); this->setRotation((rotation * 180/3.124) - 90); movement.x = -std::cos(rotation) * _speed; movement.y = -std::sin(rotation) * _speed; this->move(movement * dT.asSeconds()); } if(abs(diff.x) <= 2 && abs(diff.y) <= 1) { if(_walking) { _walking = false; _animator.playAnimation("standing"); _waiting.restart(); _atTarget = true; } if(_waiting.getElapsedTime().asSeconds() >= 5) { setTarget(*_ppIt); _ppIt++; if(_ppIt == _patrolPoints.end()) _ppIt = _patrolPoints.begin(); _atTarget = false; } } _animator.update(dT); _animator.animate(*this); }
void UIDownloaderExtensionPack::handleDownloadedObject(UINetworkReply *pReply) { /* Read received data into the buffer: */ QByteArray receivedData(pReply->readAll()); /* Serialize that buffer into the file: */ while (true) { /* Try to open file for writing: */ QFile file(target()); if (file.open(QIODevice::WriteOnly)) { /* Write buffer into the file: */ file.write(receivedData); file.close(); /* Calc the SHA-256 on the bytes, creating a string: */ uint8_t abHash[RTSHA256_HASH_SIZE]; RTSha256(receivedData.constData(), receivedData.length(), abHash); char szDigest[RTSHA256_DIGEST_LEN + 1]; int rc = RTSha256ToString(abHash, szDigest, sizeof(szDigest)); if (RT_FAILURE(rc)) { AssertRC(rc); szDigest[0] = '\0'; } /* Warn the listener about extension-pack was downloaded: */ emit sigDownloadFinished(source().toString(), target(), &szDigest[0]); break; } /* Warn the user about extension-pack was downloaded but was NOT saved: */ msgCenter().warnAboutExtentionPackCantBeSaved(GUI_ExtPackName, source().toString(), QDir::toNativeSeparators(target())); /* Ask the user for another location for the extension-pack file: */ QString strTarget = QIFileDialog::getExistingDirectory(QFileInfo(target()).absolutePath(), msgCenter().networkManagerOrMainWindowShown(), tr("Select folder to save %1 to").arg(GUI_ExtPackName), true); /* Check if user had really set a new target: */ if (!strTarget.isNull()) setTarget(QDir(strTarget).absoluteFilePath(QFileInfo(target()).fileName())); else break; } }
void ScintillaWrapper::replaceWholeLine(int lineNumber, boost::python::object newContents) { int start = PositionFromLine(lineNumber); int end; if (GetLineCount() > lineNumber) { end = PositionFromLine(lineNumber + 1); } else { end = GetLength(); } setTarget(start, end); ReplaceTarget(newContents); }
void UnitBase::deviate(House* newOwner) { if(newOwner->getHouseID() == originalHouseID) { quitDeviation(); } else { removeFromSelectionLists(); setTarget(NULL); setGuardPoint(location); setDestination(location); clearPath(); doSetAttackMode(GUARD); owner = newOwner; graphic = pGFXManager->getObjPic(graphicID,getOwner()->getHouseID()); deviationTimer = DEVIATIONTIME; } }
void *control_main(){ do{ if(rpi_hasReceived && isReady()){ rpi_hasReceived = 0; // printf("-------------------------------\n"); printf("[RPI] Received: %s\n", input); // Split Command int result = splitString(input, "<", inputPtr, 2); if(result == 2){ message_size = strlen(inputPtr[1]); tempCommand = inputPtr[1]; // printf("Target: %s\n", inputPtr[0]); // printf("Target Length: %d\n", strlen(inputPtr[0])); // printf("Target Size: %d\n", sizeof(inputPtr[0])); // printf("Message: %s\n", inputPtr[1]); // printf("Message Length: %d\n", strlen(inputPtr[1])); // printf("Message Size: %d\n", sizeof(inputPtr[1])); // printf("-------------------------------\n"); memset(output, 0, sizeof(output)); strncpy(output, tempCommand, strlen(tempCommand)); for(i = 0; i < strlen(inputPtr[0]); i++){ setTarget((&input[0])[i]); } } // }else{ // memset(output, 0, sizeof(output)); // strncpy(output, "Invalid Command: ", 17); // strcat(output, input); // setTarget(sender); // } //printf("%d:%d:%d\n", arduino_isWriting, bt_isWriting, tcp_isWriting); } if(tcp_isReconnected){ tcp_isReconnected = 0; onReady(); } }while(1); }
void EG_ThirdPersonPovCamera::Control(pipeline& m_pipeline, EG_SkyBox& skybox) { float pitchChange = 0.0f; float yawChange = 0.0f; float forwardSpeed = 0.0f; if(mouse_in) { SDL_ShowCursor(SDL_DISABLE); Uint8* state=SDL_GetKeyState(NULL); if(state[SDLK_w]) { forwardSpeed = BALL_FORWARD_SPEED; pitchChange = -BALL_ROLLING_SPEED; } if(state[SDLK_s]) { forwardSpeed = -BALL_FORWARD_SPEED; pitchChange = BALL_ROLLING_SPEED; } if(state[SDLK_a]) yawChange = -BALL_HEADING_SPEED; if(state[SDLK_d]) yawChange = BALL_HEADING_SPEED; /// update the character first /// When moving backwards invert rotations to match direction of travel. /// When we drive backwards, our car actually turn leftwards when we steer rightwards m_characterObject.setVelocity(0.0f, 0.0f, forwardSpeed); m_characterObject.setAngularVelocity(0.0f, -yawChange, 0.0f); updateCharacterObject(0.0f, -yawChange, 0.0f); setTarget(m_characterObject.getPosition()); update(m_pipeline, 0.031f, 0.0f, (forwardSpeed >= 0.0f) ? yawChange : -yawChange, skybox); } }
PIDControllerArm::PIDControllerArm(Talon* armMotor, AnalogInput* potentiometer, ConfigEditor* configEditor, float upperLimit, float lowerLimit): m_armMotor(armMotor), m_potentiometer(potentiometer), m_configEditor(configEditor), m_upperLimit(upperLimit), m_lowerLimit(lowerLimit){ m_potentiometer->SetPIDSourceType(PIDSourceType::kDisplacement); m_controller = new PIDController(m_configEditor->getFloat("armP", 4.00), 0.001, 0.00, m_potentiometer, this); m_controller->SetTolerance(0.5); m_controller->SetPIDSourceType(PIDSourceType::kDisplacement); m_controller->SetOutputRange(-0.5, 0.5); m_controller->Enable(); setTarget(1.0); }
UIDownloaderUserManual::UIDownloaderUserManual() { /* Prepare instance: */ if (!m_spInstance) m_spInstance = this; /* Compose User Manual filename: */ QString strUserManualFullFileName = vboxGlobal().helpFile(); QString strUserManualShortFileName = QFileInfo(strUserManualFullFileName).fileName(); /* Add sources: */ addSource(QString("http://download.virtualbox.org/virtualbox/%1/").arg(vboxGlobal().vboxVersionStringNormalized()) + strUserManualShortFileName); addSource(QString("http://download.virtualbox.org/virtualbox/") + strUserManualShortFileName); /* Set target: */ QString strUserManualDestination = QDir(vboxGlobal().homeFolder()).absoluteFilePath(strUserManualShortFileName); setTarget(strUserManualDestination); }
/** * Creates a new Item object. * * @param target item target - NULL ALLOWED * @param source item source - NULL ALLOWED * @param targetParent item target parent - NULL ALLOWED (DEFAULT) * @param sourceParent item source parent - NULL ALLOWED (DEFAULT) * @param meta item meta data - NULL ALLOWED * @param data item data - NULL ALLOWED * */ Item::Item( Target* target, Source* source, char* tParent, char* sParent, Meta* meta , ComplexData* data, bool moreData) { initialize(); setTarget(target); setSource(source); setTargetParent(tParent); setSourceParent(sParent); setMeta(meta); setData(data); setMoreData(moreData); }
bool RenderablePlaneProjection::initialize() { glGenVertexArrays(1, &_quad); // generate array glGenBuffers(1, &_vertexPositionBuffer); // generate buffer // Plane program if (_shader == nullptr) { // Image Plane Program RenderEngine& renderEngine = OsEng.renderEngine(); _shader = renderEngine.buildRenderProgram("Image Plane", "${MODULE_BASE}/shaders/imageplane_vs.glsl", "${MODULE_BASE}/shaders/imageplane_fs.glsl"); if (!_shader) return false; } setTarget(_defaultTarget); loadTexture(); return isReady(); }
void UnitBase::setLocation(int xPos, int yPos) { if((xPos == INVALID_POS) && (yPos == INVALID_POS)) { ObjectBase::setLocation(xPos, yPos); } else if (currentGameMap->tileExists(xPos, yPos)) { ObjectBase::setLocation(xPos, yPos); realX += TILESIZE/2; realY += TILESIZE/2; bumpyOffsetX = 0.0f; bumpyOffsetY = 0.0f; } moving = false; pickedUp = false; setTarget(NULL); clearPath(); }
void UnitBase::doMove2Object(const ObjectBase* pTargetObject) { if(pTargetObject->getObjectID() == getObjectID()) { return; } if(attackMode == CAPTURE || attackMode == HUNT) { doSetAttackMode(GUARD); } setDestination(INVALID_POS,INVALID_POS); setTarget(pTargetObject); setForced(true); bFollow = true; clearPath(); findTargetTimer = 0; }
bool CSettingDependencyCondition::Deserialize(const TiXmlNode *node) { if (!CSettingConditionItem::Deserialize(node)) return false; const TiXmlElement *elem = node->ToElement(); if (elem == NULL) return false; m_target = SettingDependencyTargetSetting; const char *strTarget = elem->Attribute(SETTING_XML_ATTR_ON); if (strTarget != NULL && !setTarget(strTarget)) { CLog::Log(LOGWARNING, "CSettingDependencyCondition: unknown target \"%s\"", strTarget); return false; } if (m_target != SettingDependencyTargetSetting && m_name.empty()) { CLog::Log(LOGWARNING, "CSettingDependencyCondition: missing name for dependency"); return false; } if (m_target == SettingDependencyTargetSetting) { if (m_setting.empty()) { CLog::Log(LOGWARNING, "CSettingDependencyCondition: missing setting for dependency"); return false; } m_name = m_setting; } m_operator = SettingDependencyOperatorEquals; const char *strOperator = elem->Attribute(SETTING_XML_ATTR_OPERATOR); if (strOperator != NULL && !setOperator(strOperator)) { CLog::Log(LOGWARNING, "CSettingDependencyCondition: unknown operator \"%s\"", strOperator); return false; } return true; }
// updateObject // update object by frame... void CGameCamera::updateObject() { CGameObject::updateObject(); if ( m_enable && m_targetObject ) { // look target setTarget( m_targetObject->getPosition() ); } #ifdef GSEDITOR else { if ( getIView()->getActiveCamera() == this ) m_targetPos = m_camera->getTarget(); } // maybe modify by free animator core::vector3df pos = m_camera->getPosition(); setPosition( pos ); if ( getIView()->getActiveCamera() == this ) m_cameraMesh->setVisible( false ); else { m_cameraMesh->setVisible( true ); m_node = m_cameraMesh; core::vector3df rot = m_targetPos - m_position; setOrientation( rot ); m_node = m_camera; } #endif #ifdef GSGAMEPLAY if ( m_camera->getAnimators().size() > 0 ) { m_position = m_camera->getPosition(); if ( m_targetObject == NULL ) m_targetPos = m_camera->getTarget(); } #endif }
void GrooveDialog::OnInitDlg() { GrooveTemplateHandler *me = GrooveTemplateHandler::Instance(); currentDir = me->GetGrooveDir(); SetWindowText(m_hwnd, __LOCALIZE("Groove tool","sws_DLG_157")); SetDlgItemInt(m_hwnd, IDC_STRENGTH, me->GetGrooveStrength(), true); SetDlgItemInt(m_hwnd, IDC_VELSTRENGTH, me->GetGrooveVelStrength(), true); setSensitivity(m_hwnd, me->GetGrooveTolerance()); setTarget(m_hwnd, me->GetGrooveTarget() == TARGET_ITEMS); m_resize.init_item(IDC_GROOVELIST, 0.0, 0.0, 0.0, 1.0); SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_STRENGTH), GWLP_USERDATA, 0xdeadf00b); SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_VELSTRENGTH), GWLP_USERDATA, 0xdeadf00b); RefreshGrooveList(); }
void QuestionBox::setWith(vector<string> options) { int nOptions = options.size(); buttons.resize(0); bounds.height = options.size() * (OPTION_HEIGHT + PADDING *2); setTarget(_targetXY); for (int iOption=0; iOption<nOptions; iOption++) { buttons.push_back(new Button(bounds.x+PADDING,bounds.y+PADDING+ iOption*(OPTION_HEIGHT+PADDING), OPTION_WIDTH, OPTION_HEIGHT, options[iOption])); buttons[iOption]->action+= Delegate<QuestionBox, int>(this, &QuestionBox::button_hit); } enabled = true; }
void ActionTake::executeImp (const Ptr& actor) { // When in GUI mode, we should use drag and drop if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr()) { MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode(); if (mode == MWGui::GM_Inventory || mode == MWGui::GM_Container) { MWBase::Environment::get().getWindowManager()->getInventoryWindow()->pickUpObject(getTarget()); return; } } MWBase::Environment::get().getMechanicsManager()->itemTaken( actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount()); MWWorld::Ptr newitem = *actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor); MWBase::Environment::get().getWorld()->deleteObject (getTarget()); setTarget(newitem); }
void Leg::synchronizeRemote(const Vec3f& remoteFoot){ if(!remote) { // This is an incoming command. Call methods to change state. setTarget(remoteFoot, true); } else { this->foot = remoteFoot; // Update actuator lengths based on foot ActLens newLens = solveIK(foot); actuators[0].setTarget(newLens.a); actuators[0].update(); actuators[1].setTarget(newLens.b); actuators[1].update(); actuators[2].setTarget(newLens.c); actuators[2].update(); } }
void AutoAttackComponent::handleMessage(CCMessage *message) { GameEntity* target; switch(message->getType()){ case AUTO_ATTACK: target=(GameEntity*)message->getData(); if(target){ setTarget(target); } attack(); break; default: AttackComponent::handleMessage(message); break; } }
//---------------------------------------------------------------------- // constructor //---------------------------------------------------------------------- EffectTransportCreature::EffectTransportCreature (Creature *pCreature, ZoneID_t zoneID , ZoneCoord_t x , ZoneCoord_t y , Turn_t delay) throw(Error) { __BEGIN_TRY Assert(pCreature!=NULL); Assert(pCreature->getZone()!=NULL); m_CreatureID = pCreature->getObjectID(); m_ZoneID = zoneID; m_pZone = pCreature->getZone(); // 그냥 다른 곳에서의 assert때문에 setTarget(pCreature); setDeadline(delay); setNextTime(0); // 서버 전용 Effect이다. by sigi. 2002.11.14 m_bBroadcastingEffect = false; __END_CATCH }
void KviQueryWindow::setAliveQuery() { m_iFlags &= ~Dead; KviIrcUserDataBase * pUserDataBase = connection()->userDataBase(); m_pUserListView->setUserDataBase(pUserDataBase); setType(KviWindow::Query); if(context()) context()->unregisterDeadQuery(this); if(connection()) connection()->registerQuery(this); QString szNick = target(); if(!szNick.isEmpty()) { QString szUser; QString szHost; if(pUserDataBase) { KviIrcUserEntry * pEntry = pUserDataBase->find(szNick); if(pEntry) { szUser = pEntry->user(); szHost = pEntry->host(); } } setTarget(szNick, szUser, szHost); } // Update log file name if(m_pIrcView->isLogging()) m_pIrcView->startLogging(); updateIcon(); }
int QDeclarativeConnections::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 1) qt_static_metacall(this, _c, _id, _a); _id -= 1; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QObject**>(_v) = target(); break; case 1: *reinterpret_cast< bool*>(_v) = ignoreUnknownSignals(); break; } _id -= 2; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setTarget(*reinterpret_cast< QObject**>(_v)); break; case 1: setIgnoreUnknownSignals(*reinterpret_cast< bool*>(_v)); break; } _id -= 2; } else if (_c == QMetaObject::ResetProperty) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 2; } #endif // QT_NO_PROPERTIES return _id; }
void Tower_Pin::sync_None() { for (vector<TowerBullet_UI*>::iterator it = bullet_queue.begin(); it != bullet_queue.end();) { if ((*it)->isDone == true) { (*it)->Destory(target); bullet_queue.erase(it); } else { ++it; } } setTarget(0); }