Exemple #1
0
	public: void free(){
		for(int iside=0; iside<4; iside++){
			Side* side = getSide(iside);
			if(side != NULL)
				for(int jrib=0; jrib<4; jrib++){
					if(this == side->getRib(jrib)){
						side->setRib(NULL, jrib);
						break;
					}
				}
		}

		for(int icell=0; icell<4; icell++){
			Cell* cell = getCell(icell);
			if(cell != NULL)
				for(int jrib=0; jrib<4; jrib++){
					if(this == cell->getRib(getAxis(), jrib)){
						cell->setRib(getAxis(), jrib, NULL);
						break;
					}
				}
		}

		for(int i=0; i<4; i++){
			setSide(i, NULL);
			setCell(i, NULL);
		}
//cout << "delete " << this << endl;;
		delete this;
	}
Exemple #2
0
Paddle :: Paddle()
{
	rect.width	= 40;
	rect.height	= 200;
	
	setColor( 0x000000 );
	setSide( 0 );
	setPosition( 0.5 );
}
FilterLineEdit::FilterLineEdit(QWidget *parent) :
   FancyLineEdit(parent),
   m_lastFilterText(text())
{
    setSide(Utils::FancyLineEdit::Right);
    setPlaceholderText(tr("Filter"));
    setButtonToolTip(tr("Clear text"));
    setAutoHideIcon(true);
    connect(this, SIGNAL(buttonClicked()), this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
}
FilterLineEdit::FilterLineEdit(QWidget *parent) :
   FancyLineEdit(parent),
   m_lastFilterText(typedText())
{
    setSide(FancyLineEdit::Right);   
    setPixmap(QPixmap(QLatin1String(":/style/images/reset.png")));
    setHintText(tr("Type to filter"));

    connect(this, SIGNAL(buttonClicked()), this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
}
void BoardController::_moveFigure(int from, int to, Figure::Type displacer_type, Figure::Side displacer_side)
{
    std::swap(m_figures[from], m_figures[to]);
    auto displacer = m_figures[from];
    displacer->setType(displacer_type);
    displacer->setSide(displacer_side);

    qDebug() << "Move from " << from  << " to " << to;

    emit boardChanged(board());
}
Exemple #6
0
Turret::Turret(Map* map, uint32 id, const std::string& name, float x, float y, float hp, float ad, int side) : Unit(map, id, "", new TurretStats(), 50, x, y, 0), name(name)  {
   stats->setCurrentHealth(hp);
   stats->setMaxHealth(hp);
   stats->setBaseAd(ad);
   stats->setRange(TURRET_RANGE);
   
   autoAttackDelay = 4.95/30;
   autoAttackProjectileSpeed = 1200;
   
   setSide(side);
}
Exemple #7
0
	ProgresBar::ProgresBar(const Vector2f& _pos, const Vector2f& _wh, const sf::Color& clUp, const sf::Color& clDown, float pAc, float pMax, const sf::Vector2f& _side)
		: lockProgres(true)
	{
		add(bDown = new Button(_pos, _wh, "", clDown, clDown, sf::Color::Black));
		add(bUp = new Button(_pos, _wh, "", clUp, clUp, sf::Color::Black));

		setSide(_side);

		setProgresMax(pMax);
		setProgres(pAc);
	}
void SteeringVehicle::resetLocalSpace()
{
	setForward(mForwardVector);
	setSide(localRotateForwardToSide(getForward()));
    setUp(Vector3::UNIT_Y);
	Vector3 pos = mCreature->getPosition();
	setPosition(pos);
	Vector3 src = mCreature->getOrientation()*Vector3::NEGATIVE_UNIT_Z;

    // regenerate local space(by default: align vehicle's forward axis with
    // new velocity, but this behavior may be overridden by derived classes.)
	regenerateOrthonormalBasisUF(src);
}
void QgsMapToolRectangle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
  QgsPoint point = mapPoint( *e );

  if ( mTempRubberBand )
  {
    switch ( mPoints.size() )
    {
      case 1:
      {
        std::unique_ptr<QgsLineString> line( new QgsLineString() );
        line->addVertex( mPoints.at( 0 ) );
        line->addVertex( point );
        mTempRubberBand->setGeometry( line.release() );
        setAzimuth( mPoints.at( 0 ).azimuth( point ) );
        setDistance1( mPoints.at( 0 ).distance( point ) );
      }
      break;
      case 2:
      {
        setDistance2( mPoints.at( 1 ).distance( point ) );
        int side = QgsGeometryUtils::leftOfLine( point.x(), point.y(),
                   mPoints.at( 0 ).x(), mPoints.at( 0 ).y(),
                   mPoints.at( 1 ).x(), mPoints.at( 1 ).y() );

        setSide( side < 0 ? -1 : 1 );

        const double xMin = mPoints.at( 0 ).x();
        const double xMax = mPoints.at( 0 ).x() + distance2( );

        const double yMin = mPoints.at( 0 ).y();
        const double yMax = mPoints.at( 0 ).y() + distance1();

        const double z = mPoints.at( 0 ).z();

        mRectangle = QgsBox3d( xMin, yMin, z, xMax, yMax, z );


        mTempRubberBand->setGeometry( QgsMapToolAddRectangle::rectangleToPolygon( true ) );
      }
      break;
      default:
        break;
    }
  }
}
Exemple #10
0
Minion::Minion(Map* map, uint32 id, MinionSpawnType type, MinionSpawnPosition position) : Unit(map, id, new MinionStats(), 40, 0, 0, new MinionAI(this)), type(type), position(position)
{
   switch(position) 
   {
   case SPAWN_BLUE_TOP:
      setSide(0);
      setPosition(907, 1715);
      break;
   case SPAWN_BLUE_BOT:
      setSide(0);
      setPosition(1533, 1321);
      break;
   case SPAWN_BLUE_MID:
      setSide(0);
      setPosition(1443, 1663);
      break;
   case SPAWN_RED_TOP:
      setSide(1);
      setPosition(14455, 13159);
      break;
   case SPAWN_RED_BOT:
      setSide(1);
      setPosition(12967, 12695);
      break;
   case SPAWN_RED_MID:
      setSide(1);
      setPosition(12433, 12623);
      break;
   }
   
   // TODO : make these data dynamic with the game elapsed time
   switch(type) {
   case MINION_TYPE_MELEE:
      stats->setCurrentHealth(475.0f);
      stats->setMaxHealth(475.0f);
      stats->setBaseAd(12.0f);
      break;
   case MINION_TYPE_CASTER:
      stats->setCurrentHealth(279.0f);
      stats->setMaxHealth(279.0f);
      stats->setBaseAd(23.0f);
      break;
   case MINION_TYPE_CANNON:
      stats->setCurrentHealth(600.0f);
      stats->setMaxHealth(600.0f);
      stats->setBaseAd(40.0f);
      break;
   }
   
   stats->setMovementSpeed(325.f);
   stats->setBaseAttackSpeed(0.625f);
   stats->setAttackSpeedMultiplier(1.0f);
}
Exemple #11
0
	public: void free(){
/*
		if(isSplitted()){
			for(int i=0; i<2; i++){
				subribs[i]->free();
			}
		}
*/
		for(int iside=0; iside<4; iside++){
			Side* side = getSide(iside);
			for(int jrib=0; jrib>4; jrib++){
				if(side != NULL && this == side->getRib(jrib)){
					side->setRib(NULL, jrib);
					break;
				}
			}
		}

		for(int icell=0; icell<4; icell++){
			Cell* cell = getCell(icell);
			for(int jrib=0; jrib>4; jrib++){
				if(cell != NULL && this == cell->getRib(getAxis(), jrib)){
					cell->setRib(getAxis(), jrib, NULL);
					break;
				}
			}
		}
/*
		if(getParent() != NULL){
			for(int i=0; i<2; i++){
				if(this == getParent()->getSubRib(i)){
					getParent()->setSubRib(i, NULL);
					break;
				}
			}
		}
*/
		for(int i=0; i<4; i++){
			setSide(i, NULL);
			setCell(i, NULL);
		}

		delete this;
	}
// --------- FancyLineEdit
FancyLineEdit::FancyLineEdit(QWidget *parent) :
    QLineEdit(parent),
    m_d(new FancyLineEditPrivate(this))
{
    // KDE has custom icons for this. Notice that icon namings are counter intuitive
    // If these icons are not avaiable we use the freedesktop standard name before
    // falling back to a bundled resource
    QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
                     QLatin1String("edit-clear-locationbar-rtl") :
                     QLatin1String("edit-clear-locationbar-ltr"),
                     QIcon::fromTheme("edit-clear", QIcon(QLatin1String(":/core/images/editclear.png"))));

    m_d->m_iconbutton->installEventFilter(m_d);
    m_d->m_iconbutton->setIcon(icon);

    ensurePolished();
    setSide(Left);

    connect(this, SIGNAL(textChanged(QString)), this, SLOT(checkButton(QString)));
    connect(m_d->m_iconbutton, SIGNAL(clicked()), this, SLOT(iconClicked()));
}
Exemple #13
0
UnitRemote::UnitRemote(UnitInitPacket& init_packet, bool controlled,
    int client, int id) :
  Unit("", osg::Vec3(0, 0, 0), 0, RED, controlled, true, false, client, id)
  {
    // initialize based on init packet

    setName(init_packet.m_UniqueUnitID);

    if ( getName().find("Tank") )
      {
        parseUnitConfigFile("unitTank.xml");
      }
    else if ( getName().find("Soldier") )
      {
        parseUnitConfigFile("unitSoldier.xml");
      }

    m_ObjectModelNames = init_packet.m_ObjectModelNames;
    m_IsFlying = init_packet.m_IsFlying;
    setSide( (UnitSide)init_packet.m_Side );
    EnableDynamics(false);
  }
