Example #1
0
//	Create a wing.
//	cur_object_index becomes the leader.
//	If count == -1, then all objects of wing cur_wing get added to the wing.
//	If count == +n, then n objects are added to the wing.
void test_form_wing(int count)
{
	int	i, wingmen[MAX_OBJECTS];
	int	j, fill_flag;

	j = 0;

	Assert(cur_object_index != -1);
	Assert(Objects[cur_object_index].type != OBJ_NONE);
	Assert(get_wingnum(cur_object_index) != -1);
	get_wingnum(cur_object_index);

	wingmen[0] = -1;

	for (i=1; i<MAX_OBJECTS; i++)
		if ((get_wingnum(i) == cur_wing) && (Objects[i].type != OBJ_NONE))
			if (i != cur_object_index)
				wingmen[j++] = i;
	
	wingmen[j] = -1;

	fill_flag = 0;

	if (count > 0) {
		fill_flag = 1;
		j += count;
	}

	set_wingnum(cur_object_index, cur_wing);
	create_wing(0, cur_object_index, wingmen, j, fill_flag);
}
Example #2
0
void create_wings_from_objects(void)
{
	int	i;

	for (i=0; i<MAX_WINGS; i++)
		Wings[i].wave_count= 0;

	for (i=0; i<MAX_OBJECTS; i++)
		if (Objects[i].type != OBJ_NONE)
			if (get_wingnum(i) != -1) {
				int	wingnum = get_wingnum(i);
				
				Assert((wingnum >= 0) && (wingnum < MAX_WINGS));
				Assert(Wings[wingnum].wave_count < MAX_SHIPS_PER_WING);
// JEH			strcpy_s(Wings[wingnum].ship_names[Wings[wingnum].count++], i;
			}

}