void SkyMap::mouseReleaseEvent( QMouseEvent * ) { if ( ZoomRect.isValid() ) { stopTracking(); SkyPoint newcenter = projector()->fromScreen( ZoomRect.center(), data->lst(), data->geo()->lat() ); setFocus( &newcenter ); setDestination( newcenter ); //Zoom in on center of Zoom Circle, by a factor equal to the ratio //of the sky pixmap's width to the Zoom Circle's diameter float factor = float(width()) / float(ZoomRect.width()); setZoomFactor( Options::zoomFactor() * factor ); } setDefaultMouseCursor(); ZoomRect = QRect(); //invalidate ZoomRect if(m_previewLegend) { slotCancelLegendPreviewMode(); } //false if double-clicked, because it's unset there. if (mouseButtonDown) { mouseButtonDown = false; if ( slewing ) { slewing = false; if ( Options::useAltAz() ) setDestinationAltAz( focus()->alt(), focus()->az() ); else setDestination( *focus() ); } forceUpdate(); // is needed because after moving the sky not all stars are shown } // if middle button was pressed unset here midMouseButtonDown = false; }
void LocalPlayer::setGotoTarget(Being *target) { mLastTarget = -1; #ifdef TMWSERV_SUPPORT mTarget = target; mGoingToTarget = true; const Vector &targetPos = target->getPosition(); setDestination(targetPos.x, targetPos.y); #else setTarget(target); mGoingToTarget = true; setDestination(target->getTileX(), target->getTileY()); #endif }
Nuria::Debug::Debug (Type type, const char *module, const char *fileName, int line, const char *className, const char *methodName) : QDebug (&m_buffer), m_type (type), m_line (line), m_module (module), m_file (0), m_class (className), m_method (methodName) { // Skip path from fileName. Look for a backslash on windows. #ifndef Q_OS_WIN const char *baseName = strrchr (fileName, '/'); #else const char *baseName = strrchr (fileName, '\\'); #endif if (baseName) { this->m_file = QLatin1String (baseName + 1); } else { this->m_file = QLatin1String (fileName); } // Init the output device if not already done. if (!g_device) { setDestination (stdout); } }
void UnitBase::doAttackObject(const ObjectBase* pTargetObject, bool bForced) { if (pTargetObject == NULL) { return; } if(pTargetObject->getObjectID() == getObjectID() || (!canAttack() && getItemID() != Unit_Harvester)) { return; } if(attackMode == CAPTURE) { doSetAttackMode(GUARD); } setDestination(INVALID_POS,INVALID_POS); setTarget(pTargetObject); // hack to make it possible to attack own repair yard if(goingToRepairYard && target && (target.getObjPointer()->getItemID() == Structure_RepairYard)) { ((RepairYard*)target.getObjPointer())->unBook(); goingToRepairYard = false; } setForced(bForced); clearPath(); findTargetTimer = 0; }
Wire::Wire(Port* source, Port* destination, QString id, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsPathItem(parent, scene) { setSource(source); setDestination(destination); setId(id); QPointF src = mapFromItem(d_source, 0, 0); QPointF dest = mapFromItem(d_destination, 0, 0); d_half = src + (dest-src)/2; segment = new QGraphicsRectItem(this); segment->setFlag(QGraphicsItem::ItemIsMovable, true); segment->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); segment->setFlag(QGraphicsItem::ItemIsSelectable, true); segment->setRect(-2,0,4,4); segment->setBrush(QBrush(Qt::black)); //segment->setLine(d_half.x(),src.y(),d_half.x(),dest.y()); //this->scene()->addItem(segment); //scene->addItem(segment); QPointF half = mapToScene(d_half); segment->setPos(half); //setFlag(QGraphicsItem::ItemIsMovable, true); setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); updatePosition(); }
Wire::Wire(Wire& ref) : QGraphicsPathItem(ref.parentItem(), ref.scene()) { setSource(ref.source()); setDestination(ref.destination()); setId(ref.id()); }
SolidDeviceService::SolidDeviceService (SolidDeviceEngine* parent, const QString& source) : Plasma::Service (parent), m_engine(parent) { setName ("soliddevice"); setDestination (source); }
//method called by Passenger to update visitor's location, state. int VisitorTerminalBehavior::update( ElapsedTime _time, Point _OwnerPreLocation, bool _bBackup ) { int nNextState = GetOwner()->getState(); PaxTerminalBehavior* spTerminalBehavior = (PaxTerminalBehavior*)GetOwner()->getBehavior(MobElementBehavior::TerminalBehavior); if (spTerminalBehavior == NULL) { return 1; } if (IfHaveOwnFlow(_time)) { //////create ConvergePair,and add to GreetPool. 6.21.2004 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ TrayHostList* pTrayHostList = m_pTerm->GetTrayHostList(); if (pTrayHostList->IfNonPaxExsit(m_pPerson->getType().GetTypeIndex()) && !m_bInTray) { spTerminalBehavior->CopyVisitListToTrayHost(_time); } if (pTrayHostList->FindHostItem(m_pPerson->getType().GetTypeIndex()) || !pTrayHostList->IfNonPaxExsit(m_pPerson->getType().GetTypeIndex())\ || (pTrayHostList->IfNonPaxExsit(m_pPerson->getType().GetTypeIndex()) && !m_bInTray)) { if (!spTerminalBehavior->StickForDestProcsOverload(_time) && !StickNonPaxDestProcsOverload(_time)) { GetVisitor()->NewConvergePair(GetOwnerId(),true); if(GetOwner()) GetOwner()->NewConvergePair(m_pPerson->getID(),m_pPerson->getType().GetTypeIndex()); m_pPerson->setState(FreeMoving); m_nFreeMoving = 1; m_nFreeMovingIndex = m_pPerson->getLogEntry().getCurrentCount(); // m_bWithOwner = false; m_pPerson->m_pGroupInfo->SetFollowerWithOwner(false); setDestination(_OwnerPreLocation); ElapsedTime eTime = _time + moveTime(); generateEvent(eTime,false); if( getNextProcessor( eTime ) ) generateEvent( eTime+moveTime(),false );// return 0; } return 1; } return 0; } m_pPerson->setState(nNextState); m_nQueuePathSegmentIndex = spTerminalBehavior->getCurrentIndex(); m_pProcessor = spTerminalBehavior->getProcessor(); CString sstr1= m_pProcessor->getID()->GetIDString(); // write log entry //writeLog( _time ); //CString _strOwnerProcessor = m_pOwnerPax->getProcessor()->getID()->GetIDString(); GetVisitor()->writeVisitorLog( _time,_OwnerPreLocation, _bBackup, false); return 1; }
////////////////////////////////////////////////////////////////////////// //write log itself int VisitorLandsideBehavior::WriteLogEntry(ElapsedTime time, int ntype,bool _bBackup /*= false*/, bool bOffset /*= true */ ) { MobEventStruct track; track.time = (long)time; track.state = m_pPerson->getState(); track.procNumber = -1; track.bDynamicCreatedProc = FALSE; track.reason = -1; track.backup = _bBackup; track.followowner = false; track.m_IsRealZ = TRUE; //LandsideBaseBehavior* spLandsideBehavior = getLBehavior(); //if (spLandsideBehavior == NULL) // return false; ////resource index //if(spOnboardBehavior->GetCurrentResource()) // track.procNumber = spOnboardBehavior->GetCurrentResource()->GetResourceID(); //else track.procNumber = -1; //visitor follow with passenger if(m_pPerson->getType().GetTypeIndex() != 0 && m_pPerson->getType().GetTypeIndex() == 0) { // get object's Altitude CNonPaxRelativePosSpec* pNonPaxRelPosSpec = m_pPerson->GetTerminal()->GetNonPaxRelativePosSpec(); ASSERT( NULL != pNonPaxRelPosSpec ); CPoint2008 ptRelatePos; ARCVector4 rotation; pNonPaxRelPosSpec->GetNonPaxRelatePosition(ptRelatePos, rotation, m_pPerson->getType().GetTypeIndex(),ntype); track.m_RealZ = (float)ptRelatePos.getZ(); track.m_bWithOwner = true; if (track.m_bWithOwner) { track.m_bVisible = pNonPaxRelPosSpec->GetTypeItemVisible(m_pPerson->getType().GetTypeIndex()); } } pure_location= m_ptDestination; if (location != m_ptDestination) { location = m_ptDestination; setDestination( location ); } track.x = static_cast<float>(getPoint().n[VX]); track.y = static_cast<float>(getPoint().n[VY]); track.z = static_cast<short>(getPoint().n[VZ]); track.m_RealZ += track.z; //TRACE("\r\nTime: %d X = %f, Y = %f, Z = %f \r\n", track.time, track.x, track.y, track.z); m_pPerson->getLogEntry().addEvent (track); // if simulation stops here, it means memory insufficient. writeFollowerLog(time,_bBackup, bOffset); return true; }
void Monster::update() { Being::update(); if (mKillStealProtectedTimeout.justFinished()) mOwner = NULL; // If dead, remove it if (mAction == DEAD) { if (mDecayTimeout.expired()) GameState::enqueueRemove(this); return; } if (mSpecy->getUpdateCallback().isValid()) { Script *script = ScriptManager::currentState(); script->setMap(getMap()); script->prepare(mSpecy->getUpdateCallback()); script->push(this); script->execute(); } // Cancel the rest when we are currently performing an attack if (!mAttackTimeout.expired()) return; refreshTarget(); if (!mTarget) { // We have no target - let's wander around if (mStrollTimeout.expired() && getPosition() == getDestination()) { if (mKillStealProtectedTimeout.expired()) { unsigned range = mSpecy->getStrollRange(); if (range) { Point randomPos(rand() % (range * 2 + 1) - range + getPosition().x, rand() % (range * 2 + 1) - range + getPosition().y); // Don't allow negative destinations, to avoid rounding // problems when divided by tile size if (randomPos.x >= 0 && randomPos.y >= 0) setDestination(randomPos); } mStrollTimeout.set(10 + rand() % 10); } } } if (mAction == ATTACK) processAttack(); }
void TurretClass::DoAttackObject(Uint32 TargetObjectID) { ObjectClass* pObject = currentGame->getObjectManager().getObject(TargetObjectID); if(pObject == NULL) { return; } setDestination(INVALID_POS,INVALID_POS); setTarget(pObject); setForced(true); }
void UnitBase::releaseTarget() { if(forced == true) { guardPoint = location; } setDestination(guardPoint); findTargetTimer = 0; setForced(false); setTarget(NULL); }
void Nuria::Debug::setDestination (FILE *handle) { // Create a QFile from handle QFile *device = new QFile; device->open (handle, QIODevice::WriteOnly); // Set device setDestination (device); }
void ArrivalPaxLandsideBehavior::ProcessGetOffVehicle( const ElapsedTime& eEventTime ) { //get vehicle //get //the position where the vehicle stops // WriteLogEntry(eEventTime); setState(GetOffVehicle); setDestination(m_pVehicle->getLastState().pos); //setLocation(m_pVechile->getState().pos); WriteLogEntry(eEventTime); CPoint2008 nextPt(0,0,0); LandsideBusStationInSim* pBusStation = NULL; if( LandsideResourceInSim* pRes = getResource()) { pBusStation = pRes->toBusSation(); if ( pBusStation) { nextPt = pBusStation->GetPaxWaitPos(); } } //move outside vehicle CPoint2008 nextpos = m_pVehicle->getOffVehiclePos(nextPt); setDestination(nextpos); ElapsedTime eMovetime = moveTime(); ElapsedTime eCurTime = eMovetime + eEventTime; //setLocation(nextpos); WriteLogEntry(eCurTime); m_pVehicle->RemoveOnPax(this, eCurTime); //start to pick the Bag m_pPerson->setState(PickCarryOnFromVehicle); GenerateEvent(eCurTime); }
/** * Moves the craft to its destination. */ void Craft::think() { move(); if (reachedDestination() && _dest == (Target*)_base) { setInterceptionOrder(0); checkup(); setDestination(0); setSpeed(0); _lowFuel = false; } }
MultiplexedService::MultiplexedService(Multiplexer *multiplexer, QObject *parent) : Plasma::Service(parent) { setObjectName(Multiplexer::sourceName + QLatin1String(" controller")); setName("mpris2"); setDestination(Multiplexer::sourceName); connect(multiplexer, SIGNAL(activePlayerChanged(PlayerContainer*)), this, SLOT(activePlayerChanged(PlayerContainer*))); activePlayerChanged(multiplexer->activePlayer()); }
Attr_ReadValue Teleport::readAttr(AttrTypes_t attr, PropStream& propStream) { if(attr != ATTR_TELE_DEST) return Item::readAttr(attr, propStream); TeleportDest* dest; if(!propStream.GET_STRUCT(dest)) return ATTR_READ_ERROR; setDestination(Position(dest->_x, dest->_y, dest->_z)); return ATTR_READ_CONTINUE; }
void UnitBase::quitDeviation() { if(wasDeviated()) { // revert back to real owner removeFromSelectionLists(); setTarget(NULL); setGuardPoint(location); setDestination(location); owner = currentGame->getHouse(originalHouseID); graphic = pGFXManager->getObjPic(graphicID,getOwner()->getHouseID()); deviationTimer = INVALID; } }
void ArrivalPaxLandsideBehavior::processGetOnVehicle_old( const ElapsedTime& t ) { WriteLogEntry(t); //get on to vehicle ARCVector3 vehiclepos = m_pVehicle->getState(t).pos; setDestination(vehiclepos); ElapsedTime etime = moveTime(); //setLocation(vehiclepos); WriteLogEntry(etime + t); m_pPerson->setState(On_Vehicle); GenerateEvent(etime+t); }
X10Service::X10Service(X10Engine* engine, const QString& source) : Plasma::Service(engine) , m_engine(engine) { if (source.isEmpty()) setName("service"); // -> service.operations else setName("unit"); // -> unit.operations setDestination(source); updateEnabledOperations(); }
void ConverterPage::setDestination( const QString & destination ) { if( destination.isEmpty() ) { SDialogTools::getSaveFileName( this , this , SLOT(setDestination(QString)) , tr("Set Destination path") ); p->start_action->setDisabled( true ); return; } p->start_action->setEnabled( !p->src_line->text().isEmpty() ); p->dst_line->setText( destination ); p->converter->setDestination( destination , p->cline->destinationType() ); }
void ArrivalPaxLandsideBehavior::ProcessMoveToVehicle( const ElapsedTime& eEventTime ) { WriteLogEntry(eEventTime); //get on to vehicle ARCVector3 vehiclepos = m_pVehicle->getState(eEventTime).pos; setDestination(vehiclepos); ElapsedTime eMovetime = moveTime(); ElapsedTime eCurTime = eMovetime + eEventTime; //setLocation(vehiclepos); WriteLogEntry(eCurTime); m_pPerson->setState(PutCarryonToVehicle); GenerateEvent(eCurTime); }
void UnitBase::deploy(const Coord& newLocation) { if(currentGameMap->tileExists(newLocation)) { setLocation(newLocation); if (guardPoint.isInvalid()) guardPoint = location; setDestination(guardPoint); pickedUp = false; setRespondable(true); setActive(true); setVisible(VIS_ALL, true); } }
PlayerControl::PlayerControl(PlayerContainer* container, QObject* parent) : Plasma::Service(parent) , m_container(container) { setObjectName(container->objectName() + QLatin1String(" controller")); setName("mpris2"); setDestination(container->objectName()); connect(container, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)), this, SLOT(updateEnabledOperations())); connect(container, SIGNAL(destroyed(QObject*)), this, SLOT(containerDestroyed())); updateEnabledOperations(); }
void UnitBase::doAttackPos(int xPos, int yPos, bool bForced) { if(attackMode == CAPTURE) { doSetAttackMode(GUARD); } setDestination(xPos,yPos); setTarget(NULL); setForced(bForced); attackPos.x = xPos; attackPos.y = yPos; clearPath(); findTargetTimer = 0; }
void LocalPlayer::pickUp(FloorItem *item) { int dx = item->getX() - (int) getPosition().x / 32; int dy = item->getY() - (int) getPosition().y / 32; if (dx * dx + dy * dy < 4) { Net::getPlayerHandler()->pickUp(item); mPickUpTarget = NULL; } else { #ifdef TMWSERV_SUPPORT setDestination(item->getX() * 32 + 16, item->getY() * 32 + 16); #else setDestination(item->getX(), item->getY()); #endif mPickUpTarget = item; #ifdef EATHENA_SUPPORT stopAttack(); #endif } }
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); }
//----------------------------------------------------------------------------------------- // randomize automated movements //----------------------------------------------------------------------------------------- void Robot::aiSetDestination(){ //randomize shooting int randomNum = rand() % 15; if(randomNum == 7 || randomNum == 9){ shootBullet(); } //randomize destination if((checkXDestination() && checkZDestination())){ int randomNum2 = rand() % 10; switch(randomNum2){ case 0: case 1: case 2: case 3: case 4: if(checkXPos(false)){ setDestination(xPos-ROBOT_LOOK_SIZE-1, zPos); } break; case 5: case 6: if(checkZPos(false)){ setDestination(xPos, zPos-ROBOT_LOOK_SIZE); } break; case 8: if(checkZPos(true)){ setDestination(xPos, zPos+ROBOT_LOOK_SIZE); } break; case 9: if(checkXPos(true)){ setDestination(xPos+ROBOT_LOOK_SIZE, zPos); } break; default: break; } } }
void setup(){ // configure serial communications Serial.begin(9600); // configure output pins pinMode(txLed, OUTPUT); pinMode(rxLed, OUTPUT); pinMode(analogLed, OUTPUT); delay(1000); // set XBee's destination addr setDestination(); // blink the TX LED indicating main program about to start blink(3); }
void RoboMiner::process(MineralStore& ores) { if(isFull()) return; cargo += ores; if(isFull()){ std::cout << "Cargo Full: Returning to base (" << base->getY() << "," << base->getX() << ")..." << std::endl; listCargo(); setLastMinedOre(cell_y, cell_x); setDestination(base->getY(), base->getX()); } }