diff options
Diffstat (limited to 'engines/saga/events.cpp')
-rw-r--r-- | engines/saga/events.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index cea1d771d7..99eb200f0f 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -56,8 +56,6 @@ Events::~Events(void) { // First advances event times, then processes each event with the appropriate // handler depending on the type of event. int Events::handleEvents(long msec) { - Event *event_p; - long delta_time; int result; @@ -66,7 +64,7 @@ int Events::handleEvents(long msec) { // Process each event in list for (EventList::iterator eventi = _eventList.begin(); eventi != _eventList.end(); ++eventi) { - event_p = (Event *)eventi.operator->(); + Event *event_p = &*eventi; // Call the appropriate event handler for the specific event type switch (event_p->type) { @@ -582,7 +580,7 @@ int Events::handleInterval(Event *event) { Event *Events::queue(Event *event) { Event *queuedEvent; - queuedEvent = _eventList.pushBack(*event).operator->(); + queuedEvent = &*_eventList.pushBack(*event); initializeEvent(queuedEvent); return queuedEvent; @@ -628,25 +626,23 @@ int Events::initializeEvent(Event *event) { int Events::clearList(bool playQueuedMusic) { Event *chain_walk; Event *next_chain; - Event *event_p; // Walk down event list for (EventList::iterator eventi = _eventList.begin(); eventi != _eventList.end(); ++eventi) { - event_p = (Event *)eventi.operator->(); // Only remove events not marked kEvFNoDestory (engine events) - if (!(event_p->code & kEvFNoDestory)) { + if (!(eventi->code & kEvFNoDestory)) { // Handle queued music change events before deleting them // This can happen in IHNM by music events set by sfQueueMusic() // Fixes bug #2057987 - "IHNM: Music stops in Ellen's chapter" - if (playQueuedMusic && ((event_p->code & EVENT_MASK) == kMusicEvent)) { + if (playQueuedMusic && ((eventi->code & EVENT_MASK) == kMusicEvent)) { _vm->_music->stop(); - if (event_p->op == kEventPlay) - _vm->_music->play(event_p->param, (MusicFlags)event_p->param2); + if (eventi->op == kEventPlay) + _vm->_music->play(eventi->param, (MusicFlags)eventi->param2); } // Remove any events chained off this one - for (chain_walk = event_p->chain; chain_walk != NULL; chain_walk = next_chain) { + for (chain_walk = eventi->chain; chain_walk != NULL; chain_walk = next_chain) { next_chain = chain_walk->chain; free(chain_walk); } @@ -661,19 +657,17 @@ int Events::clearList(bool playQueuedMusic) { int Events::freeList() { Event *chain_walk; Event *next_chain; - Event *event_p; // Walk down event list EventList::iterator eventi = _eventList.begin(); while (eventi != _eventList.end()) { - event_p = (Event *)eventi.operator->(); // Remove any events chained off this one */ - for (chain_walk = event_p->chain; chain_walk != NULL; chain_walk = next_chain) { + for (chain_walk = eventi->chain; chain_walk != NULL; chain_walk = next_chain) { next_chain = chain_walk->chain; free(chain_walk); } - eventi=_eventList.erase(eventi); + eventi = _eventList.erase(eventi); } return SUCCESS; @@ -681,16 +675,13 @@ int Events::freeList() { // Walks down the event list, updating event times by 'msec'. int Events::processEventTime(long msec) { - Event *event_p; uint16 event_count = 0; for (EventList::iterator eventi = _eventList.begin(); eventi != _eventList.end(); ++eventi) { - event_p = (Event *)eventi.operator->(); - - event_p->time -= msec; + eventi->time -= msec; event_count++; - if (event_p->type == kEvTImmediate) + if (eventi->type == kEvTImmediate) break; if (event_count > EVENT_WARNINGCOUNT) { |