Player/stabilize: fix duplicate actions

If a stabilize action is already present before a shot of an exu, the
stabilize-shots option should not append another one.
This commit is contained in:
Daniel Zaoui 2018-10-29 00:05:19 +02:00
parent a576265f0a
commit 4fc682df84
1 changed files with 5 additions and 1 deletions

View File

@ -565,6 +565,7 @@ _stabilization_timer_cb(void *data EINA_UNUSED)
Evas *e;
#define STAB_MAX 5
static int need_more = STAB_MAX;
_printf(2, "Not stable yet!\n");
EINA_LIST_FOREACH(_evas_list, itr, e)
{
Exactness_Image *last_img = efl_key_data_get(e, "_last_stab_shot");
@ -816,14 +817,17 @@ _src_open()
}
if (_stabilize_shots)
{
Exactness_Action_Type last_action_type = EXACTNESS_ACTION_UNKNOWN;
EINA_LIST_FOREACH_SAFE(_src_unit->actions, itr, itr2, act)
{
if (act->type == EXACTNESS_ACTION_TAKE_SHOT)
if (act->type == EXACTNESS_ACTION_TAKE_SHOT &&
last_action_type != EXACTNESS_ACTION_STABILIZE)
{
Exactness_Action *act2 = calloc(1, sizeof(*act2));
act2->type = EXACTNESS_ACTION_STABILIZE;
_src_unit->actions = eina_list_prepend_relative(_src_unit->actions, act2, act);
}
last_action_type = act->type;
}
}
}