Example #1
0
/*
 * Should always be called only after x_pop();
 */
void effect_prep(int x_idx, byte type, u16b f_idx, byte y, byte x, byte countdown,
							byte repeats, u16b power, s16b source, u16b flags)
{
	int this_x_idx, next_x_idx;

	/* Get this effect */
	effect_type *x_ptr = &x_list[x_idx];

	/* Wipe it */
	effect_wipe(x_ptr);

	/*Fill in the data*/
	x_ptr->x_type = type;
	x_ptr->x_f_idx = f_idx;
	x_ptr->x_cur_y = y;
	x_ptr->x_cur_x = x;
	x_ptr->x_countdown = countdown;
	x_ptr->x_repeats = repeats;
	x_ptr->x_power = power;
	x_ptr->x_source = source;
	x_ptr->x_flags = flags;

	/* Scan objects in that grid for combination */
	for (this_x_idx = cave_x_idx[y][x]; this_x_idx; this_x_idx = next_x_idx)
	{
		effect_type *x2_ptr;

		/* Get the object */
		x2_ptr = &x_list[this_x_idx];

		/* Get the next object */
		next_x_idx = x2_ptr->next_x_idx;

		/* Check for combination */
		if (effect_similar(x2_ptr, x_ptr))
		{
			/* Combine the items */
			effect_absorb(x2_ptr, x_ptr);

			/*We don't need it anymore*/
			effect_wipe(x_ptr);

			/* We didn't use the slot. */
			x_cnt--;

			/* We used the last slot */
			if ((x_idx + 1) == x_max) x_max--;

			/* Result */
			return;
		}

	}

	/*Put it in the proper order*/
	place_effect_idx(x_idx, y, x);

}
Example #2
0
effect_type::effect_type()
{
    effect_wipe();
}