CityTradeOptions::Order CityTradeOptions::switchOrder( GoodType type ) { if( !isVendor( type ) ) { switch( getOrder( type ) ) { case noTrade: setOrder( type, importing ); break; case importing: setOrder( type, noTrade ); break; default: break; } } { switch( getOrder( type ) ) { case noTrade: setOrder( type, exporting ); break; case exporting: setOrder( type, importing ); break; case importing: setOrder( type, noTrade ); break; default: break; } } _d->updateLists(); return getOrder( type ); }
void VersionBuilder::buildFromMultilayer() { QLOG_INFO() << "Building version from multilayered sources."; // just the builtin stuff for now auto minecraftList = MMC->minecraftlist(); auto mcversion = minecraftList->findVersion(m_instance->intendedVersionId()); auto minecraftPatch = std::dynamic_pointer_cast<VersionPatch>(mcversion); if (!minecraftPatch) { throw VersionIncomplete("net.minecraft"); } minecraftPatch->setOrder(-2); m_version->VersionPatches.append(minecraftPatch); // TODO: this is obviously fake. QResource LWJGL(":/versions/LWJGL/2.9.1.json"); auto lwjgl = parseJsonFile(LWJGL.absoluteFilePath(), false, false); auto lwjglPatch = std::dynamic_pointer_cast<VersionPatch>(lwjgl); if (!lwjglPatch) { throw VersionIncomplete("org.lwjgl"); } lwjglPatch->setOrder(-1); m_version->VersionPatches.append(lwjglPatch); // load all patches, put into map for ordering, apply in the right order readInstancePatches(); m_version->finalize(); }
GranaryGoodStore() { for( int type=Good::wheat; type <= Good::vegetable; type++ ) { setOrder( (Good::Type)type, GoodOrders::accept ); } setOrder( Good::fish, GoodOrders::none ); setMaxQty( GranaryGoodStore::maxCapacity ); }
ShowTextTask::ShowTextTask( std::string const& _str , ResID _fontType , unsigned time ) :BaseClass( time ) ,str(_str ) ,fontType(_fontType ) { setOrder( RO_UI ); }
BoatModel::BoatModel(TrackModel* track, QObject *parent) : PositionModel(parent), m_track(track), m_heading(0) { if (debugLevel & 1 << MODEL) std::cout << "new Boat " << this << std::endl; setOrder(track->size()+1); }
void MolCatalogEntry::initFromStream(std::istream &ss) { delete dp_mol; dp_mol = nullptr; delete dp_props; dp_props = nullptr; // the molecule: dp_mol = new ROMol(); MolPickler::molFromPickle(ss, *const_cast<ROMol *>(dp_mol)); dp_props = new Dict(); boost::int32_t tmpInt; // the bitId: streamRead(ss, tmpInt); setBitId(tmpInt); // the order: streamRead(ss, tmpInt); setOrder(tmpInt); // the description: streamRead(ss, tmpInt); auto *tmpText = new char[tmpInt + 1]; ss.read(tmpText, tmpInt * sizeof(char)); tmpText[tmpInt] = 0; d_descrip = tmpText; delete[] tmpText; }
GrainSize::GrainSize(int id, int order, const QString& name, const QString& description, GraphicColumnHeader::WidthPositions pos) : Dataset(id, name, description), _order(order), _pos(pos) { setOrder(order); }
void PolynomialFit::init() { setObjectName(tr("Polynomial")); is_non_linear = false; d_explanation = tr("Polynomial Fit"); setOrder(d_order); d_scale_errors = false; }
void Task::resetHiddenStatus() { if (d->status == NeedsAttention) { //tasks don't get moved anymore setOrder(Normal); if (hidden() & AutoHidden) { setHidden(hidden() ^ AutoHidden); } } else { if (d->status == Active && (hidden() & AutoHidden)) { setHidden(hidden() ^ AutoHidden); } else if (d->status == Passive) { setHidden(hidden() | AutoHidden); } setOrder(Normal); } }
void TasksPWidget::setup(QAbstractTableModel *model, const QString &label, InfoWidget *info) { ui->table->setModel(model); ui->label->setText(label); connect(ui->table, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(editOrder(QModelIndex))); connect(ui->table, SIGNAL(clicked(QModelIndex)), info, SLOT(setOrder(QModelIndex))); }
CityTradeOptions::Order CityTradeOptions::switchOrder( GoodType type ) { if( !isVendor( type ) ) { switch( getOrder( type ) ) { case noTrade: setOrder( type, importing ); break; case importing: setOrder( type, noTrade ); break; } } { switch( getOrder( type ) ) { case noTrade: setOrder( type, exporting ); break; case exporting: setOrder( type, importing ); break; case importing: setOrder( type, noTrade ); break; } } return getOrder( type ); }
OrderWindow::OrderWindow(QWidget* parent, const char *name) : QWidget(parent, name) { setCaption("Order Setting"); // eMap = em; // int exp_number = eMap->size(); //int iCanvasWidth = exp_number * 20; //int iCanvasHeight = 200; inputWindow = new OrderWidget(this, "inputWindow"); inputWindow->setMinimumWidth(700); // inputWindow->show(); // And some buttons for different Actions. QPushButton* orderButton = new QPushButton("Set Order", this, "rawCompare"); connect(orderButton, SIGNAL(clicked()), this, SLOT(setOrder()) ); QPushButton* activityButton = new QPushButton("Set activities", this, "activityButton"); connect(activityButton, SIGNAL(clicked()), this, SLOT(setActivityStates()) ); // QPushButton* meanCompare = new QPushButton("Mean Compare", this, "meanCompare"); // connect(meanCompare, SIGNAL(clicked()), this, SLOT(meanComparison())); //QButtonGroup* selectors = new QButtonGroup(2, Vertical, QString("Data Set"), this); //getDist = new QCheckBox("Distribution", this, "getDist"); ptSize = new QSpinBox(2, 20, 2, this, "ptSize"); connect(ptSize, SIGNAL(valueChanged(int)), inputWindow, SLOT(setPointSize(int)) ); ptSize->setValue(12); //selector.push_back(new QRadioButton(QString("raw"), selectors)); //selector.push_back(new QRadioButton(QString("z-score"), selectors)); //selector[1]->setChecked(true); QGridLayout* grid = new QGridLayout(this, 1, 2, 5); grid->setColStretch(0, 0); grid->setColStretch(1, 1); QVBoxLayout* topLeft = new QVBoxLayout(); grid->addWidget(inputWindow, 0, 1); grid->addLayout(topLeft, 0, 0); topLeft->addWidget(orderButton); // topLeft->addWidget(meanCompare); //topLeft->addWidget(selectors); //topLeft->addWidget(getDist); topLeft->addWidget(activityButton); topLeft->addStretch(); topLeft->addWidget(ptSize); }
OCompletion::OCompletion() { d = new OCompletionPrivate; myCompletionMode = OGlobalSettings::completionMode(); myTreeRoot = new OCompTreeNode; myBeep = true; myIgnoreCase = false; myHasMultipleMatches = false; myRotationIndex = 0; setOrder( Insertion ); }
Globals::Globals(std::string dmode, std::string shading, float* background, std::string face, std::string order, bool dsided, bool local, bool enabled, float* ambient) { this->dmode = setDmode(dmode); this->shading = setShading(shading); this->face = setFace(face); this->order = setOrder(order); this->dsided = dsided; this->local = local; this->enabled = enabled; for (int i=0 ; i<4 ; i++) { this->background[i] = background[i]; this->ambient[i] = ambient[i]; } }
// Setup a mesh with full parammeter control void TMesh3D::setupWith( MeshType t, float *pos, float *col, int *ord, int len, int olen){ type = t; length = len; vex = new Vertex[len]; setOrder(ord, olen); setVexCol(col, len); setVexPos(pos, len); }
int Q3DateEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = Q3DateTimeEditBase::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 3) qt_static_metacall(this, _c, _id, _a); _id -= 3; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< Order*>(_v) = order(); break; case 1: *reinterpret_cast< QDate*>(_v) = date(); break; case 2: *reinterpret_cast< bool*>(_v) = autoAdvance(); break; case 3: *reinterpret_cast< QDate*>(_v) = maxValue(); break; case 4: *reinterpret_cast< QDate*>(_v) = minValue(); break; } _id -= 5; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setOrder(*reinterpret_cast< Order*>(_v)); break; case 1: setDate(*reinterpret_cast< QDate*>(_v)); break; case 2: setAutoAdvance(*reinterpret_cast< bool*>(_v)); break; case 3: setMaxValue(*reinterpret_cast< QDate*>(_v)); break; case 4: setMinValue(*reinterpret_cast< QDate*>(_v)); break; } _id -= 5; } else if (_c == QMetaObject::ResetProperty) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 5; } #endif // QT_NO_PROPERTIES return _id; }
void BBHandleLayer::createIdleBlock() { auto idleBlockSpt = BBBlockSprite::create("IdleBlock.png"); float blockX = m_relativeX + m_blockLength * 0 + idleBlockSpt->getContentSize().width/2; float blockY = m_relativeY +m_blockLength * (m_row - 0) + idleBlockSpt->getContentSize().height/2; idleBlockSpt->setPosition(Point(blockX, blockY)); idleBlockSpt->setTag(computeIndex(blockX, blockY)); idleBlockSpt->setOrder(computeIndex(blockX, blockY)); m_blockContainer->addChild(idleBlockSpt); idleBlockSpt->setOpacity(0); // 加入到集合末尾 m_blockArr->addObject(idleBlockSpt); }
void ActivityItem::setProperty(QString role,QVariant value) { QHash<int, QByteArray> names = roleNames(); if(role == names[CodeRole]) setCode(value.toString()); else if(role == names[NameRole]) setName(value.toString()); else if(role == names[IconRole]) setIcon(value.toString()); else if(role == names[CStateRole]) setCState(value.toString()); else if(role == names[BackgroundRole]) setBackgrounds(value.toStringList()); else if(role == names[OrderRole]) setOrder(value.toInt()); }
YGroup::YGroup(YGroup* p){ resizing = FALSE; sPoint = p->getSPoint(); ePoint = p->getEPoint(); mixPoint = p->getMixPoint(); setOrder(p->getOrder()); setSelect(FALSE); setType(p->getType()); setRgn(); POSITION pos = p->getList()->GetHeadPosition(); groupList.RemoveAll(); while (pos){ YObject* object = p->getList()->GetNext(pos); groupList.AddTail(object); } }
void QtEnumIMProtocol::initVars() { setQtProtocol ( QtEnumIMProtocol::IMProtocolUnknown ); setModelProtocol( EnumIMProtocol::IMProtocolUnknown ); setName ( "unknown" ); setOrder ( 0 ); setUseInIMAccountMenu( false ); setChatProtocol ( "" ); setIsIMProtocol ( false ); setSupportsPresence ( false ); setSupportsPresenceNote( false ); setCanDoMultiChat ( false ); setDefaultImageFile ( "" ); setDefaultProtocolImage ( "" );//VOXOX - CJC - 2009.07.29 setServerProtocolId( QtEnumIMProtocol::ServerProtocolIdUnknown ); }
void Turret::onImpact(DamageType::Type damage_type, float damage, const float3 &force, EntityRef source) { float resistance = 0.7f; damage *= 1.0f - resistance; if(isDying()) { m_hit_points -= int(damage); return; } m_hit_points -= int(damage); if(m_hit_points <= 0.0f) { DeathId::Type death_id = deathType(damage_type, damage, force); setOrder(new DieOrder(death_id), true); onKill(ref(), source); } else { //TODO: sound } ThinkingEntity::onImpact(damage_type, damage, force, source); }
bool QDateEdit::qt_property( int id, int f, QVariant* v) { switch ( id - staticMetaObject()->propertyOffset() ) { case 0: switch( f ) { case 0: setOrder((Order&)v->asInt()); break; case 1: *v = QVariant( (int)this->order() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 1: switch( f ) { case 0: setDate(v->asDate()); break; case 1: *v = QVariant( this->date() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 2: switch( f ) { case 0: setAutoAdvance(v->asBool()); break; case 1: *v = QVariant( this->autoAdvance(), 0 ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 3: switch( f ) { case 0: setMaxValue(v->asDate()); break; case 1: *v = QVariant( this->maxValue() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 4: switch( f ) { case 0: setMinValue(v->asDate()); break; case 1: *v = QVariant( this->minValue() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; default: return QDateTimeEditBase::qt_property( id, f, v ); } return TRUE; }
void BBHandleLayer::createBlocks() { m_texture = TextureCache::sharedTextureCache()->addImage("puzzel.png"); int i = 0; for (int r = 1; r <= m_row; r++) { for (int c = 1; c <= m_col; c++) { auto frame = SpriteFrame::createWithTexture(m_texture, Rect(m_blockLength*(c - 1), m_blockLength*(m_row - r), m_blockLength, m_blockLength)); auto blockSpt = BBBlockSprite::create("bg_block.png"); float blockX = m_relativeX + m_blockLength * (c - 1) + blockSpt->getContentSize().width/2; float blockY = m_relativeY +m_blockLength * (r - 1) + blockSpt->getContentSize().height/2; blockSpt->setPosition(Point(blockX, blockY)); blockSpt->setOrder(computeIndex(blockX, blockY)); blockSpt->setTag(computeIndex(blockX, blockY)); m_blockContainer->addChild(blockSpt); auto spt = Sprite::createWithSpriteFrame(frame); float scaleRate = 129.0 / 130.0; spt->setScale(scaleRate, scaleRate); spt->setPosition(Point(blockSpt->getContentSize().width/2, blockSpt->getContentSize().height/2)); blockSpt->addChild(spt); blockSpt->setCascadeOpacityEnabled(true); blockSpt->setOpacity(0); if (r == m_row && c == m_col) { // 最后一个 blockSpt->runAction(Sequence::create(DelayTime::create(0.05 * i), JumpTo::create(0.3f, Point(blockX, blockY), 30, 1), FadeIn::create(.3), CallFunc::create(CC_CALLBACK_0(BBHandleLayer::beginCountDown, this)), NULL)); } else { blockSpt->runAction(Sequence::create(DelayTime::create(0.05 * i), JumpTo::create(0.3f, Point(blockX, blockY), 30, 1), FadeIn::create(.3), NULL)); } m_blockArr->addObject(blockSpt); i++; } } }
int getopt(matrix *mat) { /* Eingegebene Option auslesen */ char opt; opt = getchar() - '0'; /* ASCII-Umwandlung */ if (opt == EOF) return EOF; if (opt < 1 || opt > QUIT) return UNKWN; /* Unbekannte Option */ switch(opt) { /* Eingegebene Option erwartet Parameter */ case 1: if (!setOrder(mat)) return UNKWN; break; case 2: if (!setValues(mat)) return UNKWN; break; case 5: if (!setBValues(mat)) return UNKWN; break; } return opt; }
static void addProposalFromSet(QList<TextEditor::AssistProposalItemInterface*> &proposals, const T &container, const QString &myTyping, const QIcon &icon, int order = 0) { foreach (const typename T::value_type &item, container) { const QString &name = nameFor(item); if (myTyping == name) continue; auto proposal = new TextEditor::AssistProposalItem; int indexOfParenthesis = name.indexOf(QLatin1Char('(')); if (indexOfParenthesis != -1) { proposal->setText(name.mid(0, indexOfParenthesis)); proposal->setDetail(name); } else { proposal->setText(name); } proposal->setIcon(icon); proposal->setOrder(order); proposals << proposal; } }
ClasticGrainSize::ClasticGrainSize(int id, int order, const QString& name, const QString& description, GraphicColumnHeader::WidthPositions pos) : GrainSize(id, order, name, description, pos) { setOrder(order); }
void NounShip::destroyShip( Noun * pKiller, bool bZeroVelocity ) { // make sure the damage is enough m_Damage = maxDamage(); // clear the current order & command, so if they respawn the ship doesn't try to keep doing it's last command setCommand( NOCOMMAND, NULL ); setOrder( NOORDER, NULL, NULL ); // inform the context user first if ( pKiller != this ) { gameContext()->gameUser()->onDestroyed( this, pKiller ); if ( pKiller != NULL ) gameContext()->gameUser()->onKill( pKiller, this ); } else gameContext()->gameUser()->onSelfDestruct( this ); if ( WidgetCast<NounPlanet>( pKiller ) ) gameContext()->gameUser()->onCollidePlanet( this ); // create the primary explosion if ( context()->isClient() ) { Scene * pScene = destroyEffect(); if ( pScene != NULL ) { // TODO: no need to add this explosion of this player is nowhere near the explosion // ship destroyed, create the explosion effect SceneryDebris * pEffect = new SceneryDebris; pEffect->setNounContext( new NounContext( pScene ) ); pEffect->setContext( context() ); pEffect->setPosition( worldPosition() ); pEffect->setDelay( 0.0f ); pEffect->setFrame( frame() ); if (! bZeroVelocity ) pEffect->setVelocity( Vector3( sin( m_fHeading ) * m_fVelocity, 0.0f, cos( m_fHeading) * m_fVelocity ) ); if (! pEffect->setSegment( "Effect" ) ) pEffect->setLife( 15.0f ); context()->attachNoun( pEffect ); } NounTrail::CopyTrailsIntoZone( this ); } // list of destroyed items to remove from ship.. std::list< Noun * > destroyed; // damage enhancements, once they reach their maxDamage() they are destroyed.. for(int i=0;i<childCount();++i) { NounEnhancement * pEnh = WidgetCast<NounEnhancement>( child(i) ); if ( pEnh != NULL ) { if ( pEnh->incrementDamage() ) { LOG_STATUS( "NounShip", "[ENHANCEMENT]:Destroyed:%s:%s:%u", pEnh->getName(), name(), userId() ); message( CharString().format( "<color;ffffff>Comms: Enhancement '%s' destroyed!", pEnh->getName() ) ); destroyed.push_back( pEnh ); } continue; } // remove any beacons on death.. NounBeacon * pBeacon = WidgetCast<NounBeacon>( child(i) ); if ( pBeacon != NULL ) { destroyed.push_back( pBeacon ); continue; } } // server-side only logic if ( isServer() ) { // check for area damage Array< GameContext::NounCollision > collide; if ( context()->proximityCheck( worldPosition(), explodeArea(), collide ) ) { for(int i=0;i<collide.size();i++) { NounGame * pCollide = WidgetCast<NounGame>( collide[i].pNoun ); if ( !pCollide || pCollide == this ) continue; if ( pCollide->canDamage( DAMAGE_ENERGY | DAMAGE_KINETIC ) && collide[i].fDistance < explodeArea() ) { float damageRatio = 1.0f - (collide[i].fDistance / explodeArea()); int damage = damageRatio * explodeDamage(); if ( damage > 0 ) { pCollide->inflictDamage( tick(), this, damage, DAMAGE_ENERGY | DAMAGE_KINETIC, pCollide->worldFrame() * (worldPosition() - pCollide->worldPosition()) ); } } } } // drop enhancements after we do area damage, otherwise we'll destroy the dropped loot.. dropLoot(); // space-monsters do not leave behind devices if ( ! isMonster() ) { // eject some of the resources used to build the ship into space int nAmount = DESTROYED_SHIP_RESOURCE * buildCost( this ); while( nAmount > 0 ) { CargoResource::Ref pCargo = new CargoResource( nAmount ); nAmount -= pCargo->quantity(); Vector3 vPosition( worldPosition() + RandomVector( -radius(), radius() ) ); vPosition.y = 0.0f; pCargo->setPosition( vPosition ); context()->attachNoun( pCargo ); } //// check for any cargo items... if found put them into space //for(int i=0;i<childCount();i++) //{ // BaseNode * pChild = child(i); // NounCargo::Ref pCargo; // if ( WidgetCast<NounCargo>( pChild ) ) // { // int roll = rand() % 100; // if ( roll < ((NounCargo *)pChild)->durability() ) // pCargo = (NounCargo *)pChild->copy(); // } // if ( pCargo.valid() ) // { // Vector3 vPosition( worldPosition() + RandomVector( -5.0f, 5.0f ) ); // vPosition.y = 0.0f; // pCargo->setPosition( vPosition ); // context()->attachNoun( pCargo ); // } //} } // last before detach so that players dont dupe thier enhancements // that were dropped // save off storage with this "active" ship if(userId() != 0) context()->user()->saveStorage(this); } // remove desrtroyed items from ship.. while( destroyed.size() > 0 ) { Noun * pDestroyed = destroyed.front(); destroyed.pop_front(); if ( pDestroyed ) pDestroyed->detachSelf(); } // lastly, detach the ship from the universe setDetach(); }
CBOrder& CBOrder::operator=(CBOrder order) { setOrder(order); return *this; }
/*--------------------------------------------------------------------------*/ static void parseCommandLine(int argc, char *argv[]){ int i = 0, j; P("Abstract Interpreter for mCRL Specifications"); for (i=1;i<argc;i++) { if (!strcmp(argv[i - 1],"-P")){ BUT_PAR = ATfalse; tokParameters(argv[i]); continue; } if (!strcmp(argv[i],"-Pall")){ BUT_PAR = ATfalse; continue; } if (!strcmp(argv[i-1],"-PallBut")){ BUT_PAR = ATtrue; tokParameters(argv[i]); continue; } if (!strcmp(argv[i-1],"-VallBut")){ BUT_VAR = ATtrue; ALL_VAR = ATfalse; tokVars(argv[i]); continue; } if (!strcmp(argv[i - 1],"-V")){ BUT_VAR = ATfalse; ALL_VAR = ATfalse; tokVars(argv[i]); continue; } if (!strcmp(argv[i],"-Vall")){ BUT_VAR = ATfalse; ALL_VAR = ATtrue; continue; } if (!strcmp(argv[i-1],"-VallBut")){ BUT_VAR = ATtrue; ALL_VAR = ATfalse; tokVars(argv[i]); continue; } if (!strcmp(argv[i - 1],"-S")){ BUT_SORT = ATfalse; tokSorts(argv[i]); continue; } if (!strcmp(argv[i - 1],"-SallBut")){ BUT_SORT = ATtrue; tokSorts(argv[i]); continue; } if (!strcmp(argv[i],"-H")){ HOMOMORPHISM = ATtrue; GALOIS = ATfalse; LIFTEDHOMO = ATfalse; continue; } if (!strcmp(argv[i],"-lH")){ HOMOMORPHISM = ATfalse; GALOIS = ATfalse; LIFTEDHOMO = ATtrue; continue; } if (!strcmp(argv[i],"-G")){ HOMOMORPHISM = ATfalse; GALOIS = ATtrue; LIFTEDHOMO = ATfalse; continue; } if (!strcmp(argv[i],"-help")){ helpmsg(); exit(0); } if (!strcmp(argv[i],"-May")){ MUST = ATfalse; continue; } if (!strcmp(argv[i],"-Must")){ MAY = ATfalse; continue; } if (!strcmp(argv[i],"-Debug")){ DEBUG = ATtrue; continue; } if (!strcmp(argv[i],"-Order")){ setOrder(); continue; } } if(HOMOMORPHISM) P("Abstraction Type: HOMOMORPHISM"); if(LIFTEDHOMO) P("Abstraction Type: LIFTED HOMOMORPHISM"); if(GALOIS){ setGalois(); P("Abstraction Type: GALOIS CONNECTION"); } }