Skyscraper 2.0
|
#include <controller.h>
Classes | |
struct | Call |
struct | ElevMap |
struct | Route |
Public Member Functions | |
DispatchController (Object *parent, int number) | |
~DispatchController () | |
void | Loop () |
bool | RequestRoute (CallStation *station, int starting_floor, int destination_floor) |
bool | AddElevator (int elevator) |
bool | RemoveElevator (int elevator) |
bool | ServicesElevator (int elevator) |
void | Report (const std::string &message) |
bool | ReportError (const std::string &message) |
void | ElevatorArrived (int number, int floor, bool direction) |
void | ResetArrival (int number) |
bool | IsElevatorAssigned (int number, int destination_floor, int direction) |
bool | IsElevatorAssignedToOther (int number, int destination_floor, int direction) |
void | AssignElevator (int number, int destination_floor, int direction) |
void | RegisterCallStation (CallStation *station) |
void | UnregisterCallStation (CallStation *station) |
int | GetElevatorArrived (int starting_floor, int destination_floor) |
int | GetElevatorArrivedStandard (int floor, bool direction) |
bool | IsServicedFloor (int floor) |
bool | FireService (int value) |
bool | AtMaxRequests (int elevator, int destination_floor) |
int | GetRecallFloor () |
bool | CallElevator (CallStation *station, bool direction) |
int | GetBottomFloor () |
int | GetTopFloor () |
bool | ServesFloor (int floor) |
int | GetElevator (int index) |
bool | SameElevators (const std::vector< int > &elevators) |
bool | GetCallStatus (int elevator, int floor, bool &up, bool &down) |
std::vector< CallStation * > | GetCallStations (int floor) |
![]() | |
Object (Object *parent) | |
virtual | ~Object () |
void | SetValues (const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true) |
bool | IsPermanent () |
bool | IsMovable () |
const std::string & | GetType () |
int | GetNumber () |
void | AddChild (Object *object) |
Object * | GetChild (int index) |
int | GetChildrenCount () |
void | RemoveChild (Object *object) |
SceneNode * | GetSceneNode () |
void | ShowBoundingBox (bool value) |
virtual void | Move (const Vector3 &vector, Real speed=1.0) |
virtual void | Move (Real X, Real Y, Real Z, Real speed=1.0) |
virtual void | SetPosition (const Vector3 &position) |
void | SetPositionRelative (const Vector3 &position) |
virtual void | SetPosition (Real X, Real Y, Real Z) |
void | SetPositionRelative (Real X, Real Y, Real Z) |
virtual void | SetPositionY (Real value) |
virtual Vector3 | GetPosition (bool relative=false) |
virtual void | Rotate (const Vector3 &vector, Real speed=1.0) |
virtual void | Rotate (Real X, Real Y, Real Z, Real speed=1.0) |
virtual void | SetRotation (const Vector3 &rotation) |
virtual void | SetRotation (Real X, Real Y, Real Z) |
virtual Vector3 | GetRotation () |
Quaternion | GetOrientation (bool relative=false) |
void | SetOrientation (const Quaternion &q, bool relative=false) |
virtual void | OnMove (bool parent) |
virtual void | OnRotate (bool parent) |
virtual void | OnClick (Vector3 &position, bool shift, bool ctrl, bool alt, bool right) |
virtual void | OnUnclick (bool right) |
virtual void | OnHit () |
void | NotifyMove (bool parent=false) |
void | NotifyRotate (bool parent=false) |
virtual void | ResetState () |
void | ChangeParent (Object *new_parent) |
bool | IsGlobal () |
void | Init (bool children=true) |
virtual void | OnInit () |
void | RegisterLoop (Object *object) |
void | UnregisterLoop (Object *object) |
virtual void | Enabled (bool value) |
std::string | GetNameBase () |
template<typename T > | |
bool | IsType () |
template<typename T > | |
T * | ConvertTo () |
![]() | |
ObjectBase (Object *parent) | |
virtual | ~ObjectBase () |
Object * | GetParent () |
SBS * | GetRoot () |
void | SetName (const std::string &name) |
const std::string & | GetName () |
std::string | GetNameBase () |
Public Attributes | |
int | Number |
std::string | Name |
bool | DestinationDispatch |
bool | Hybrid |
int | Range |
int | MaxPassengers |
bool | Reprocess |
![]() | |
std::string | command |
std::string | command_processed |
std::string | context |
int | linenum |
std::string | includefile |
bool | parent_deleting |
Private Member Functions | |
int | FindClosestElevator (bool &busy, bool destination, int starting_floor, int destination_floor, int direction=0) |
void | DispatchElevator (bool destination, int number, int destination_floor, int direction, bool call) |
void | RemoveRoute (const Route &route) |
void | ProcessRoutes () |
void | GetFloorRange () |
bool | ElevatorUnavailable (int elevator) |
void | CheckArrivals () |
Private Attributes | |
int | bottom_floor |
int | top_floor |
std::vector< ElevMap > | Elevators |
std::vector< Route > | Routes |
std::vector< CallStation * > | CallStations |
int | recheck |
Additional Inherited Members | |
![]() | |
void | EnableLoop (bool value) |
void | LoopChildren () |
bool | SelfDestruct () |
![]() | |
SBS * | sbs |
Definition at line 29 of file controller.h.
SBS::DispatchController::DispatchController | ( | Object * | parent, |
int | number ) |
Definition at line 35 of file controller.cpp.
References bottom_floor, DestinationDispatch, SBS::Object::EnableLoop(), Hybrid, MaxPassengers, Number, Range, recheck, Report(), Reprocess, SBS::Object::SetValues(), top_floor, and SBS::ToString().
SBS::DispatchController::~DispatchController | ( | ) |
Definition at line 57 of file controller.cpp.
References SBS::SBS::FastDelete, SBS::Object::parent_deleting, SBS::SBS::RemoveController(), and SBS::ObjectBase::sbs.
bool SBS::DispatchController::AddElevator | ( | int | elevator | ) |
Definition at line 589 of file controller.cpp.
References SBS::Elevator::AddController(), SBS::DispatchController::ElevMap::arrival_direction, SBS::DispatchController::ElevMap::arrival_floor, SBS::DispatchController::ElevMap::arrived, SBS::DispatchController::ElevMap::assigned, SBS::DispatchController::ElevMap::calls, SBS::DispatchController::ElevMap::destination_floor, Elevators, SBS::SBS::GetElevator(), GetFloorRange(), SBS::SBS::GetPower(), Number, SBS::DispatchController::ElevMap::number, Report(), SBS::ObjectBase::sbs, and SBS::ToString().
Referenced by SBS::Elevator::CreateElevator(), Skyscraper::ScriptProcessor::ControllerSection::Run(), and Skyscraper::ScriptProcessor::FloorSection::Run().
void SBS::DispatchController::AssignElevator | ( | int | number, |
int | destination_floor, | ||
int | direction ) |
Definition at line 1021 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), Report(), and SBS::ObjectBase::sbs.
Referenced by ProcessRoutes().
bool SBS::DispatchController::AtMaxRequests | ( | int | elevator, |
int | destination_floor ) |
Definition at line 1218 of file controller.cpp.
References DestinationDispatch, Elevators, SBS::SBS::GetElevator(), SBS::SBS::GetPower(), MaxPassengers, Routes, and SBS::ObjectBase::sbs.
Referenced by FindClosestElevator().
bool SBS::DispatchController::CallElevator | ( | CallStation * | station, |
bool | direction ) |
Definition at line 303 of file controller.cpp.
References SBS::DispatchController::Route::assigned_elevator, SBS::DispatchController::Route::destination, SBS::DispatchController::Route::destination_floor, DestinationDispatch, SBS::DispatchController::Route::direction, Elevators, SBS::CallStation::Error(), SBS::SBS::GetElevator(), SBS::CallStation::GetFloor(), SBS::SBS::GetPower(), Hybrid, IsServicedFloor(), SBS::DispatchController::Route::processed, Report(), ReportError(), SBS::DispatchController::Route::requests, Routes, SBS::ObjectBase::sbs, SBS_PROFILE, SBS::DispatchController::Route::starting_floor, SBS::DispatchController::Route::station, and SBS::ToString().
Referenced by SBS::CallStation::Call().
|
private |
Definition at line 79 of file controller.cpp.
References DispatchElevator(), Elevators, SBS::SBS::GetElevator(), RemoveRoute(), Routes, SBS::ObjectBase::sbs, and SBS_PROFILE.
Referenced by Loop().
|
private |
Definition at line 918 of file controller.cpp.
References SBS::Elevator::AddRoute(), SBS::SBS::GetElevator(), SBS::SBS::GetFloor(), SBS::SBS::GetPower(), SBS::Floor::ID, Report(), SBS::ObjectBase::sbs, and SBS::ToString().
Referenced by CheckArrivals(), and ProcessRoutes().
void SBS::DispatchController::ElevatorArrived | ( | int | number, |
int | floor, | ||
bool | direction ) |
Definition at line 846 of file controller.cpp.
References Elevators, SBS::SBS::GetFloor(), SBS::SBS::GetPower(), SBS::Floor::ID, Report(), SBS::ObjectBase::sbs, SBS_PROFILE, and SBS::ToString().
Referenced by SBS::Elevator::FinishMove(), and SBS::Elevator::SameFloorArrival().
|
private |
Definition at line 1293 of file controller.cpp.
References SBS::SBS::GetElevator(), SBS::SBS::GetPower(), SBS::Elevator::InServiceMode(), SBS::Elevator::IsRunning(), SBS::Elevator::IsStopped(), Report(), SBS::ObjectBase::sbs, and SBS::ToString().
Referenced by ProcessRoutes().
|
private |
Definition at line 677 of file controller.cpp.
References AtMaxRequests(), SBS::Elevator::AvailableForCall(), Elevators, SBS::Elevator::GetCarForFloor(), SBS::SBS::GetElevator(), SBS::ElevatorCar::GetFloor(), SBS::SBS::GetPower(), IsElevatorAssignedToOther(), SBS::Elevator::IsServicedFloor(), SBS::Elevator::Number, SBS::ElevatorCar::Number, Report(), SBS::ObjectBase::sbs, SBS_PROFILE, SBS::ToString(), and SBS::SBS::Verbose.
Referenced by ProcessRoutes().
bool SBS::DispatchController::FireService | ( | int | value | ) |
Definition at line 1197 of file controller.cpp.
References Elevators, SBS::Elevator::EnableFireService1(), SBS::SBS::GetElevator(), SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
Referenced by SBS::CallStation::FireService().
int SBS::DispatchController::GetBottomFloor | ( | ) |
Definition at line 1327 of file controller.cpp.
References bottom_floor.
Referenced by SBS::CallStation::CreateCallButtons().
std::vector< CallStation * > SBS::DispatchController::GetCallStations | ( | int | floor | ) |
Definition at line 1095 of file controller.cpp.
References CallStations.
Referenced by SBS::CallStation::SetLightsGroup().
bool SBS::DispatchController::GetCallStatus | ( | int | elevator, |
int | floor, | ||
bool & | up, | ||
bool & | down ) |
Definition at line 1368 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
Referenced by SBS::Elevator::GetCallStatus().
int SBS::DispatchController::GetElevator | ( | int | index | ) |
Definition at line 1337 of file controller.cpp.
References Elevators.
int SBS::DispatchController::GetElevatorArrived | ( | int | starting_floor, |
int | destination_floor ) |
Definition at line 1111 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
Referenced by SBS::CallStation::GetElevatorArrived().
int SBS::DispatchController::GetElevatorArrivedStandard | ( | int | floor, |
bool | direction ) |
Definition at line 1131 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
Referenced by SBS::CallStation::GetElevatorArrivedStandard().
|
private |
Definition at line 1151 of file controller.cpp.
References bottom_floor, Elevators, SBS::ElevatorCar::GetBottomFloor(), SBS::Elevator::GetCar(), SBS::Elevator::GetCarCount(), SBS::SBS::GetElevator(), SBS::ElevatorCar::GetTopFloor(), SBS::ObjectBase::sbs, and top_floor.
Referenced by AddElevator(), and RemoveElevator().
int SBS::DispatchController::GetRecallFloor | ( | ) |
Definition at line 1279 of file controller.cpp.
References Elevators, SBS::SBS::GetElevator(), SBS::Elevator::GetRecallFloor(), and SBS::ObjectBase::sbs.
Referenced by SBS::CallStation::GetRecallFloor().
int SBS::DispatchController::GetTopFloor | ( | ) |
Definition at line 1332 of file controller.cpp.
References top_floor.
Referenced by SBS::CallStation::CreateCallButtons().
bool SBS::DispatchController::IsElevatorAssigned | ( | int | number, |
int | destination_floor, | ||
int | direction ) |
Definition at line 944 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
bool SBS::DispatchController::IsElevatorAssignedToOther | ( | int | number, |
int | destination_floor, | ||
int | direction ) |
Definition at line 980 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), Range, and SBS::ObjectBase::sbs.
Referenced by FindClosestElevator().
bool SBS::DispatchController::IsServicedFloor | ( | int | floor | ) |
Definition at line 1181 of file controller.cpp.
References Elevators, SBS::SBS::GetElevator(), SBS::Elevator::IsServicedFloor(), and SBS::ObjectBase::sbs.
Referenced by CallElevator(), and RequestRoute().
|
virtual |
Reimplemented from SBS::Object.
Definition at line 64 of file controller.cpp.
References CheckArrivals(), SBS::SBS::GetPower(), ProcessRoutes(), and SBS::ObjectBase::sbs.
|
private |
Definition at line 394 of file controller.cpp.
References AssignElevator(), SBS::Elevator::CancelHallCall(), SBS::DispatchController::Call::direction, DispatchElevator(), Elevators, ElevatorUnavailable(), FindClosestElevator(), SBS::DispatchController::Call::floor, SBS::Elevator::GetCarForFloor(), SBS::SBS::GetElevator(), SBS::Elevator::IsIdle(), SBS::Elevator::Number, recheck, Report(), Reprocess, Routes, SBS::ObjectBase::sbs, SBS_PROFILE, and SBS::ToString().
Referenced by Loop().
void SBS::DispatchController::RegisterCallStation | ( | CallStation * | station | ) |
Definition at line 1059 of file controller.cpp.
References CallStations, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
Referenced by SBS::CallStation::SetController().
bool SBS::DispatchController::RemoveElevator | ( | int | elevator | ) |
Definition at line 629 of file controller.cpp.
References Elevators, SBS::SBS::GetElevator(), GetFloorRange(), SBS::SBS::GetPower(), Number, SBS::Elevator::RemoveController(), Report(), SBS::ObjectBase::sbs, and SBS::ToString().
|
private |
Definition at line 176 of file controller.cpp.
References SBS::DispatchController::Route::destination_floor, SBS::SBS::GetPower(), Report(), Routes, SBS::ObjectBase::sbs, SBS::DispatchController::Route::starting_floor, and SBS::ToString().
Referenced by CheckArrivals().
|
virtual |
Reimplemented from SBS::ObjectBase.
Definition at line 832 of file controller.cpp.
References Number, SBS::ObjectBase::Report(), and SBS::ToString().
Referenced by AddElevator(), AssignElevator(), CallElevator(), DispatchController(), DispatchElevator(), ElevatorArrived(), ElevatorUnavailable(), FindClosestElevator(), ProcessRoutes(), RemoveElevator(), RemoveRoute(), RequestRoute(), and ServicesElevator().
|
virtual |
Reimplemented from SBS::ObjectBase.
Definition at line 839 of file controller.cpp.
References Number, SBS::ObjectBase::ReportError(), and SBS::ToString().
Referenced by CallElevator(), and RequestRoute().
bool SBS::DispatchController::RequestRoute | ( | CallStation * | station, |
int | starting_floor, | ||
int | destination_floor ) |
Definition at line 195 of file controller.cpp.
References SBS::DispatchController::Route::assigned_elevator, SBS::DispatchController::Route::destination, SBS::DispatchController::Route::destination_floor, DestinationDispatch, SBS::DispatchController::Route::direction, Elevators, SBS::CallStation::Error(), SBS::SBS::GetElevator(), SBS::SBS::GetFloor(), SBS::SBS::GetPower(), IsServicedFloor(), MaxPassengers, SBS::DispatchController::Route::processed, Report(), ReportError(), SBS::DispatchController::Route::requests, Routes, SBS::ObjectBase::sbs, SBS_PROFILE, SBS::DispatchController::Route::starting_floor, SBS::DispatchController::Route::station, and SBS::ToString().
Referenced by SBS::CallStation::SelectFloor().
void SBS::DispatchController::ResetArrival | ( | int | number | ) |
Definition at line 1259 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
Referenced by SBS::Elevator::MoveElevatorToFloor(), and SBS::Elevator::SameFloorArrival().
bool SBS::DispatchController::SameElevators | ( | const std::vector< int > & | elevators | ) |
Definition at line 1349 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
Referenced by Skyscraper::ScriptProcessor::FloorSection::Run().
bool SBS::DispatchController::ServesFloor | ( | int | floor | ) |
Definition at line 1404 of file controller.cpp.
References Elevators, SBS::SBS::GetElevator(), SBS::SBS::GetPower(), SBS::Elevator::IsServicedFloor(), and SBS::ObjectBase::sbs.
Referenced by SBS::Floor::AddCallButtons().
bool SBS::DispatchController::ServicesElevator | ( | int | elevator | ) |
Definition at line 657 of file controller.cpp.
References Elevators, SBS::SBS::GetPower(), Report(), SBS::ObjectBase::sbs, SBS::ToString(), and SBS::SBS::Verbose.
Referenced by SBS::CallStation::ServicesElevator().
void SBS::DispatchController::UnregisterCallStation | ( | CallStation * | station | ) |
Definition at line 1077 of file controller.cpp.
References CallStations, SBS::SBS::GetPower(), and SBS::ObjectBase::sbs.
Referenced by SBS::CallStation::~CallStation().
|
private |
Definition at line 85 of file controller.h.
Referenced by DispatchController(), GetBottomFloor(), and GetFloorRange().
|
private |
Definition at line 123 of file controller.h.
Referenced by GetCallStations(), RegisterCallStation(), and UnregisterCallStation().
bool SBS::DispatchController::DestinationDispatch |
Definition at line 35 of file controller.h.
Referenced by AtMaxRequests(), CallElevator(), DispatchController(), SBS::Elevator::GetDestinationDispatch(), RequestRoute(), Skyscraper::ScriptProcessor::ControllerSection::Run(), Skyscraper::ScriptProcessor::FloorSection::Run(), and SBS::Elevator::SelectFloor().
|
private |
Definition at line 107 of file controller.h.
Referenced by AddElevator(), AssignElevator(), AtMaxRequests(), CallElevator(), CheckArrivals(), ElevatorArrived(), FindClosestElevator(), FireService(), GetCallStatus(), GetElevator(), GetElevatorArrived(), GetElevatorArrivedStandard(), GetFloorRange(), GetRecallFloor(), IsElevatorAssigned(), IsElevatorAssignedToOther(), IsServicedFloor(), ProcessRoutes(), RemoveElevator(), RequestRoute(), ResetArrival(), SameElevators(), ServesFloor(), and ServicesElevator().
bool SBS::DispatchController::Hybrid |
Definition at line 36 of file controller.h.
Referenced by CallElevator(), DispatchController(), Skyscraper::ScriptProcessor::ControllerSection::Run(), and SBS::Elevator::SelectFloor().
int SBS::DispatchController::MaxPassengers |
Definition at line 38 of file controller.h.
Referenced by AtMaxRequests(), DispatchController(), RequestRoute(), and Skyscraper::ScriptProcessor::ControllerSection::Run().
std::string SBS::DispatchController::Name |
Definition at line 34 of file controller.h.
Referenced by Skyscraper::ScriptProcessor::ControllerSection::Run(), and Skyscraper::ScriptProcessor::FloorSection::Run().
int SBS::DispatchController::Number |
Definition at line 33 of file controller.h.
Referenced by AddElevator(), DispatchController(), RemoveElevator(), Report(), ReportError(), and Skyscraper::ScriptProcessor::FloorSection::Run().
int SBS::DispatchController::Range |
Definition at line 37 of file controller.h.
Referenced by DispatchController(), IsElevatorAssignedToOther(), and Skyscraper::ScriptProcessor::ControllerSection::Run().
|
private |
Definition at line 125 of file controller.h.
Referenced by DispatchController(), and ProcessRoutes().
bool SBS::DispatchController::Reprocess |
Definition at line 39 of file controller.h.
Referenced by DispatchController(), ProcessRoutes(), and Skyscraper::ScriptProcessor::ControllerSection::Run().
|
private |
Definition at line 121 of file controller.h.
Referenced by AtMaxRequests(), CallElevator(), CheckArrivals(), ProcessRoutes(), RemoveRoute(), and RequestRoute().
|
private |
Definition at line 86 of file controller.h.
Referenced by DispatchController(), GetFloorRange(), and GetTopFloor().