39Control::Control(
Object *parent,
const std::string &name,
bool permanent,
const std::string &sound_file,
const std::vector<std::string> &action_names,
const std::vector<Action*> &actions, std::vector<std::string> &textures,
const std::string &direction,
Real width,
Real height,
bool center,
int selection_position) :
Object(parent),
Lock(this)
48 std::string name2 = name;
49 if (name.find(
"Control", 0) == std::string::npos)
50 name2 =
"Control " + name;
70 std::string texture =
GetTexture(selection_position);
76 Real x = 0, y = width;
84 sbs->
AddWallMain(wall, name, texture, 0, x, 0, y, 0, height, height, 0, 0, 1, 1,
false);
88 Real x = 0, y = -width;
96 sbs->
AddWallMain(wall, name, texture, 0, x, 0, y, 0, height, height, 0, 0, 1, 1,
false);
100 Real x = 0, y = -width;
106 sbs->
DrawWalls(
true,
false,
false,
false,
false,
false);
108 sbs->
AddWallMain(wall, name, texture, 0, 0, x, 0, y, height, height, 0, 0, 1, 1,
false);
112 Real x = 0, y = width;
118 sbs->
DrawWalls(
false,
true,
false,
false,
false,
false);
120 sbs->
AddWallMain(wall, name, texture, 0, 0, x, 0, y, height, height, 0, 0, 1, 1,
false);
126 if (sound_file !=
"")
163 if (type ==
"ButtonPanel")
165 else if (type ==
"ElevatorCar")
167 else if (type ==
"Floor")
169 else if (type ==
"Shaft Level")
171 else if (type ==
"Stairwell Level")
173 else if (type ==
"SBS")
218 if (check_state ==
false)
240 if (check_state ==
false)
277 std::vector<Action*> actionlist;
281 else if (
Actions.empty() ==
false)
282 actionlist.emplace_back(
Actions[position - 1]);
287 if (actionlist.empty() ==
false)
290 return actionlist[0]->GetCommandName();
363 std::vector<Action*> actionlist;
367 else if (
Actions.empty() ==
false)
373 for (
size_t i = 0; i < actionlist.size(); i++)
375 bool result2 =
false;
378 result2 = actionlist[i]->DoAction(
this,
action_hold);
397 if (reverse ==
false)
407 if (reverse ==
false)
423 if (reverse ==
false)
439 std::string floornum =
ToString(floor);
442 if (index > 0 && index2 > 0)
462 if (index > 0 && index2 > 0)
474 for (
size_t i = 0; i <
Actions.size(); i++)
487 if (ctrl ==
true && shift ==
true)
void Report(const std::string &message)
bool ReportError(const std::string &message)
Control(Object *parent, const std::string &name, bool permanent, const std::string &sound, const std::vector< std::string > &action_names, const std::vector< Action * > &actions, std::vector< std::string > &textures, const std::string &direction, Real width, Real height, bool center, int selection_position)
void ChangeLight(bool value)
std::string GetTexture(int position)
int GetPreviousSelectPosition()
int FindActionPosition(const std::string &name)
std::string GetPositionAction(int position)
std::string GetSelectPositionAction()
std::vector< std::string > ActionNames
bool ChangeSelectPosition(int position)
std::vector< std::string > TextureArray
void ChangeFloorLight(int floor, bool value)
int GetNextSelectPosition()
bool Press(bool reverse=false)
std::vector< Action * > Actions
void OnUnclick(bool right)
void OnClick(Vector3 &position, bool shift, bool ctrl, bool alt, bool right)
bool SetSelectPosition(int position)
int FindNumericActionPosition()
void SetTexture(int position, const std::string &texture)
void RemoveAction(Action *action)
bool PreviousSelectPosition(bool check_state=true)
bool NextSelectPosition(bool check_state=true)
bool ToggleLock(bool force=false)
bool ChangeTexture(const std::string &texture, bool matcheck=true)
Wall * CreateWallObject(const std::string &name)
const std::string & GetName()
virtual bool ReportError(const std::string &message)
virtual void Report(const std::string &message)
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
const std::string & GetType()
void RemoveControl(Control *control)
Real GetConfigFloat(const std::string &key, Real default_value)
bool AddWallMain(Wall *wallobject, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height_in1, Real height_in2, Real altitude1, Real altitude2, Real tw, Real th, bool autosize)
void ResetWalls(bool ToDefaults=false)
void RegisterControl(Control *control)
std::vector< Action * > GetAction(std::string name)
void UnregisterControl(Control *control)
void DrawWalls(bool MainN, bool MainP, bool SideN, bool SideP, bool Top, bool Bottom)
bool Load(const std::string &filename, bool force=false)
bool Play(bool reset=true)
void SetLoopState(bool value)
void SetCase(std::string &string, bool uppercase)
std::string ToString(int number)
bool IsNumeric(char character)
void TrimString(std::string &string)