| 653 | } |
| 654 | |
| 655 | void MacroActionVariable::SetSegmentIndexValue(int value) |
| 656 | { |
| 657 | DecrementCurrentSegmentVariableRef(); |
| 658 | |
| 659 | auto m = GetMacro(); |
| 660 | if (!m) { |
| 661 | _macroSegment.reset(); |
| 662 | return; |
| 663 | } |
| 664 | |
| 665 | if (value < 0) { |
| 666 | _macroSegment.reset(); |
| 667 | return; |
| 668 | } |
| 669 | |
| 670 | std::shared_ptr<MacroSegment> segment; |
| 671 | if (_action == Action::SET_CONDITION_VALUE) { |
| 672 | if (value < (int)m->Conditions().size()) { |
| 673 | segment = m->Conditions().at(value); |
| 674 | } |
| 675 | } else if (_action == Action::SET_ACTION_VALUE) { |
| 676 | if (value < (int)m->Actions().size()) { |
| 677 | segment = m->Actions().at(value); |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | _macroSegment = segment; |
| 682 | if (segment) { |
| 683 | IncrementVariableRef(segment.get()); |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | int MacroActionVariable::GetSegmentIndexValue() const |
| 688 | { |
no test coverage detected