示例#1
0
/*!
  Sets the client's active state to \a act.

  This function does only change the visual appearance of the client,
  it does not change the focus setting. Use
  Workspace::activateClient() or Workspace::requestFocus() instead.

  If a client receives or looses the focus, it calls setActive() on
  its own.

 */
void Client::setActive(bool act)
{
    if (active == act)
        return;
    active = act;
    const int ruledOpacity = active
                             ? rules()->checkOpacityActive(qRound(opacity() * 100.0))
                             : rules()->checkOpacityInactive(qRound(opacity() * 100.0));
    setOpacity(ruledOpacity / 100.0);
    workspace()->setActiveClient(act ? this : NULL, Allowed);

    if (active)
        Notify::raise(Notify::Activate);

    if (!active)
        cancelAutoRaise();

    if (!active && shade_mode == ShadeActivated)
        setShade(ShadeNormal);

    StackingUpdatesBlocker blocker(workspace());
    workspace()->updateClientLayer(this);   // active windows may get different layer
    ClientList mainclients = mainClients();
    for (ClientList::ConstIterator it = mainclients.constBegin();
            it != mainclients.constEnd();
            ++it)
        if ((*it)->isFullScreen())  // fullscreens go high even if their transient is active
            workspace()->updateClientLayer(*it);
    if (decoration != NULL)
        decoration->activeChange();
    emit activeChanged();
    updateMouseGrab();
    updateUrgency(); // demand attention again if it's still urgent
    workspace()->checkUnredirect();
}
示例#2
0
String AbnfRuleList::toString () const
{
	Vector<AbnfRule *>::const_iterator it = rules().cbegin();
	Vector<AbnfRule *>::const_iterator itEnd = rules().cend();

	String r;

	for (; it != itEnd; ++it) {
		r << (*it)->toString();
		if (! r.endsWith(String::EndOfLine))
			r << String::EndOfLine;
		r << String::EndOfLine;
	}

	return r;
}
//
// Generate and attach an ad-hoc opaque signature
// Use SHA-1 digests because that's what the whitelist is made with
//
static void attachOpaque(SecStaticCodeRef code, SecAssessmentFeedback feedback)
{
	CFTemp<CFDictionaryRef> rules("{"	// same resource rules as used for collection
		"rules={"
			"'^.*' = #T"
			"'^Info\\.plist$' = {omit=#T,weight=10}"
		"},rules2={"
			"'^(Frameworks|SharedFrameworks|Plugins|Plug-ins|XPCServices|Helpers|MacOS)/' = {nested=#T, weight=0}" 
			"'^.*' = #T"
			"'^Info\\.plist$' = {omit=#T,weight=10}"
			"'^[^/]+$' = {top=#T, weight=0}"
		"}"
	"}");

	CFRef<CFDataRef> signature = CFDataCreateMutable(NULL, 0);
	CFTemp<CFDictionaryRef> arguments("{%O=%O, %O=#N, %O=%d, %O=%O}",
		kSecCodeSignerDetached, signature.get(),
		kSecCodeSignerIdentity, /* kCFNull, */
		kSecCodeSignerDigestAlgorithm, kSecCodeSignatureHashSHA1,
		kSecCodeSignerResourceRules, rules.get());
	CFRef<SecCodeSignerRef> signer;
	SecCSFlags creationFlags = kSecCSSignOpaque | kSecCSSignNoV1 | kSecCSSignBundleRoot;
	SecCSFlags operationFlags = 0;

	if (feedback)
		operationFlags |= kSecCSReportProgress;
	MacOSError::check(SecStaticCodeSetCallback(code, kSecCSDefaultFlags, NULL, ^CFTypeRef(SecStaticCodeRef code, CFStringRef stage, CFDictionaryRef info) {
		if (CFEqual(stage, CFSTR("progress"))) {
			bool proceed = feedback(kSecAssessmentFeedbackProgress, info);
			if (!proceed)
				SecStaticCodeCancelValidation(code, kSecCSDefaultFlags);
		}
		return NULL;
	}));
示例#4
0
void main()
{
	Game Game1;
	STATE current = INIT;
	
	while (true)
	{
		switch (current)
		{
		case INIT:
			splash();
		case MAIN:
			current = MainMenu();
			break;
		case PLAY:
			Game1.newGame();
		case GAME:
			current = Game1.update();
			break;
		case RULES: 
			current = rules();
			break;
		case EXIT:
			exit();
			return;
		}
	}
}
示例#5
0
void action(int ignored)
{
  signal(SIGALRM,action);
 
  if (rotall || rotcore)
     if (!(rtimer--)) {
	rtimer=rotdelay;
	pmove();
     }
  
  if (!(mtimer--)) {
    mtimer=mesdelay;
    funnymessage();
  }

  if (topgun) {
      if (!(ttimer--)) {
        stop_topgun();
	topgun = 0;
	ttimer=topgundelay;
      }
     topgunships();
     if ((ttimer > 0) && ((ttimer % 120) == 0))  {
	sprintf(buf, ">                -= T O P    G U N =-      (%d min. left) ", (ttimer/60));
	amessage(buf , 0, MALL);
	rules();
      }    
   } else
     if (!(ttimer--)) {
        start_topgun();
	topgun = 1;
	ttimer=topguntime;
     }

}
示例#6
0
int main() {
	std::cout << "\033[?25l";
	std::istringstream in("abbbbbd");
	Tape t(&in);

	IMachine* m = new Machine();

	std::istringstream rules("z1,a,b,left,z2\nz3,b,c,right,z3\nz2,-,X,right,z3");
	m->loadRules(&rules);
	m->setTape(&t);

	m->setState("unknown");
	m->step();

	m->setState("z1");
	std::cout << "state: " << m->getState() << std::endl;

	do {
		t.dump(std::cout);
	} while(m->step());

	m->step();

	std::cout << "state: " << m->getState() << std::endl;

	delete m;

	std::cout << "\033[?25h" << std::endl;
}
示例#7
0
//定义每一个函数//
int main()
{
	begin();
	int i;
	fp=fopen("排行榜","r");
    for(i=0;i<5;i++)
	    fread(&end_score[i],2,1,fp);
	fclose(fp);
	MOUSEMSG m;                           //定义鼠标消息//
    while(true)
	{
	  m=GetMouseMsg();
	  switch(m.uMsg)
	  {
	  case WM_LBUTTONDOWN:
	   if(m.x>=10&&m.y>=130&&m.y<=200&&m.x<=290)
	       design_cp1();
	   if(m.x>=10&&m.y>=230&&m.y<=300&&m.x<=290)
		   rules();
       if(m.x>=10&&m.y>=330&&m.y<=400&&m.x<=290)
		   select();
	   if(m.x>=10&&m.y>=430&&m.y<=500&&m.x<=290)
		   see_rank();
	   if(m.x>=10&&m.y>=530&&m.y<=600&&m.x<=290)
		   exit(0);
	  }
	}
    return 0;
}
示例#8
0
unsigned int
ExpressionBuilder::EBTerm::substitute(const EBSubstitutionRule & rule)
{
  EBSubstitutionRuleList rules(1);
  rules[0] = &rule;
  return substitute(rules);
}
示例#9
0
文件: Edge.cpp 项目: Tisseo/synthese
		Edge::Edge(
			Path* parentPath,
			size_t rankInPath,
			Vertex* fromVertex,
			double metricOffset
		):	Registrable(0),
			_fromVertex(fromVertex),
			_parentPath (parentPath),
			_metricOffset(metricOffset),
			_rankInPath (rankInPath),
			_previous(NULL),
			_previousConnectionDeparture(NULL),
			_previousDepartureForFineSteppingOnly(NULL),
			_followingConnectionArrival(NULL),
			_followingArrivalForFineSteppingOnly(NULL),
			_next(NULL),
			_departureIndex(INDICES_NUMBER),
			_arrivalIndex(INDICES_NUMBER),
			_serviceIndexUpdateNeeded (true),
			_RTserviceIndexUpdateNeeded(true)
		{
			// Default accessibility
			RuleUser::Rules rules(RuleUser::GetEmptyRules());
			rules[USER_PEDESTRIAN - USER_CLASS_CODE_OFFSET] = AllowedUseRule::INSTANCE.get();
			rules[USER_BIKE - USER_CLASS_CODE_OFFSET] = AllowedUseRule::INSTANCE.get();
			rules[USER_HANDICAPPED - USER_CLASS_CODE_OFFSET] = AllowedUseRule::INSTANCE.get();
			rules[USER_CAR - USER_CLASS_CODE_OFFSET] = AllowedUseRule::INSTANCE.get();
			setRules(rules);
		}
示例#10
0
文件: Agent.cpp 项目: GG31/packages
value::Value* Agent::observation(
    const devs::ObservationEvent& event) const
{
    const std::string port = event.getPortName();

    if (port == "KnowledgeBase") {
        std::stringstream out;
        out << *this;
        return new value::String(out.str());
    } else if (port == "Activities") {
        std::stringstream out;
        out << activities();
        return new value::String(out.str());
    } else if ((port.compare(0, 9, "Activity_") == 0) and port.size() > 9) {
        std::string activity(port, 9, std::string::npos);
        const Activity& act(activities().get(activity)->second);
        std::stringstream out;
        out << act.state();
        return new value::String(out.str());
    } else if ((port.compare(0, 6, "Rules_") == 0) and port.size() > 6) {
        std::string rule(port, 6, std::string::npos);
        const Rule& ru(rules().get(rule));
        return new value::Boolean(ru.isAvailable());
    }
    return 0;
}
示例#11
0
void FastMKS<KernelType, TreeType>::Search(TreeType* queryTree,
                                           const size_t k,
                                           arma::Mat<size_t>& indices,
                                           arma::mat& kernels)
{
  // If either naive mode or single mode is specified, this must fail.
  if (naive || singleMode)
  {
    throw std::invalid_argument("can't call Search() with a query tree when "
        "single mode or naive search is enabled");
  }

  // No remapping will be necessary because we are using the cover tree.
  indices.set_size(k, queryTree->Dataset().n_cols);
  kernels.set_size(k, queryTree->Dataset().n_cols);
  kernels.fill(-DBL_MAX);

  Timer::Start("computing_products");
  typedef FastMKSRules<KernelType, TreeType> RuleType;
  RuleType rules(referenceSet, queryTree->Dataset(), indices, kernels,
      metric.Kernel());

  typename TreeType::template DualTreeTraverser<RuleType> traverser(rules);

  traverser.Traverse(*queryTree, *referenceTree);

  Log::Info << rules.BaseCases() << " base cases." << std::endl;
  Log::Info << rules.Scores() << " scores." << std::endl;

  Timer::Stop("computing_products");
}
示例#12
0
文件: testing2.c 项目: qiubix/Cyclops
void start()
{
    char a;
    char choice=0;
    int i=0;

    rules();
    printf("Aby rozpoczac losowanie, wpisz 1: ");

    while(a=getchar())
    {
        if(i==0)
        {
            if(a=='1') choice = a;
            else choice = 0;
            i++;
        }
        else
        {
            if(choice&&i==1&&a=='\n')
                deal();
            else if (a=='\n') {
                printf("Niewlasciwa komenda!\n");
                i=0;
            }
            else i++;

        }/*else*/
        if(choice=='1'&&a=='\n'&&i==1) break;
    }

}/*start()*/
示例#13
0
文件: main.cpp 项目: Rocky3X/mcts
void playGameAgainst(Agent *agent0, Agent *agent1) {
  GameRules rules(4);

  vector<Agent *> players{agent1, agent0};
  unsigned curIndex = 0; // rand()%players.size();

  uptr<State> gameState(GameState::NewEmptyGameState(4, 4));

  while (true) {
    Agent *curPlayer = players[curIndex];

    uptr<Action> action = curPlayer->ChooseAction(gameState.get());
    uptr<State> successor = gameState->SuccessorState(*action);

    bool isWin = rules.IsWin(*successor);
    bool isFinished = rules.IsTerminalState(*successor);

    if (isWin || isFinished) {
      cout << "end of game!" << endl;
      if (isWin) {
        cout << "player" << curIndex << " is the winner" << endl;
      } else {
        cout << "its a draw" << endl;
      }
      successor->Output(cout);

      break;
    }

    gameState = successor->Clone();
    static_cast<GameState *>(gameState.get())->FlipState(); // TODO: this is a bit hacky.
    curIndex = (curIndex + 1) % players.size();
  }
}
示例#14
0
void RagdollSetupCollisions( ragdoll_t &ragdoll, vcollide_t *pCollide, int modelIndex )
{
	//we don't need this assert valve! - bitl
	//Assert(pCollide);
	if (!pCollide)
		return;

	IPhysicsCollisionSet *pSet = physics->FindCollisionSet( modelIndex );
	if ( !pSet )
	{
		pSet = physics->FindOrCreateCollisionSet( modelIndex, ragdoll.listCount );
		if ( !pSet )
			return;

		bool bFoundRules = false;

		IVPhysicsKeyParser *pParse = physcollision->VPhysicsKeyParserCreate( pCollide->pKeyValues );
		while ( !pParse->Finished() )
		{
			const char *pBlock = pParse->GetCurrentBlockName();
			if ( !strcmpi( pBlock, "collisionrules" ) )
			{
				IPhysicsCollisionSet *pSet = physics->FindOrCreateCollisionSet( modelIndex, ragdoll.listCount );
				CRagdollCollisionRules rules(pSet);
				pParse->ParseCustom( (void *)&rules, &rules );
				bFoundRules = true;
			}
			else
			{
				pParse->SkipBlock();
			}
		}
		physcollision->VPhysicsKeyParserDestroy( pParse );

		if ( !bFoundRules )
		{
			// these are the default rules - each piece collides with everything
			// except immediate parent/constrained object.
			int i;
			for ( i = 0; i < ragdoll.listCount; i++ )
			{
				for ( int j = i+1; j < ragdoll.listCount; j++ )
				{
					pSet->EnableCollisions( i, j );
				}
			}
			for ( i = 0; i < ragdoll.listCount; i++ )
			{
  				int parent = ragdoll.list[i].parentIndex;
				if ( parent >= 0 )
				{
  					Assert( ragdoll.list[i].pObject );
  					Assert( ragdoll.list[i].pConstraint );
					pSet->DisableCollisions( i, parent );
				}
 			}
		}
	}
}
示例#15
0
void Rule31Pattern::updateCells() {
    uint8_t nextCell = (currentCell+1) %2;
    for (uint8_t i =0; i<numLeds;i++){
        cells[nextCell][i] =rules(cells[currentCell][i-1],cells[currentCell][i],cells[currentCell][(i+1)%numLeds]);
        cellColors[i] += cells[nextCell][i] ? random(5) :-1*random(5);
    }
    currentCell =nextCell;
}
示例#16
0
static jint NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring rules0, jint mode, jint strength) {
    ScopedJavaUnicodeString rules(env, rules0);
    UErrorCode status = U_ZERO_ERROR;
    UCollator* c = ucol_openRules(rules.unicodeString().getBuffer(), rules.unicodeString().length(),
            UColAttributeValue(mode), UCollationStrength(strength), NULL, &status);
    icu4jni_error(env, status);
    return static_cast<jint>(reinterpret_cast<uintptr_t>(c));
}
示例#17
0
void Dynamic::start(const QString &name)
{
    if (isRemote()) {
        sendCommand(SetActive, QStringList() << name << "1");
        return;
    }

    if (Utils::findExe("perl").isEmpty()) {
        emit error(i18n("You need to install \"perl\" on your system in order for Cantata's dynamic mode to function."));
        return;
    }

    QString fName(Utils::dataDir(constDir, false)+name+constExtension);

    if (!QFile::exists(fName)) {
        emit error(i18n("Failed to locate rules file - %1", fName));
        return;
    }

    QString rules(Utils::cacheDir(constDir, true)+constActiveRules);

    QFile::remove(rules);
    if (QFile::exists(rules)) {
        emit error(i18n("Failed to remove previous rules file - %1", rules));
        return;
    }

    if (!QFile::link(fName, rules)) {
        emit error(i18n("Failed to install rules file - %1 -> %2", fName, rules));
        return;
    }

    int i=currentEntry.isEmpty() ? -1 : entryList.indexOf(currentEntry);
    QModelIndex idx=index(i, 0, QModelIndex());

    currentEntry=name;

    if (idx.isValid()) {
        emit dataChanged(idx, idx);
    }

    i=entryList.indexOf(currentEntry);
    idx=index(i, 0, QModelIndex());
    if (idx.isValid()) {
        emit dataChanged(idx, idx);
    }

    if (isRunning()) {
        emit clear();
        return;
    }
    if (controlApp(true)) {
        emit running(isRunning());
        emit clear();
        return;
    }
}
示例#18
0
static TextBreakIterator* initializeIteratorWithRules(const char* breakRules)
{
    UParseError parseStatus;
    UErrorCode openStatus = U_ZERO_ERROR;
    String rules(breakRules);
    TextBreakIterator* iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(rules.deprecatedCharacters(), rules.length(), 0, 0, &parseStatus, &openStatus));
    ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break iterator: %s (%d)", u_errorName(openStatus), openStatus);
    return iterator;
}
示例#19
0
void
rulescode_produce(T_PTR_tree entry,
		  transition_system_t **system) {
  /* First memory allocation of the transition system */
  (*system) = (transition_system_t *)xmalloc(sizeof(transition_system_t));
  sys = (*system);
  sys->limits.nbr_variables = nbr_var;
  rules(entry);
}
示例#20
0
void AbstractClient::setSkipSwitcher(bool set)
{
    set = rules()->checkSkipSwitcher(set);
    if (set == skipSwitcher())
        return;
    m_skipSwitcher = set;
    updateWindowRules(Rules::SkipSwitcher);
    emit skipSwitcherChanged();
}
static jlong NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring javaRules, jint mode, jint strength) {
    ScopedStringChars rules(env, javaRules);
    if (rules.get() == NULL) {
        return -1;
    }
    UErrorCode status = U_ZERO_ERROR;
    UCollator* c = ucol_openRules(rules.get(), rules.size(),
            UColAttributeValue(mode), UCollationStrength(strength), NULL, &status);
    maybeThrowIcuException(env, "ucol_openRules", status);
    return static_cast<jlong>(reinterpret_cast<uintptr_t>(c));
}
void main()
{

	int i,rul_ret,mnuret;
	char t_again[5];

	begin:
	clrscr();

	printf("    ********************************************************************\n\n");
	printf("\t  S C I E N C E\t\tP R O J E C T\t\tW O R K\n\n");
	printf("    ********************************************************************\n\n");
	delay(500);
	printf("\n\n\t\tKYA   AAP   AATHVIE   PASS   SE   TEJ   HAIN\n\t  ");
	for(i=0;i<56;i++)
	{
		delay(20);
		printf("#");
	}
	delay(2000);
	printf("\n\nREAD THE FOLLOWING BEFORE YOU START:-\n");
	for(i=0;i<38;i++)
	{
		delay(40);
		printf("~");
	}
	printf("\n\n");

	rul_ret=rules();

	if(rul_ret==1)
	  mnuret=start();

	else
		exit(0);

	getch();
	clrscr();
	printf("%s YOUR RESULT IS:-\t \"%d\" marks out of 10",name,mnuret);
	if(mnuret==10)
	{
		printf("\n\n\nCONGRATS YOU ARE REALLY EXCEPTIONAL STUDENT");
		delay(1000);
		printf("\n\n* * * * *");
		printf("\n\nFIVE STAR RATING FOR YOU");
	}
	delay(2000);
	printf("\n\n\n\nDO YOU WANT TO TEST YOUR SKILLS AGAIN(yes/no):-\t");
	flushall();
	gets(t_again);

	if(strcmp(t_again,"yes")==0)
		goto begin;
}
示例#23
0
 void RuleBlock::loadRules(const Engine* engine) {
     std::ostringstream exceptions;
     bool throwException = false;
     for (std::size_t i = 0; i < rules().size(); ++i) {
         Rule* rule = rules().at(i);
         if (rule->isLoaded()) {
             rule->unload();
         }
         try {
             rule->load(engine);
         } catch (std::exception& ex) {
             throwException = true;
             exceptions << ex.what() << "\n";
         }
     }
     if (throwException) {
         fl::Exception exception("[ruleblock error] the following "
                 "rules could not be loaded:\n" + exceptions.str(), FL_AT);
         throw exception;
     }
 }
