Esempio n. 1
0
void SimPlanet::unload()
{
   if (inLightSet) {
      removeFromSet(SimLightSetId);
      inLightSet = false;
   }      
   if (inRenderSet) {
      removeFromSet(SimRenderSetId);
      inRenderSet = false;
   }
   if (castShadows) 
      shadows = false;
      
   planet.lensFlare = NULL;
}
void SimMovingShape::updateMoveState(SimTime dt)
{
	float delta = dt * record.timeScale;
	float startTime = time;
	switch (state) {
		case Forward: {
			if ((time += delta) > 1.0f) {
				time -= 1.0f;
				++wayPoint;
				if (!buildMovementVector(wayPoint))  {
					removeFromSet(SimTimerSetId);
					state = End;
					lPosition += lVector;
					aPosition += aVector;
					lVector.set(0.0f,0.0f,0.0f);
					aVector.set(0.0f,0.0f,0.0f);
					time = 0.0f;
					if (record.flags.test(Record::AutoBackward))
						SimMessageEvent::post(this,
							float(manager->getCurrentTime()) + record.backwardDelay,
							Backward);
				}
			}
			if (!updateMovement())
				time = startTime;
			break;
		}
		case Backward: {
			if ((time -= delta) < 0.0f) {
				time += 1.0f;
				--wayPoint;
				if (!buildMovementVector(wayPoint)) {
					removeFromSet(SimTimerSetId);
					time = 0.0f;
					state = Start;
					if (record.flags.test(Record::AutoForward))
						SimMessageEvent::post(this,
							float(manager->getCurrentTime()) + record.forwardDelay,
							Forward);
				}
			}
			if (!updateMovement())
				time = startTime;
			break;
		}
	}
}
Esempio n. 3
0
bool
Sky::onSimTimerEvent(const SimTimerEvent*)
{
   if (initialize() == true)
      removeFromSet(SimTimerSetId);

   return true;
}
bool SimExplosionCloud::onSimTimerEvent(const SimTimerEvent * event)
{
	if (removeFromRenderSet)
	{
		removeFromSet(SimRenderSetId);
		removeFromRenderSet=false;
	}
	// explosions in a cloud are not added to timer set, but get updates from here
	Vector<SimExplosion*>::iterator itr;
	for (itr=database.explosionList.begin(); itr!=database.explosionList.end(); itr++)
		(*itr)->onSimTimerEvent(event);
	return true;
}
Esempio n. 5
0
int main(void)
{
	char letter;
	int i, ch, flag = 0, letterFound = 0, isInput = 0, num = 0, numFirst = 0;
	unsigned int letterSet = 0, glasSet = 0, tmpSet = 0;

	for (i = 0; i < 26; i++) addToSet(&letterSet, 'a' + i);

	addToSet(&glasSet, 'a');
	addToSet(&glasSet, 'o');
	addToSet(&glasSet, 'e');
	addToSet(&glasSet, 'i');
	addToSet(&glasSet, 'u');
	addToSet(&glasSet, 'y');

	letterSet = setSubtract(letterSet, glasSet);
	tmpSet = glasSet;

	while ((ch = getchar()) != EOF)
	{
		ch = toLower(ch);

		if (isLetter(ch))
		{
			isInput = 1;

			if (isKeyExists(letterSet, ch)) continue;

			if (isKeyExists(glasSet, ch)) removeFromSet(&glasSet, ch);
			else if (!letterFound)
			{
				letterFound = 1;
				numFirst = num + 1;
			}
		}
		else if (isSpace(ch))
		{
			if (isInput) num++;	

			isInput = 0;
			glasSet = tmpSet;
		}
		else isInput = 1;
	}

	if (letterFound) printf("Слово #%d - содержит одинаковые гласные\n", numFirst);
	else printf("Не найдено ни одного слова с повторяющимися гласными\n");

	return 0;
}
Esempio n. 6
0
//------------------------------------------------------------------------------
void SimFire::onRemove()
{
   // remove from whatever container we're in
   if (getContainer())
      getContainer()->removeObject(this);

   Sfx::Manager::Stop( manager, hSound );

   if (image.translucentShape)
      delete image.translucentShape;
   if (image.nonTranslucentShape)
      delete image.nonTranslucentShape;
      
   if(lightRange > 0.0f && SimFire::DynamicLighting)
      removeFromSet(SimLightSetId);

   Parent::onRemove();
}
bool SimMovingShape::setMoveState(SimMovingShape::State newState)
{
	switch (newState) {
		case Start:
		case End:
			// Cant set these states externally
			return false;
		case Stop:
			removeFromSet(SimTimerSetId);
			state = newState;
			break;
		case Forward: {
			if (state != End) {
				if (state != Forward && state != Backward)
					addToSet(SimTimerSetId);
				if (state == Start) {
					if (!buildMovementVector(0)) {
						state = Start;
						return false;
					}
					//
					wayPoint = 0;
					time = 0.0f;
				}
				state = newState;
			}
			break;
		}
		case Backward: {
			if (state != Start) {
				if (state != Forward && state != Backward)
					addToSet(SimTimerSetId);
				state = newState;
			}
			break;
		}
	}
	return true;
}
Esempio n. 8
0
void Object::setAdjustment(short a) {
    removeFromSet();
    adjustment = MAX<short>(-127, MIN<short>(a, 127));
    addToSet();
}
Esempio n. 9
0
void Object::setShopValue(unsigned long v) {
    removeFromSet();
    shopValue = MIN<unsigned long>(200000000, v);
    addToSet();
}