Exemple #14
0
void Arrow::reflect() {
    setSide(!getSide());
}
Exemple #15
0
Arrow::Arrow(const Point2D& p1, const Point2D& p2, float coef) {
    setBounds(p1, p2);
    setType();
    setSide(1);
    tipCoef = coef;
}
//------------------------------------------------------------------------------
// entityState2Nib() -- (Input support)
//  Transfers data from the incoming entity attributes to the basic
//  NIB class variables.
//------------------------------------------------------------------------------
void Nib::entityState2Nib()
{    
   if (isAttributeUpdateRequired(NetIO::ENTITY_IDENTIFIER_AI)) {
      setPlayerID(baseEntity->entityIdentifier.entityNumber);
      setSiteID(baseEntity->entityIdentifier.federateIdentifier.siteID);
      setApplicationID(baseEntity->entityIdentifier.federateIdentifier.applicationID);
      setAttributeUpdateRequiredFlag(NetIO::ENTITY_IDENTIFIER_AI, false);
      haveEntityIdFlg = true;
   }

   if (isAttributeUpdateRequired(NetIO::ENTITY_TYPE_AI)) {
      setEntityType(
            baseEntity->entityType.entityKind,
            baseEntity->entityType.domain,
            baseEntity->entityType.countryCode,
            baseEntity->entityType.category,
            baseEntity->entityType.subcategory,
            baseEntity->entityType.specific,
            baseEntity->entityType.extra
         );
      setAttributeUpdateRequiredFlag(NetIO::ENTITY_TYPE_AI, false);
      haveEntityTypeFlg = true;
   }

   if (isAttributeUpdateRequired(NetIO::SPATIAL_AI)) {

      // NIB's base entity structures
      //SpatialStruct* spatial = &(baseEntity->spatial);
      SpatialRVStruct* spatialRvw = &(baseEntity->spatialRvw);

      // Set the freeze flag
      freeze(spatialRvw->isFrozen != 0);

      // Get the geocentric position, velocity and acceleration
      osg::Vec3d geocPos;
      geocPos[base::Nav::IX] = spatialRvw->worldLocation.x;
      geocPos[base::Nav::IY] = spatialRvw->worldLocation.y;
      geocPos[base::Nav::IZ] = spatialRvw->worldLocation.z;

      osg::Vec3d geocVel;
      geocVel[base::Nav::IX] = spatialRvw->velocityVector.xVelocity;
      geocVel[base::Nav::IY] = spatialRvw->velocityVector.yVelocity;
      geocVel[base::Nav::IZ] = spatialRvw->velocityVector.zVelocity;

      osg::Vec3d geocAcc;
      geocAcc[base::Nav::IX] = spatialRvw->accelerationVector.xAcceleration;
      geocAcc[base::Nav::IY] = spatialRvw->accelerationVector.yAcceleration;
      geocAcc[base::Nav::IZ] = spatialRvw->accelerationVector.zAcceleration;

      // Get orientation orientation and rates
      osg::Vec3d geocAngles;
      geocAngles[base::Nav::IPHI] = spatialRvw->orientation.phi;
      geocAngles[base::Nav::ITHETA] = spatialRvw->orientation.theta;
      geocAngles[base::Nav::IPSI] = spatialRvw->orientation.psi; 

      osg::Vec3d arates(0.0, 0.0, 0.0);

      // (re)initialize the dead reckoning function
      double diffTime(0.0);
      resetDeadReckoning(
         RVW_DRM,
         geocPos,
         geocVel,
         geocAcc,
         geocAngles,
         arates,
         diffTime);

      haveWorldLocationFlg = true;
      haveOrientationFlg = true;

      setAttributeUpdateRequiredFlag(NetIO::SPATIAL_AI, false);
   }
    
   // PhysicalEntity pointer
   PhysicalEntity* physicalEntity = dynamic_cast<PhysicalEntity*>(baseEntity);
   if (physicalEntity != nullptr) {

      if (isAttributeUpdateRequired(NetIO::FORCE_IDENTIFIER_AI)) {
         // Side: When mapping Force ID to Player Side ...
         if (physicalEntity->forceIdentifier == FRIENDLY) {
            // Friendly's are blue, ...
            setSide(simulation::Player::BLUE);
         }
         else if (physicalEntity->forceIdentifier == OPPOSING) {
            // opposing side is red, ...
            setSide(simulation::Player::RED);
         }
         else if (physicalEntity->forceIdentifier == NEUTRAL) {
            // Neutrals are white, ...
            setSide(simulation::Player::WHITE);
         }
         else  {
            // and everyone else is gray.
            setSide(simulation::Player::GRAY);
         }
         setAttributeUpdateRequiredFlag(NetIO::FORCE_IDENTIFIER_AI, false);
      }

   }

   setMode(simulation::Player::ACTIVE);    
   setTimeExec( (double) getNetIO()->getCurrentTime() );
}
Exemple #17
0
//------------------------------------------------------------------------------
// playerState2Nib() -- Sets this NIB's player data
//------------------------------------------------------------------------------
void Nib::playerState2Nib()
{
   const models::Player* player = getPlayer();
   if (player != nullptr) {
      // Player name
      const char* cname = nullptr;
      const base::String* sname = player->getName();
      if (sname != nullptr) cname = *sname;
      if (cname != nullptr) setPlayerName(cname);
      else setPlayerName("OPENEAAGLES");

      freeze( player->isFrozen() );
      if (!isMode(models::Player::DELETE_REQUEST)) setMode( player->getMode() );
      setDamage( player->getDamage() );
      setSmoke( player->getSmoke() );
      setFlames( player->getFlames() );
      setCamouflageType( player->getCamouflageType() );
      setSide( player->getSide() );

      // Reset our dead reckoning with the current state data from the player
      //resetDeadReckoning(
      //   RVW_DRM,
      //   player->getGeocPosition(),
      //   player->getGeocVelocity(),
      //   player->getGeocAcceleration(),
      //   player->getGeocEulerAngles(),
      //   player->getGeocAngularVelocities()
      //);

      resetDeadReckoning(
         RVW_DRM,
         player->getSynchronizedState().getGeocPosition(),
         player->getSynchronizedState().getGeocVelocity(),
         player->getSynchronizedState().getGeocAcceleration(),
         player->getSynchronizedState().getGeocEulerAngles(),
         player->getSynchronizedState().getAngularVelocities()
      );

      // mark the current times
      //Simulation* sim = getNetIO()->getSimulation();
      //setTimeExec( static_cast<double>(sim->getExecTimeSec()) );
      setTimeExec( static_cast<double>(player->getSynchronizedState().getTimeExec()) );
      //setTimeUtc( static_cast<double>(sim->getSysTimeOfDay()) );
      setTimeUtc( static_cast<double>(player->getSynchronizedState().getTimeUtc()) );

      {
         //base::Vec3d pos = player->getGeocPosition();
         //base::Vec3d vec = player->getGeocVelocity();

         //std::cout << "playerState2Nib(): geoc pos: (";
         //std::cout << pos[0] << ", ";
         //std::cout << pos[1] << ", ";
         //std::cout << pos[2] << ") ";
         //std::cout << "geoc vel: (";
         //std::cout << vec[0] << ", ";
         //std::cout << vec[1] << ", ";
         //std::cout << vec[2] << ") ";
         //std::cout << std::endl;
      }
   }
}
Exemple #18
0
Circle::Circle(double radius)
{
	setSide(radius);

}
    void MamdaOrderBookPriceLevel::setAsDifference (
        const MamdaOrderBookPriceLevel&  lhs,
        const MamdaOrderBookPriceLevel&  rhs)
    {
        assert (lhs.getPrice() == rhs.getPrice());

        MamdaOrderBookPriceLevel::iterator lhsEnd  = end();
        MamdaOrderBookPriceLevel::iterator lhsIter = begin();
        MamdaOrderBookPriceLevel::iterator rhsEnd  = end();
        MamdaOrderBookPriceLevel::iterator rhsIter = begin();

        while ((lhsIter != lhsEnd) && (rhsIter != rhsEnd))
        {
            const char*      lhsId   = NULL;
            const char*      rhsId   = NULL;
            mama_quantity_t  lhsSize = 0.0;
            mama_quantity_t  rhsSize = 0.0;

            if (lhsIter != lhsEnd)
            {
                const MamdaOrderBookEntry* entry = *lhsIter;
                lhsId   = entry->getId();
                lhsSize = entry->getSize();
            }
            if (rhsIter != rhsEnd)
            {
                const MamdaOrderBookEntry* entry = *rhsIter;
                rhsId   = entry->getId();
                rhsSize = entry->getSize();
            }

            if (lhsId && rhsId)
            {
                if (strcmp(lhsId,rhsId)==0)
                {
                    // Same ID, maybe different size.
                    if (mama_isQuantityEqual (lhsSize, rhsSize))
                    {
                        MamdaOrderBookEntry* updateEntry =
                            new MamdaOrderBookEntry (**rhsIter);
                        updateEntry->setAction(
                            MamdaOrderBookEntry::MAMDA_BOOK_ACTION_UPDATE);
                        addEntry (updateEntry);
                    }
                    ++lhsIter;
                    ++rhsIter;
                    continue;
                }
                else
                {
                    // Different ID (either something exists on the LHS
                    // and not on RHS or vice versa).
                    MamdaOrderBookPriceLevel::const_iterator rhsFound = 
                        findEntryAfter (rhsIter, lhsId);
                    if (rhsFound != rhsEnd)
                    {
                        // The ID from the LHS was found on the RHS, so
                        // there must have been additional entries on the
                        // RHS, which we now need to add.
                        do
                        {
                            MamdaOrderBookEntry* entry =
                                new MamdaOrderBookEntry(**rhsIter);
                            addEntry (entry);
                            ++rhsIter;
                        }
                        while (rhsIter != rhsFound);
                    }
                    else
                    {
                        // The ID from the LHS was not present on the RHS,
                        // so add the LHS entry.  Note: it would probably
                        // be faster to iterate over the LHS side rather
                        // than begin the loop again.
                        MamdaOrderBookEntry* entry =
                            new MamdaOrderBookEntry(**lhsIter);
                        addEntry (entry);
                        ++lhsIter;
                    }
                }
            }
        }

        setPrice (rhs.getPrice());
        setSizeChange (rhs.getSize() - lhs.getSize());
        setSize (rhs.getSize());
        setNumEntries (rhs.getNumEntries());
        setAction (MamdaOrderBookPriceLevel::MAMDA_BOOK_ACTION_UPDATE);
        setTime (rhs.getTime());
        setSide (rhs.getSide());
    }
Exemple #20
0
void CylinderNode::setSide(int value) 
{
	setSide(value ? true : false);
}