rem: umgah_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter) PELEMENT ShipPtr; PEVALUATE_DESC ObjectsOfConcern; COUNT ConcernCounter;
add: umgah_intelligence (PELEMENT ShipPtr, PEVALUATE_DESC ObjectsOfConcern, COUNT ConcernCounter)
context: umgah_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter)PELEMENT ShipPtr;PEVALUATE_DESC ObjectsOfConcern;COUNT ConcernCounter;{	PEVALUATE_DESC lpEvalDesc;	STARSHIPPTR StarShipPtr, EnemyStarShipPtr;	GetElementStarShip (ShipPtr, &StarShipPtr);	lpEvalDesc = &ObjectsOfConcern[ENEMY_WEAPON_INDEX];	if (lpEvalDesc->ObjectPtr && lpEvalDesc->MoveState == ENTICE)	{		if (lpEvalDesc->which_turn > 3				|| (StarShipPtr->old_status_flags & SPECIAL))			lpEvalDesc->ObjectPtr = 0;		else if ((lpEvalDesc->ObjectPtr->state_flags & FINITE_LIFE)				&& !(lpEvalDesc->ObjectPtr->state_flags & CREW_OBJECT))			lpEvalDesc->MoveState = AVOID;		else			lpEvalDesc->MoveState = PURSUE;	}	lpEvalDesc = &ObjectsOfConcern[ENEMY_SHIP_INDEX];	if (StarShipPtr->special_counter			|| ObjectsOfConcern[GRAVITY_MASS_INDEX].ObjectPtr			|| lpEvalDesc->ObjectPtr == 0)	{		StarShipPtr->RaceDescPtr->cyborg_control.WeaponRange = CLOSE_RANGE_WEAPON;		ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter);		if (lpEvalDesc->which_turn < 16)			StarShipPtr->ship_input_state |= WEAPON;		StarShipPtr->ship_input_state &= ~SPECIAL;	}	else	{		BYTE this_turn;		SIZE delta_x, delta_y;		BOOLEAN EnemyBehind, EnoughJuice;		if (lpEvalDesc->which_turn >= 0xFF + 1)			this_turn = 0xFF;		else			this_turn = (BYTE)lpEvalDesc->which_turn;		EnoughJuice = (BOOLEAN)(WORLD_TO_TURN (				JUMP_DIST * StarShipPtr->RaceDescPtr->ship_info.energy_level				/ SPECIAL_ENERGY_COST				) > this_turn);		delta_x = lpEvalDesc->ObjectPtr->next.location.x -				ShipPtr->next.location.x;		delta_y = lpEvalDesc->ObjectPtr->next.location.y -				ShipPtr->next.location.y;		EnemyBehind = (BOOLEAN)(NORMALIZE_ANGLE (				ARCTAN (delta_x, delta_y)				- (FACING_TO_ANGLE (StarShipPtr->ShipFacing)				+ HALF_CIRCLE) + (OCTANT + (OCTANT >> 2))				) <= ((OCTANT + (OCTANT >> 2)) << 1));				GetElementStarShip (lpEvalDesc->ObjectPtr, &EnemyStarShipPtr);		if (EnoughJuice				&& ((StarShipPtr->old_status_flags & SPECIAL)				|| EnemyBehind				|| (this_turn > 6				&& MANEUVERABILITY (				&EnemyStarShipPtr->RaceDescPtr->cyborg_control				) <= SLOW_SHIP)				|| (this_turn >= 16 && this_turn <= 24)))			StarShipPtr->RaceDescPtr->cyborg_control.WeaponRange = (LONG_RANGE_WEAPON << 3);		else			StarShipPtr->RaceDescPtr->cyborg_control.WeaponRange = CLOSE_RANGE_WEAPON;		ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter);		if (StarShipPtr->RaceDescPtr->cyborg_control.WeaponRange == CLOSE_RANGE_WEAPON)			StarShipPtr->ship_input_state &= ~SPECIAL;		else		{			BOOLEAN LinedUp;			StarShipPtr->ship_input_state &= ~THRUST;			LinedUp = (BOOLEAN)(ShipPtr->turn_wait == 0					&& !(StarShipPtr->old_status_flags & (LEFT | RIGHT)));			if (((StarShipPtr->old_status_flags & SPECIAL)					&& this_turn <= StarShipPtr->RaceDescPtr->characteristics.special_wait)					|| (!(StarShipPtr->old_status_flags & SPECIAL)					&& EnemyBehind && (LinedUp || this_turn < 16)))			{				StarShipPtr->ship_input_state |= SPECIAL;				StarShipPtr->RaceDescPtr->characteristics.special_wait = this_turn;				/* don't want him backing straight into ship */				if (this_turn <= 8 && LinedUp)				{					if (TFB_Random () & 1)						StarShipPtr->ship_input_state |= LEFT;					else						StarShipPtr->ship_input_state |= RIGHT;				}			}			else if (StarShipPtr->old_status_flags & SPECIAL)			{				StarShipPtr->ship_input_state &= ~(SPECIAL | LEFT | RIGHT);				StarShipPtr->ship_input_state |= THRUST;			}		}		if (this_turn < 16 && !EnemyBehind)			StarShipPtr->ship_input_state |= WEAPON;	}	if (!(StarShipPtr->ship_input_state & SPECIAL))		StarShipPtr->RaceDescPtr->characteristics.special_wait = 0xFF;}