src/genericunits.cpp
// constructSlaverFullFrame ******
// Compose the frame information of a unit and all its recursive slaves,
// so that the composed frame information has the combined boundaries
// of all the slaves and the unit itself. This way, a frameDataStruct
// is created containing the smallest boundaries that let all these
// units fit there.
// Only the handle coordinates and the frame size are set up in this
// fake frame
// Combined collision coordinates aren't calculated.

constructSlaverFullFrame
Compose the frame information of a unit and all its recursive slaves,
so that the composed frame information has the combined boundaries
of all the slaves and the unit itself. This way, a frameDataStruct
is created containing the smallest boundaries that let all these
units fit there.
Only the handle coordinates and the frame size are set up in this
fake frame
Combined collision coordinates aren't calculated.
constructSlaverFullFrame Compose the frame information of a unit and all its recursive slaves so that the composed frame information has the combined boundaries of all the slaves and the unit itself . This way a frameDataStruct is created containing the smallest boundaries that let all these units fit there . Only the handle coordinates and the frame size are set up in this fake frame Combined collision coordinates aren ' t calculated .
bool constructSlaverFullFrame(
	genericUnitStruct* unit,
	frameDataStruct* frameToWrite)
{
	frameDataStruct* unitFrame;
	frameDataStruct slaveFrame;
	genericUnitStruct* slave;
	int wToLeft=0, wToRight=0, hToTop=0, hToBottom=0;
	int tempWToLeft, tempWToRight, tempHToTop, tempHToBottom;
	int xOff, yOff;
	unitFrame=getUnitFrame(unit);
	if (unitFrame==NULL) return false;
	if (unit->slaveUnit.objectType==FILE_GAMEDATA_GAMEOBJECT_EMPTY) {
		(*frameToWrite)=(*unitFrame);
	}else{
		slave=getUnitPointer(unit->slaveUnit);
		if (slave==NULL) return false;
		if (!constructSlaverFullFrame(slave, &slaveFrame)) return false;
		xOff=(unitFrame->adherenceX)-(slaveFrame.adherenceX);
		yOff=(unitFrame->adherenceY)-(slaveFrame.adherenceY);
		wToLeft=unitFrame->handlerX;
		wToRight=unitFrame->w-unitFrame->handlerX;
		hToTop=unitFrame->handlerY;
		hToBottom=unitFrame->h-unitFrame->handlerY;
		tempWToLeft=slaveFrame.handlerX-xOff;
		tempWToRight=slaveFrame.w-slaveFrame.handlerX+xOff;
		tempHToTop=slaveFrame.handlerY-yOff;
		tempHToBottom=slaveFrame.h-slaveFrame.handlerY+yOff;
		wToLeft=(wToLeft>tempWToLeft?wToLeft:tempWToLeft);
		wToRight=(wToRight>tempWToRight?wToRight:tempWToRight);
		hToTop=(hToTop>tempHToTop?hToTop:tempHToTop);
		hToBottom=(hToBottom>tempHToBottom?hToBottom:tempHToBottom);
		frameToWrite->handlerX=wToLeft;
		frameToWrite->handlerY=hToTop;
		frameToWrite->w=wToLeft+wToRight;
		frameToWrite->h=hToTop+hToBottom;
	}
	return true;
}
bool constructSlaverFullFrame ( genericUnitStruct * unit , frameDataStruct * frameToWrite ) { frameDataStruct * unitFrame ; frameDataStruct slaveFrame ; genericUnitStruct * slave ; int wToLeft = 0 , wToRight = 0 , hToTop = 0 , hToBottom = 0 ; int tempWToLeft , tempWToRight , tempHToTop , tempHToBottom ; int xOff , yOff ; unitFrame = getUnitFrame ( unit ) ; if ( unitFrame == NULL ) return false ; if ( unit -> slaveUnit . objectType == FILE_GAMEDATA_GAMEOBJECT_EMPTY ) { ( * frameToWrite ) = ( * unitFrame ) ; } else { slave = getUnitPointer ( unit -> slaveUnit ) ; if ( slave == NULL ) return false ; if ( ! constructSlaverFullFrame ( slave , & slaveFrame ) ) return false ; xOff = ( unitFrame -> adherenceX ) - ( slaveFrame . adherenceX ) ; yOff = ( unitFrame -> adherenceY ) - ( slaveFrame . adherenceY ) ; wToLeft = unitFrame -> handlerX ; wToRight = unitFrame -> w - unitFrame -> handlerX ; hToTop = unitFrame -> handlerY ; hToBottom = unitFrame -> h - unitFrame -> handlerY ; tempWToLeft = slaveFrame . handlerX - xOff ; tempWToRight = slaveFrame . w - slaveFrame . handlerX + xOff ; tempHToTop = slaveFrame . handlerY - yOff ; tempHToBottom = slaveFrame . h - slaveFrame . handlerY + yOff ; wToLeft = ( wToLeft > tempWToLeft ? wToLeft : tempWToLeft ) ; wToRight = ( wToRight > tempWToRight ? wToRight : tempWToRight ) ; hToTop = ( hToTop > tempHToTop ? hToTop : tempHToTop ) ; hToBottom = ( hToBottom > tempHToBottom ? hToBottom : tempHToBottom ) ; frameToWrite -> handlerX = wToLeft ; frameToWrite -> handlerY = hToTop ; frameToWrite -> w = wToLeft + wToRight ; frameToWrite -> h = hToTop + hToBottom ; } return true ; }
constructSlaverFullFrame 
Compose the frame information of a unit and all its recursive slaves,
so that the composed frame information has the combined boundaries
of all the slaves and the unit itself.
constructSlaverFullFrame Compose the frame information of a unit and all its recursive slaves so that the composed frame information has the combined boundaries of all the slaves and the unit itself .
// slaver enemy unit to obtain the current frame from
 // frame struct to write to
 // these are: distance from the x handle to the left and right border,
 // and distance to the y handle to the top and bottom border. These
 // four values will be calculated, once for visibility boundaries,
 // and then for collision boundaries.
 // get the frame of this unit
 // check for errors
 // does it have any slaves?
 // base case, no more slaves!
 // return the information of the current frame 
 // get the slave first
 // check for errors
 // write in slaveFrame the information of the slave unit first
 // now combine the information of this unit with the one of
 // the slave
 // VISIBILITY CALCULATION
 // calculate the displacement between the slave and the unit
 // calculate the new four values, for the unit
 // and for the slave (displaced as needed)
 // obtain the combination of both values
 // write the final frame data
 // all ok
