Skyscraper 2.0
doorsystem.h
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Door System
3 The Skyscraper Project - Version 2.0
4 Copyright (C)2004-2024 Ryan Thoryk
5 https://www.skyscrapersim.net
6 https://sourceforge.net/projects/skyscraper/
7 Contact - ryan@skyscrapersim.net
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#ifndef _SBS_DOORSYSTEM_H
25#define _SBS_DOORSYSTEM_H
26
27namespace SBS {
28
29struct DoorWrapper;
30
31//door component object
33{
34 DoorComponent(const std::string &doorname, DoorWrapper *Wrapper, const std::string &direction, bool OpenClockwise, Real OpenSpeed, Real CloseSpeed, DynamicMesh *dynmesh);
36 void MoveDoors(bool open, bool manual);
37 void RotateDoors(bool open);
38 void Move();
39 void Reset(bool open);
40
42 int direction; //direction is either 0 for up, 1 for down, 2 for left/forward and 3 for right/backward
47 std::string name;
48 DoorWrapper *wrapper; //associated wrapper
51 int door_section; //door movement section; used for both reversal tracking and debugging
55 bool is_open;
65 bool Clockwise; //if door should rotate clockwise
66};
67
68//wrapper that represents the entire set of doors
69struct DoorWrapper : public Object
70{
71 DoorWrapper(Object *parent_obj, ElevatorDoor *door_object, bool shaftdoor, int shaftdoor_floor = 0);
72 DoorWrapper(Door *parent, bool rotate);
74
75 DoorComponent* CreateDoor(const std::string &doorname, const std::string &Direction, bool OpenClockwise, Real OpenSpeed, Real CloseSpeed, DynamicMesh *dynmesh);
76 void Enabled(bool value);
77 bool CheckDoorsOpen();
78 bool IsFinished();
79 void ResetFinished();
80 void MoveDoors(bool open, bool manual = false);
81 void StopDoors();
82 void ResetState();
83 void OnClick(Vector3 &position, bool shift, bool ctrl, bool alt, bool right);
84 void OnHit();
85
86 std::vector<DoorComponent*> doors;
87 std::string name;
88 bool Open;
98 int floor;
99 bool rotate;
100};
101
102}
103
104#endif
105
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
void RotateDoors(bool open)
DoorWrapper * wrapper
Definition doorsystem.h:48
void Reset(bool open)
void MoveDoors(bool open, bool manual)
std::string name
Definition doorsystem.h:47
MeshObject * mesh
Definition doorsystem.h:41
DoorComponent(const std::string &doorname, DoorWrapper *Wrapper, const std::string &direction, bool OpenClockwise, Real OpenSpeed, Real CloseSpeed, DynamicMesh *dynmesh)
ElevatorDoor * parent_elevdoor
Definition doorsystem.h:93
std::string name
Definition doorsystem.h:87
void MoveDoors(bool open, bool manual=false)
void Enabled(bool value)
DoorWrapper(Object *parent_obj, ElevatorDoor *door_object, bool shaftdoor, int shaftdoor_floor=0)
std::vector< DoorComponent * > doors
Definition doorsystem.h:86
DoorComponent * CreateDoor(const std::string &doorname, const std::string &Direction, bool OpenClockwise, Real OpenSpeed, Real CloseSpeed, DynamicMesh *dynmesh)
void OnClick(Vector3 &position, bool shift, bool ctrl, bool alt, bool right)