aboutsummaryrefslogtreecommitdiff
path: root/engines/dm/timeline.cpp
diff options
context:
space:
mode:
authorStrangerke2016-09-07 21:46:08 +0200
committerStrangerke2016-09-07 21:46:08 +0200
commit40f57744ef9eb93fa99d14664053bb1f1e0ffcea (patch)
tree4ead71f934d3969dcf0dfc2042bf48e1703abb93 /engines/dm/timeline.cpp
parent7bda512dde965e50269d7eba45562db4c8fdd562 (diff)
downloadscummvm-rg350-40f57744ef9eb93fa99d14664053bb1f1e0ffcea.tar.gz
scummvm-rg350-40f57744ef9eb93fa99d14664053bb1f1e0ffcea.tar.bz2
scummvm-rg350-40f57744ef9eb93fa99d14664053bb1f1e0ffcea.zip
DM: Remove a GOTO from fixChronology()
Diffstat (limited to 'engines/dm/timeline.cpp')
-rw-r--r--engines/dm/timeline.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 0f722077fa..1123900f23 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -142,36 +142,34 @@ void Timeline::fixChronology(uint16 timelineIndex) {
if (eventCount == 1)
return;
- uint16 L0582_ui_EventIndex = _timeline[timelineIndex];
- TimelineEvent *timelineEvent = &_events[L0582_ui_EventIndex];
- bool L0585_B_ChronologyFixed = false;
+ uint16 eventIndex = _timeline[timelineIndex];
+ TimelineEvent *timelineEvent = &_events[eventIndex];
+ bool chronologyFixed = false;
while (timelineIndex > 0) { /* Check if the event should be moved earlier in the timeline */
uint16 altTimelineIndex = (timelineIndex - 1) >> 1;
if (isEventABeforeB(timelineEvent, &_events[_timeline[altTimelineIndex]])) {
_timeline[timelineIndex] = _timeline[altTimelineIndex];
timelineIndex = altTimelineIndex;
- L0585_B_ChronologyFixed = true;
- } else {
+ chronologyFixed = true;
+ } else
break;
- }
}
- if (L0585_B_ChronologyFixed)
- goto T0236011;
- eventCount = ((eventCount - 1) - 1) >> 1;
- while (timelineIndex <= eventCount) { /* Check if the event should be moved later in the timeline */
- uint16 altTimelineIndex = (timelineIndex << 1) + 1;
- if (((altTimelineIndex + 1) < _eventCount) && (isEventABeforeB(&_events[_timeline[altTimelineIndex + 1]], &_events[_timeline[altTimelineIndex]]))) {
- altTimelineIndex++;
- }
- if (isEventABeforeB(&_events[_timeline[altTimelineIndex]], timelineEvent)) {
- _timeline[timelineIndex] = _timeline[altTimelineIndex];
- timelineIndex = altTimelineIndex;
- } else {
- break;
+ if (!chronologyFixed) {
+ eventCount = ((eventCount - 1) - 1) >> 1;
+ while (timelineIndex <= eventCount) { /* Check if the event should be moved later in the timeline */
+ uint16 altTimelineIndex = (timelineIndex << 1) + 1;
+ if (((altTimelineIndex + 1) < _eventCount) && (isEventABeforeB(&_events[_timeline[altTimelineIndex + 1]], &_events[_timeline[altTimelineIndex]])))
+ altTimelineIndex++;
+
+ if (isEventABeforeB(&_events[_timeline[altTimelineIndex]], timelineEvent)) {
+ _timeline[timelineIndex] = _timeline[altTimelineIndex];
+ timelineIndex = altTimelineIndex;
+ } else
+ break;
}
}
-T0236011:
- _timeline[timelineIndex] = L0582_ui_EventIndex;
+
+ _timeline[timelineIndex] = eventIndex;
}
bool Timeline::isEventABeforeB(TimelineEvent* eventA, TimelineEvent* eventB) {