Exemplo n.º 1
0
bool Scene::canResizeStart( Clip *clip, double &newPos, double endPos, int track )
{
	QMutexLocker ml( &mutex );
	newPos = nearestPTS( newPos, profile.getVideoFrameDuration() );
	double newLength = endPos - newPos;
	double start = clip->getSource()->getProfile().getStreamStartTime();
	double end = clip->getSource()->getProfile().getStreamStartTime() + clip->getSource()->getProfile().getStreamDuration();
	if ( newLength < profile.getVideoFrameDuration() )
		return false;
	if ( clip->getSpeed() < 0 ) {
		if ( clip->getSource()->getType() == InputBase::FFMPEG && clip->start() + (newLength * qAbs(clip->getSpeed())) > end )
			return false;
	}
	else {
		if ( clip->getSource()->getType() == InputBase::FFMPEG && clip->start() + ((newPos - clip->position()) * qAbs(clip->getSpeed())) < start )
			return false;
	}
	
	return checkPlacement( clip, track, newPos, newLength );
}
Exemplo n.º 2
0
int placeQueen(int *columnForRow, int row, int maxRow, int flag) {
 int i, j;
 if(row == maxRow) {
  for(i = 0; i < row; i++) {
   printf("%d ",columnForRow[i] + 1);
  }
  printf("\n");
  return 1;
 }
 for(i = 0; i < maxRow; i++) {
  if(checkPlacement(columnForRow, row, i)) {
   if(!flag) {
    flag = placeQueen(columnForRow, row + 1, maxRow, 0);
   } else {
    return 1;
   }
  }
 }
 return 0;
}
Exemplo n.º 3
0
bool Scene::canResize( Clip *clip, double &newLength, int track )
{
	newLength = nearestPTS( newLength, profile.getVideoFrameDuration() );
	double start = clip->getSource()->getProfile().getStreamStartTime();
	double end = clip->getSource()->getProfile().getStreamStartTime() + clip->getSource()->getProfile().getStreamDuration();
	double margin = profile.getVideoFrameDuration() / 4.0;
	if ( newLength < profile.getVideoFrameDuration() ) {
		return false;
	}
	if ( clip->getSpeed() < 0 ) {
		if ( clip->getSource()->getType() == InputBase::FFMPEG && clip->start() + ((clip->length() - newLength) * qAbs(clip->getSpeed())) < start ) {
			return false;
		}
	}
	else {
		if ( clip->getSource()->getType() == InputBase::FFMPEG && clip->start() + (newLength * qAbs(clip->getSpeed())) > end + margin ) {
			return false;
		}
	}
	
	return checkPlacement( clip, track, clip->position(), newLength );
}
Exemplo n.º 4
0
bool Scene::canMove( Clip *clip, double clipLength, double &newPos, int newTrack )
{
	newPos = nearestPTS( newPos, profile.getVideoFrameDuration() );
	return checkPlacement( clip, newTrack, newPos, clipLength );
}
Exemplo n.º 5
0
void setUpBoard(Unit *u[NUM]) {
    Unit t;
    readMap();
    bool gotNames = false;
    int i;
    int pnum;
    int minr, maxr, minc, maxc;

    for (i = 0; i < NUM; ++i)u[i] = 0;

    if (!AUTOTOURNEY) {
        for (i = 0; i < numplayers; ++i) {
            tryagain:
            cout << "tla" << i << ": ";
            cin >> tla[i];
            if (tla[i] == "?") {
                printTlaList();
                goto tryagain;
            }
            if (!checksOut(tla[i])) {
                cout << "That tla is not in the list.\n";
                cout << "type '?' to see a full list.\n";
                goto tryagain;
            }
        }
    }

    // make all the crowns
    for (i = 0; i < numplayers; ++i) {
        pnum = i % numplayers;
        minr = startBox[pnum].minr;
        maxr = startBox[pnum].maxr;
        minc = startBox[pnum].minc;
        maxc = startBox[pnum].maxc;
        u[i] = newUnit(tla[pnum], crown);
        t = *u[i];
        u[i]->Place(minr, maxr, minc, maxc, makeSitRep(u, i));
        checkPlacement(u[i], t, minr, maxr, minc, maxc);
        updateB(u[i]);
    }
    // make all the knights
    for (; i < (numplayers + NUMKNIGHTS); ++i) {
        pnum = i % numplayers;
        pnum = i % numplayers;
        minr = startBox[pnum].minr;
        maxr = startBox[pnum].maxr;
        minc = startBox[pnum].minc;
        maxc = startBox[pnum].maxc;
        u[i] = newUnit(tla[pnum], knight);
        t = *u[i];
        u[i]->Place(minr, maxr, minc, maxc, makeSitRep(u, i));
        checkPlacement(u[i], t, minr, maxr, minc, maxc);
        updateB(u[i]);
    }
    // make all the archers
    for (; i < (numplayers + NUMKNIGHTS + NUMARCHERS); ++i) {
        pnum = i % numplayers;
        minr = startBox[pnum].minr;
        maxr = startBox[pnum].maxr;
        minc = startBox[pnum].minc;
        maxc = startBox[pnum].maxc;
        u[i] = newUnit(tla[pnum], archer);
        t = *u[i];
        u[i]->Place(minr, maxr, minc, maxc, makeSitRep(u, i));
        checkPlacement(u[i], t, minr, maxr, minc, maxc);
        updateB(u[i]);
    }
    // make all the infantry
    for (; i < NUM; ++i) {
        pnum = i % numplayers;
        minr = startBox[pnum].minr;
        maxr = startBox[pnum].maxr;
        minc = startBox[pnum].minc;
        maxc = startBox[pnum].maxc;
        u[i] = newUnit(tla[pnum], infantry);
        t = *u[i];
        u[i]->Place(minr, maxr, minc, maxc, makeSitRep(u, i));
        checkPlacement(u[i], t, minr, maxr, minc, maxc);
        updateB(u[i]);
    }

    return;
}