src/genericunits.cpp
// This functions frees the slave units (if there are any) of a given
// unit

This functions frees the slave units (if there are any) of a given
unit
This functions frees the slave units ( if there are any ) of a given unit
bool freeSlavesOf(genericUnitStruct* unit)
{
	genericUnitStruct* slave;
	if (unit->slaveUnit.objectType==FILE_GAMEDATA_GAMEOBJECT_EMPTY) {
		return true;
	}else{
		slave=getUnitPointer(unit->slaveUnit);
		if (slave==NULL) return false;
		unit->slaveUnit.objectType=FILE_GAMEDATA_GAMEOBJECT_EMPTY;
		unit->slaveUnit.id=FILE_GAMEDATA_WHATEVER_ID;
		slave->slaveOf.objectType=FILE_GAMEDATA_GAMEOBJECT_EMPTY;
		slave->slaveOf.id=FILE_GAMEDATA_WHATEVER_ID;
		slave->nowDrawable=true;
	}
	return true;
}
bool freeSlavesOf ( genericUnitStruct * unit ) { genericUnitStruct * slave ; if ( unit -> slaveUnit . objectType == FILE_GAMEDATA_GAMEOBJECT_EMPTY ) { return true ; } else { slave = getUnitPointer ( unit -> slaveUnit ) ; if ( slave == NULL ) return false ; unit -> slaveUnit . objectType = FILE_GAMEDATA_GAMEOBJECT_EMPTY ; unit -> slaveUnit . id = FILE_GAMEDATA_WHATEVER_ID ; slave -> slaveOf . objectType = FILE_GAMEDATA_GAMEOBJECT_EMPTY ; slave -> slaveOf . id = FILE_GAMEDATA_WHATEVER_ID ; slave -> nowDrawable = true ; } return true ; }
This functions frees the slave units (if there are any) of a given
unit
This functions frees the slave units ( if there are any ) of a given unit
// nothing to do
 // all ok
 // get the slave unit
 // unlink both objects
 // make the unlinked slave visible
 // all ok
