コード例 #1
0
/**
 * @brief Fill an array with available UFOs for recon mission type (aerial or ground).
 * @param[in] mission Pointer to the mission we are currently creating.
 * @param[out] ufoTypes Array of ufoType_t that may be used for this mission.
 * @note Recon mission -- Stage 0
 * @return number of elements written in @c ufoTypes
 */
int CP_ReconMissionAvailableUFOs (const mission_t *mission, ufoType_t *ufoTypes)
{
	int num = 0;

	if (UFO_ShouldAppearOnGeoscape(UFO_SCOUT))
		ufoTypes[num++] = UFO_SCOUT;
	if (UFO_ShouldAppearOnGeoscape(UFO_FIGHTER))
		ufoTypes[num++] = UFO_FIGHTER;

	return num;
}
コード例 #2
0
ファイル: cp_mission_terror.c プロジェクト: kevlund/ufoai
/**
 * @brief Fill an array with available UFOs for Terror attack mission type.
 * @param[in] mission Pointer to the mission we are currently creating (may be NULL if we want to know what UFO
 * types will be needed during the whole game).
 * @param[out] ufoTypes Array of ufoType_t that may be used for this mission.
 * @note Terror attack mission -- Stage 0
 * @return number of elements written in @c ufoTypes
 */
int CP_TerrorMissionAvailableUFOs (const mission_t const *mission, ufoType_t *ufoTypes)
{
	int num = 0;

	ufoTypes[num++] = UFO_HARVESTER;
	if (UFO_ShouldAppearOnGeoscape(UFO_CORRUPTER))
		ufoTypes[num++] = UFO_CORRUPTER;
	if (UFO_ShouldAppearOnGeoscape(UFO_BOMBER))
		ufoTypes[num++] = UFO_BOMBER;
	/**< @todo Add Battleship when maps will be available */

	return num;
}
コード例 #3
0
ファイル: cp_mission_harvest.cpp プロジェクト: cigo/ufoai
/**
 * @brief Fill an array with available UFOs for Harvesting mission type.
 * @param[in] mission Pointer to the mission we are currently creating.
 * @param[out] ufoTypes Array of ufoType_t that may be used for this mission.
 * @note Harvesting mission -- Stage 0
 * @return number of elements written in @c ufoTypes
 */
int CP_HarvestMissionAvailableUFOs (const mission_t* mission, ufoType_t* ufoTypes)
{
	int num = 0;

	if (UFO_ShouldAppearOnGeoscape(UFO_HARVESTER))
		ufoTypes[num++] = UFO_HARVESTER;

	return num;
}
コード例 #4
0
/**
 * @brief Fill an array with available UFOs for Base Attack mission type.
 * @param[in] mission Pointer to the mission we are currently creating.
 * @param[out] ufoTypes Array of ufoType_t that may be used for this mission.
 * @note Base Attack mission -- Stage 0
 * @return number of elements written in @c ufoTypes
 */
int CP_BaseAttackMissionAvailableUFOs (const mission_t const *mission, ufoType_t *ufoTypes)
{
	int num = 0;
	ufoTypes[num++] = UFO_FIGHTER;
	if (UFO_ShouldAppearOnGeoscape(UFO_BOMBER))
		ufoTypes[num++] = UFO_BOMBER;

	return num;
}
コード例 #5
0
ファイル: cp_mission_xvi.cpp プロジェクト: cigo/ufoai
/**
 * @brief Fill an array with available UFOs for XVI Spreading mission type.
 * @param[in] mission Pointer to the mission we are currently creating.
 * @param[out] ufoTypes Array of ufoType_t that may be used for this mission.
 * @note XVI Spreading mission -- Stage 0
 * @return number of elements written in @c ufoTypes
 */
int CP_XVIMissionAvailableUFOs (const mission_t* mission, ufoType_t* ufoTypes)
{
	int num = 0;

	if (UFO_ShouldAppearOnGeoscape(UFO_CORRUPTER))
		ufoTypes[num++] = UFO_CORRUPTER;

	return num;
}
コード例 #6
0
/**
 * @brief Fill an array with available UFOs for build base mission type.
 * @param[in] mission Pointer to the mission we are currently creating.
 * @param[out] ufoTypes Array of ufoType_t that may be used for this mission.
 * @note Base Attack mission -- Stage 0
 * @return number of elements written in @c ufoTypes
 */
int CP_BuildBaseMissionAvailableUFOs (const mission_t *mission, ufoType_t *ufoTypes)
{
	int num = 0;

	if (CP_BasemissionIsSubvertingGovernmentMission(mission)) {
		/* This is a subverting government mission */
		if (UFO_ShouldAppearOnGeoscape(UFO_SCOUT))
			ufoTypes[num++] = UFO_SCOUT;
		if (UFO_ShouldAppearOnGeoscape(UFO_HARVESTER))
			ufoTypes[num++] = UFO_HARVESTER;
		if (UFO_ShouldAppearOnGeoscape(UFO_CORRUPTER))
			ufoTypes[num++] = UFO_CORRUPTER;
	} else {
		/* This is a Building base mission */
		if (UFO_ShouldAppearOnGeoscape(UFO_SUPPLY))
			ufoTypes[num++] = UFO_SUPPLY;
	}

	return num;
}
コード例 #7
0
/**
 * @brief Fill an array with available UFOs for Intercept mission type.
 * @param[in] mission Pointer to the mission we are currently creating.
 * @param[out] ufoTypes Array of ufoType_t that may be used for this mission.
 * @note Intercept mission -- Stage 0
 * @return number of elements written in @c ufoTypes
 */
int CP_InterceptMissionAvailableUFOs (const mission_t* mission, ufoType_t* ufoTypes)
{
	int num = 0;
	/* Probability to get a UFO that targets installations. Note
	 * the probability is this number divided by the number of
	 * possible UFOs. */
	const float TARGET_INS_PROBABILITY = 0.25;

	if (UFO_ShouldAppearOnGeoscape(UFO_FIGHTER))
		ufoTypes[num++] = UFO_FIGHTER;
	if (UFO_ShouldAppearOnGeoscape(UFO_GUNBOAT))
		ufoTypes[num++] = UFO_GUNBOAT;

	/* don't make attack on installation happens too often */
	if (frand() < TARGET_INS_PROBABILITY) {
		if (UFO_ShouldAppearOnGeoscape(UFO_HARVESTER))
			ufoTypes[num++] = UFO_HARVESTER;
		if (UFO_ShouldAppearOnGeoscape(UFO_CORRUPTER))
			ufoTypes[num++] = UFO_CORRUPTER;
	}

	return num;
}