summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0f2350d)
All of the Elevators need a unique number so that they can call into the
GUI and update their positions, etc.
Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
+Elevator::Elevator (int elevator_number)
: state_(STATE_IDLE)
, wait_(0)
, direction_(IDLE)
, position_()
, stops_()
: state_(STATE_IDLE)
, wait_(0)
, direction_(IDLE)
, position_()
, stops_()
+ , number_(elevator_number)
{
// Intentionally Left Empty
}
{
// Intentionally Left Empty
}
-Elevator::Elevator (int starting_floor)
+Elevator::Elevator (int starting_floor, int elevator_number)
: state_(STATE_IDLE)
, wait_(0)
, direction_(IDLE)
, position_(starting_floor)
, stops_()
: state_(STATE_IDLE)
, wait_(0)
, direction_(IDLE)
, position_(starting_floor)
, stops_()
+ , number_(elevator_number)
{
// Intentionally Left Empty
}
{
// Intentionally Left Empty
}
- Elevator ();
- Elevator (int starting_floor);
+ Elevator (int elevator_number);
+ Elevator (int starting_floor, int elevator_number);
void stop_at (Stop &stop);
float distance_from (Position& pos) const;
void stop_at (Stop &stop);
float distance_from (Position& pos) const;
+ /* Elevator Number: Used to make calls into the GUI */
+ int number_;
+
static const float ELEVATOR_STEP = 0.1;
};
static const float ELEVATOR_STEP = 0.1;
};
/* Create and add all of the elevators */
for (int i=0; i<number_of_elevators_; i++)
/* Create and add all of the elevators */
for (int i=0; i<number_of_elevators_; i++)
- elevators_.push_back (Elevator());
+ elevators_.push_back (Elevator(i));
}
static int choose_random_number_in_range (int low, int high)
}
static int choose_random_number_in_range (int low, int high)