Skyscraper
2.0
src
sbs
person.h
Go to the documentation of this file.
1
/*
2
Scalable Building Simulator - Person Object
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_PERSON_H
25
#define _SBS_PERSON_H
26
27
namespace
SBS
{
28
29
class
SBSIMPEXP
Person
:
public
Object
30
{
31
public
:
32
33
RandomGen
*rnd_time, *
rnd_dest
;
34
35
//functions
36
Person
(
Object
*parent,
const
std::string &name,
int
floor,
bool
service_access =
false
);
37
~Person
();
38
void
GotoFloor(
int
floor);
39
void
Loop();
40
void
ProcessRoute();
41
void
Report(
const
std::string &message);
42
bool
ReportError(
const
std::string &message);
43
int
GetRandomFloor();
44
bool
IsRouteActive
() {
return
!route.empty(); }
45
bool
IsRandomActivityEnabled();
46
void
EnableRandomActivity(
bool
value);
47
void
SetFloor(
int
value);
48
int
GetFloor
() {
return
current_floor; }
49
int
GetDestinationFloor
() {
return
dest_floor; }
50
void
SetServiceAccess
(
bool
value) { service_access = value; }
51
bool
GetServiceAccess
() {
return
service_access; }
52
void
Stop();
53
std::string GetStatus();
54
55
private
:
56
57
struct
RouteEntry
58
{
59
ElevatorRoute
*
elevator_route
;
60
CallStation
*
callstation
;
61
int
call_made
;
62
bool
floor_selected
;
63
bool
destination
;
64
bool
in_elevator
;
65
};
66
67
int
current_floor
;
68
int
dest_floor
;
69
bool
service_access
;
70
std::vector<RouteEntry>
route
;
71
72
class
Timer
;
//internal timer class
73
74
//random call timer object
75
Timer
*
random_timer
;
76
77
int
RandomProbability
;
//probability ratio of random activity, starting with 1 - higher is less frequent
78
Real
RandomFrequency
;
//speed in seconds to make each random action
79
};
80
81
}
82
83
#endif
SBS::CallStation
Definition
callstation.h:32
SBS::Object
Definition
object.h:56
SBS::Person::Timer
Definition
person.cpp:41
SBS::Person
Definition
person.h:30
SBS::Person::RandomFrequency
Real RandomFrequency
Definition
person.h:78
SBS::Person::GetFloor
int GetFloor()
Definition
person.h:48
SBS::Person::current_floor
int current_floor
Definition
person.h:67
SBS::Person::random_timer
Timer * random_timer
Definition
person.h:75
SBS::Person::IsRouteActive
bool IsRouteActive()
Definition
person.h:44
SBS::Person::RandomProbability
int RandomProbability
Definition
person.h:77
SBS::Person::dest_floor
int dest_floor
Definition
person.h:68
SBS::Person::GetDestinationFloor
int GetDestinationFloor()
Definition
person.h:49
SBS::Person::rnd_dest
RandomGen * rnd_dest
Definition
person.h:33
SBS::Person::service_access
bool service_access
Definition
person.h:69
SBS::Person::route
std::vector< RouteEntry > route
Definition
person.h:70
SBS::Person::SetServiceAccess
void SetServiceAccess(bool value)
Definition
person.h:50
SBS::Person::GetServiceAccess
bool GetServiceAccess()
Definition
person.h:51
SBS::RandomGen
Definition
random.h:7
Real
Ogre::Real Real
Definition
globals.h:57
SBSIMPEXP
#define SBSIMPEXP
Definition
globals.h:53
SBS
Definition
skyscraper.h:45
SBS::ElevatorRoute
Definition
route.h:30
SBS::Person::RouteEntry
Definition
person.h:58
SBS::Person::RouteEntry::elevator_route
ElevatorRoute * elevator_route
Definition
person.h:59
SBS::Person::RouteEntry::destination
bool destination
Definition
person.h:63
SBS::Person::RouteEntry::call_made
int call_made
Definition
person.h:61
SBS::Person::RouteEntry::in_elevator
bool in_elevator
Definition
person.h:64
SBS::Person::RouteEntry::callstation
CallStation * callstation
Definition
person.h:60
SBS::Person::RouteEntry::floor_selected
bool floor_selected
Definition
person.h:62
Generated by
1.11.0