예제 #1
0
void block::updatePositions(block & t){
	
	if(blocksIn.size()&&!bSeq&&blockIsInside(t)==1&&!blocksIn[0].onInside(t.x, t.y)) blocksIn[0].move(x+20,y+40+t.h+t.heightOnlyOn()),blocksIn[0].updatePositions(t);
	else if(blocksIn.size()) blocksIn[0].move(x+20,y+40),blocksIn[0].updatePositions(t);
	for (unsigned int i=1; i<blocksIn.size()&&blocksIn.size()>1; i++) {
		if(blockIsInside(t)-2==i-1&&!bSeq&&!blocksIn[i-1].onInside(t.x, t.y)&&!blocksIn[i].cond) 
			blocksIn[i].move(blocksIn[i-1].x,blocksIn[i-1].y+blocksIn[i-1].h+t.h+t.heightOnlyOn()-5);
		else blocksIn[i].move(blocksIn[i-1].x,blocksIn[i-1].y+blocksIn[i-1].h-5);
		blocksIn[i].updatePositions(t);
	}
	if(blocksOn.size()&&!bSeq&&blockIsBelow(t)==1) blocksOn[0].move(x,y+h-5),blocksOn[0].updatePositions(t);
	else if(blocksOn.size()) blocksOn[0].move(x,y+h-5),blocksOn[0].updatePositions(t);
	for (unsigned int i=1; i<blocksOn.size()&&blocksOn.size()>1; i++) {
		if(blocksOn[i-1].blockIsBelow(t)==1&&!bSeq&&!blocksOn[i-1].onInside(t.x, t.y)&&!blocksOn[i].cond) {
			blocksOn[i].move(blocksOn[i-1].x,blocksOn[i-1].y+blocksOn[i-1].h+t.h+t.heightOnlyOn()-5);
		}
		else blocksOn[i].move(blocksOn[i-1].x,blocksOn[i-1].y+blocksOn[i-1].h-5);
		blocksOn[i].updatePositions(t);
	}
	for (unsigned int i=0; i<numBlocks.size(); i++) {
			numBlocks[i].move(x+numBlocks[i].xo+1,y+(40-numBlocks[i].h)/2);
	}
}
예제 #2
0
int bGroup::heightUpdate(block & grab, block & comp)
{
	int ret=0;
	for (unsigned int i=0; i<comp.numInside(); i++) {
		heightUpdate(grab, comp.blocksIn[i]);
	}
	for (unsigned int i=0; i<comp.size(); i++) {
		heightUpdate(grab, comp.blocksOn[i]);
	}
	if(comp.blockIsInside(grab)&&!comp.bSeq&&!grab.numBlock){
		if(!comp.inBlockIn(grab.x,grab.y)) comp.h=grab.heightOnlyOn(true)+comp.heightInside()+grab.h+65-((!comp.numInside())?40:0);
		else comp.h=comp.heightInside()+65-((!comp.numInside())?40:0);
		comp.updatePositions(grab);
	}
	return ret;
}