Пример #1
0
void highlighter::last_action_redraw(move_ptr move)
{
	//Last action with a fake unit always gets normal appearance
	if(move->get_fake_unit()) {
		side_actions& sa = *resources::gameboard->teams().at(move->team_index()).get_side_actions().get();

		// Units with planned actions may have been killed in the previous turn before all actions were completed.
		// In these cases, remove these planned actions for any invalid units and do not redraw anything.
		if (move->get_unit() == NULL)
		{
			// Note: the planned actions seem to only get removed from the screen when
			// a redraw is triggered by the mouse cursor moving over them.
			for (side_actions::iterator iterator = sa.begin(); iterator < sa.end(); iterator++)
			{
				if (iterator->get()->get_unit() == NULL)
					sa.remove_action (iterator);
			}

			return;
		}

		side_actions::iterator last_action = sa.find_last_action_of(*(move->get_unit()));
		side_actions::iterator second_to_last_action = last_action != sa.end() && last_action != sa.begin() ? last_action - 1 : sa.end();

		bool this_is_last_action = last_action != sa.end() && move == *last_action;
		bool last_action_has_fake_unit = last_action != sa.end() && (*last_action)->get_fake_unit();
		bool this_is_second_to_last_action = (second_to_last_action != sa.end() && move == *second_to_last_action);

		if(this_is_last_action || (this_is_second_to_last_action && !last_action_has_fake_unit)) {
			move->get_fake_unit()->anim_comp().set_standing(true);
		}
	}
}
Пример #2
0
void highlighter::unhighlight_visitor::visit(move_ptr move)
{
	if(move->get_arrow()) {
		move->set_arrow_brightness(move::ARROW_BRIGHTNESS_STANDARD);
	}
	if(move->get_fake_unit()) {
		move->get_fake_unit()->anim_comp().set_disabled_ghosted(false);

		highlighter_.last_action_redraw(move);
	}
}
Пример #3
0
void highlighter::last_action_redraw(move_ptr move)
{
	//Last action with a fake unit always gets normal appearance
	if(move->get_fake_unit()) {
		side_actions& sa = *resources::gameboard->teams().at(move->team_index()).get_side_actions().get();
		side_actions::iterator last_action = sa.find_last_action_of(*(move->get_unit()));
		side_actions::iterator second_to_last_action = last_action != sa.end() && last_action != sa.begin() ? last_action - 1 : sa.end();

		bool this_is_last_action = last_action != sa.end() && move == *last_action;
		bool last_action_has_fake_unit = last_action != sa.end() && (*last_action)->get_fake_unit();
		bool this_is_second_to_last_action = (second_to_last_action != sa.end() && move == *second_to_last_action);

		if(this_is_last_action || (this_is_second_to_last_action && !last_action_has_fake_unit)) {
			move->get_fake_unit()->anim_comp().set_standing(true);
		}
	}
}
Пример #4
0
void highlighter::highlight_secondary_visitor::visit(move_ptr move)
{
	if(move->get_arrow()) {
		move->set_arrow_brightness(move::ARROW_BRIGHTNESS_HIGHLIGHTED);
	}
	if(move->get_fake_unit()) {
		move->get_fake_unit()->anim_comp().set_ghosted(true);
		//Make sure the fake unit is the only one displayed in its hex
		resources::screen->add_exclusive_draw(move->get_fake_unit()->get_location(), *move->get_fake_unit());
		highlighter_.exclusive_display_hexes_.insert(move->get_fake_unit()->get_location());

		highlighter_.last_action_redraw(move);
	}
}