-
Notifications
You must be signed in to change notification settings - Fork 0
/
station.cpp
62 lines (53 loc) · 2.22 KB
/
station.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "station.h"
#include "public_train.h"
#include "cargo_train_generator.h"
#include "debug.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
CStation::CStation(const std::string& title)
: m_Title(title)
{}
////////////////////////////////////////////////////////////////////////////////////////////////////
CStation::~CStation()
{}
////////////////////////////////////////////////////////////////////////////////////////////////////
const std::string& CStation::GetTitle() const
{
return m_Title;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
CPublicTrainGenerator& CStation::AddPublicTrain(const std::string& trainTitle,
unsigned time,
CStation& targetStation,
CPublicTrainGenerator::Frequency frequency,
unsigned targetStationArrival,
unsigned averageDelay,
bool bStopsInMainStation,
unsigned mainStationArrival,
unsigned mainStationDeparture)
{
CPublicTrainGenerator* pTrainGenerator = new CPublicTrainGenerator(trainTitle, *this, targetStation,
frequency, time, targetStationArrival, averageDelay, bStopsInMainStation,
mainStationArrival, mainStationDeparture);
//DBG_LOG("New train generator: " + pTrainGenerator->GetTrainTitle());
// decrease the time by the boarding time
pTrainGenerator->Activate(time - CPublicTrain::GetBoardingTime());
return *pTrainGenerator;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
CTrainGenerator& CStation::AddCargoTrain(const std::string& trainTitle,
unsigned time,
CStation& targetStation,
CPublicTrainGenerator::Frequency frequency,
unsigned targetStationArrival,
unsigned averageDelay,
bool bStopsInMainStation,
unsigned mainStationArrival,
unsigned mainStationDeparture)
{
CTrainGenerator* pTrainGenerator = new CCargoTrainGenerator(trainTitle, *this, targetStation,
frequency, time, targetStationArrival, averageDelay, bStopsInMainStation,
mainStationArrival, mainStationDeparture);
//DBG_LOG("New train generator: " + pTrainGenerator->GetTrainTitle());
pTrainGenerator->Activate(time);
return *pTrainGenerator;
}