示例#24
0
void AbstractClient::setKeepBelow(bool b)
{
    b = rules()->checkKeepBelow(b);
    if (b && !rules()->checkKeepAbove(false))
        setKeepAbove(false);
    if (b == keepBelow()) {
        // force hint change if different
        if (info && bool(info->state() & NET::KeepBelow) != keepBelow())
            info->setState(keepBelow() ? NET::KeepBelow : NET::States(0), NET::KeepBelow);
        return;
    }
    m_keepBelow = b;
    if (info) {
        info->setState(keepBelow() ? NET::KeepBelow : NET::States(0), NET::KeepBelow);
    }
    workspace()->updateClientLayer(this);
    updateWindowRules(Rules::Below);

    doSetKeepBelow();
    emit keepBelowChanged(m_keepBelow);
}
示例#25
0
const AbnfRule * AbnfRuleList::find (const String & name) const
{
	AbnfRule * r = nullptr;
	Hash<String, size_t>::const_iterator it = m_rulesIndices.find(name);
	const Vector<AbnfRule *> & vrules = rules();
	if (it != m_rulesIndices.cend()) {
		size_t i = it.value();
		CWT_ASSERT(i < vrules.size());
		r = vrules[i];
	}
	return r;
}
示例#26
0
void CStudioPhysics::ParseKeydata( void )
{
	IVPhysicsKeyParser *pParser = physcollision->VPhysicsKeyParserCreate( GetVCollide()->pKeyValues );

	while ( !pParser->Finished() )
	{
		const char *pBlock = pParser->GetCurrentBlockName();
		if ( !stricmp( pBlock, "solid" ) )
		{
			hlmvsolid_t solid;
			CSolidParse solidParse;

			pParser->ParseSolid( &solid, &solidParse );
			solid.surfacePropIndex = FindPhysprop( solid.surfaceprop );

			if ( solid.index >= 0 && solid.index < m_listCount )
			{
				strcpy( m_pList[solid.index].m_boneName, solid.name );
				memcpy( &m_pList[solid.index].m_solid, &solid, sizeof(solid) );
			}
		}
		else if ( !stricmp( pBlock, "ragdollconstraint" ) )
		{
			constraint_ragdollparams_t constraint;
			pParser->ParseRagdollConstraint( &constraint, NULL );
			if ( constraint.childIndex >= 0 && constraint.childIndex < m_listCount )
			{
				// In the editor / qc these show up as 5X so that 1.0 is the default
				constraint.axes[0].torque *= 5;
				constraint.axes[1].torque *= 5;
				constraint.axes[2].torque *= 5;
				m_pList[constraint.childIndex].m_constraint = constraint;
			}
		}
		else if ( !stricmp( pBlock, "editparams" ) )
		{
			CEditParse editParse;
			pParser->ParseCustom( &m_edit, &editParse );
			m_mass = m_edit.totalMass;
		}
		else if ( !strcmpi( pBlock, "collisionrules" ) )
		{
			CRagdollCollisionRulesParse rules(this);
			pParser->ParseCustom( NULL, &rules );
		}
		else
		{
			pParser->SkipBlock();
		}
	}
	physcollision->VPhysicsKeyParserDestroy( pParser );
}
示例#27
0
文件: Depot.cpp 项目: Tisseo/synthese
		Depot::Depot(RegistryKeyType id /*= 0*/ ):
			Registrable(id),
			Vertex(NULL, boost::shared_ptr<geos::geom::Point>())
		{
			_hub = this;

			RuleUser::Rules rules(RuleUser::GetEmptyRules());
			rules[USER_PEDESTRIAN - USER_CLASS_CODE_OFFSET] = ForbiddenUseRule::INSTANCE.get();
			rules[USER_BIKE - USER_CLASS_CODE_OFFSET] = ForbiddenUseRule::INSTANCE.get();
			rules[USER_HANDICAPPED - USER_CLASS_CODE_OFFSET] = ForbiddenUseRule::INSTANCE.get();
			rules[USER_CAR - USER_CLASS_CODE_OFFSET] = ForbiddenUseRule::INSTANCE.get();
			Hub::setRules(rules);
		}
