1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Adds step events.

This commit is contained in:
Thomas Harte 2018-05-10 21:58:14 -04:00
parent ef19a03efc
commit 9089bf6535

View File

@ -50,7 +50,11 @@ bool Drive::get_is_track_zero() {
void Drive::step(HeadPosition offset) {
HeadPosition old_head_position = head_position_;
head_position_ += offset;
if(head_position_ < HeadPosition(0)) head_position_ = HeadPosition(0);
if(observer_) observer_->announce_drive_event(drive_name_, Activity::Observer::DriveEvent::Step);
if(head_position_ < HeadPosition(0)) {
head_position_ = HeadPosition(0);
if(observer_) observer_->announce_drive_event(drive_name_, Activity::Observer::DriveEvent::StepBelowZero);
}
// If the head moved, flush the old track.
if(head_position_ != old_head_position) {