Make PositionLabels have direction status indicators
[cs356-p1-elevator.git] / elevatorgui.cpp
index 630a855..2c82772 100644 (file)
@@ -229,20 +229,14 @@ void ElevatorGUI::on_call_button_toggled (CallButton *button)
        }
 }
 
-void ElevatorGUI::gui_update_position_label (int elevator, float new_position)
+void ElevatorGUI::gui_update_position_label (int elevator, float new_position, Direction direction)
 {
-       std::ostringstream str;
-
-       // Generate the text
-       str << std::setiosflags (std::ios_base::showpoint | std::ios_base::fixed)
-               << std::setprecision(1) << new_position;
-
        // Find the correct label and set it
        PositionLabelVector::iterator it;
 
        for (it=position_labels_.begin(); it!=position_labels_.end(); it++)
                if ((*it)->getElevatorNumber() == elevator)
-                       (*it)->set_text (str.str());
+                       (*it)->update_position (new_position, direction);
 }
 
 void ElevatorGUI::gui_unpress_call_button (int floor, Direction direction)