示例#28
0
void AbstractClient::setActive(bool act)
{
    if (m_active == act) {
        return;
    }
    m_active = act;
    const int ruledOpacity = m_active
                             ? rules()->checkOpacityActive(qRound(opacity() * 100.0))
                             : rules()->checkOpacityInactive(qRound(opacity() * 100.0));
    setOpacity(ruledOpacity / 100.0);
    workspace()->setActiveClient(act ? this : NULL);

    if (!m_active)
        cancelAutoRaise();

    if (!m_active && shadeMode() == ShadeActivated)
        setShade(ShadeNormal);

    doSetActive();
    emit activeChanged();
    updateMouseGrab();
}
示例#29
0
static void RagdollCreateObjects( IPhysicsEnvironment *pPhysEnv, ragdoll_t &ragdoll, const ragdollparams_t &params )
{
	ragdoll.listCount = 0;
	ragdoll.pGroup = NULL;
	ragdoll.allowStretch = params.allowStretch;
	memset( ragdoll.list, 0, sizeof(ragdoll.list) );
	memset( &ragdoll.animfriction, 0, sizeof(ragdoll.animfriction) );
	
	if ( !params.pCollide || params.pCollide->solidCount > RAGDOLL_MAX_ELEMENTS )
		return;

	constraint_groupparams_t group;
	group.Defaults();
	ragdoll.pGroup = pPhysEnv->CreateConstraintGroup( group );
 
	IVPhysicsKeyParser *pParse = physcollision->VPhysicsKeyParserCreate( params.pCollide->pKeyValues );
	while ( !pParse->Finished() )
	{
		const char *pBlock = pParse->GetCurrentBlockName();
		if ( !strcmpi( pBlock, "solid" ) )
		{
			solid_t solid;

			pParse->ParseSolid( &solid, &g_SolidSetup );
			RagdollAddSolid( pPhysEnv, ragdoll, params, solid );
		}
		else if ( !strcmpi( pBlock, "ragdollconstraint" ) )
		{
			constraint_ragdollparams_t constraint;
			pParse->ParseRagdollConstraint( &constraint, NULL );
			RagdollAddConstraint( pPhysEnv, ragdoll, params, constraint );
		}
		else if ( !strcmpi( pBlock, "collisionrules" ) )
		{
			IPhysicsCollisionSet *pSet = physics->FindOrCreateCollisionSet( params.modelIndex, ragdoll.listCount );
			CRagdollCollisionRules rules(pSet);
			pParse->ParseCustom( (void *)&rules, &rules );
		}
		else if ( !strcmpi( pBlock, "animatedfriction") ) 
		{
			CRagdollAnimatedFriction friction( &ragdoll );
			pParse->ParseCustom( (void*)&friction, &friction );
		}
		else
		{
			pParse->SkipBlock();
		}
	}
	physcollision->VPhysicsKeyParserDestroy( pParse );
}
示例#30
0
std::shared_ptr<Ledger>
buildLedgerImpl(
    std::shared_ptr<Ledger const> const& parent,
    NetClock::time_point closeTime,
    const bool closeTimeCorrect,
    NetClock::duration closeResolution,
    Application& app,
    beast::Journal j,
    ApplyTxs&& applyTxs)
{
    auto buildLCL = std::make_shared<Ledger>(*parent, closeTime);

    if (buildLCL->rules().enabled(featureSHAMapV2) &&
        !buildLCL->stateMap().is_v2())
    {
        buildLCL->make_v2();
    }

    // Set up to write SHAMap changes to our database,
    //   perform updates, extract changes

    {
        OpenView accum(&*buildLCL);
        assert(!accum.open());
        applyTxs(accum, buildLCL);
        accum.apply(*buildLCL);
    }

    buildLCL->updateSkipList();

    {
        // Write the final version of all modified SHAMap
        // nodes to the node store to preserve the new LCL

        int const asf = buildLCL->stateMap().flushDirty(
            hotACCOUNT_NODE, buildLCL->info().seq);
        int const tmf = buildLCL->txMap().flushDirty(
            hotTRANSACTION_NODE, buildLCL->info().seq);
        JLOG(j.debug()) << "Flushed " << asf << " accounts and " << tmf
                        << " transaction nodes";
    }
    buildLCL->unshare();

    // Accept ledger
    buildLCL->setAccepted(
        closeTime, closeResolution, closeTimeCorrect, app.config());

    return buildLCL;
}