Skip to content

Commit d593357

Browse files
committed
Handle strict sequences too
1 parent 2cff7d2 commit d593357

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

engine/player/player.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6361,15 +6361,25 @@ void player_t::sequence_add( const action_t* a, const player_t* t )
63616361
data.spell_id = a->id;
63626362
if ( data.spell_id == 0 && a->type == ACTION_SEQUENCE )
63636363
{
6364-
const sequence_t* seq = static_cast<const sequence_t*>( a );
6365-
if ( seq->current_action > 0 && seq->current_action <= as<int>( seq->sub_actions.size() ) )
6364+
const sequence_t* seq = dynamic_cast<const sequence_t*>( a );
6365+
const strict_sequence_t* strict_seq = nullptr;
6366+
if ( !seq )
6367+
strict_seq = dynamic_cast<const strict_sequence_t*>( a );
6368+
6369+
if ( seq || strict_seq )
63666370
{
6367-
const action_t* sub_action = seq->sub_actions[ seq->current_action - 1 ];
6368-
data.spell_id = sub_action->id;
6369-
const char* spell_name = sub_action->data_reporting().name_cstr();
6370-
if ( spell_name == nullptr || spell_name[ 0 ] == '\0' )
6371-
spell_name = sub_action->name_reporting();
6372-
data.spell_name = spell_name;
6371+
int idx = seq ? seq->current_action : static_cast<int>( strict_seq->current_action );
6372+
const auto& sub_actions = seq ? seq->sub_actions : strict_seq->sub_actions;
6373+
6374+
if ( idx > 0 && idx <= as<int>( sub_actions.size() ) )
6375+
{
6376+
const action_t* sub_action = sub_actions[ idx - 1 ];
6377+
data.spell_id = sub_action->id;
6378+
const char* spell_name = sub_action->data_reporting().name_cstr();
6379+
if ( spell_name == nullptr || spell_name[ 0 ] == '\0' )
6380+
spell_name = sub_action->name_reporting();
6381+
data.spell_name = spell_name;
6382+
}
63736383
}
63746384
}
63756385
}

0 commit comments

Comments
 (0)