-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAirport.h
84 lines (62 loc) · 2.06 KB
/
Airport.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* John Sadiq
* CS 281 Fall 2019
* Airport Project
*
* Plane.h
*
*
*
*/
#include "Plane.h"
#pragma once
class Airport {
private:
//que for planes in sky.
struct queItem {
Plane plane;
queItem* nxtqueItem;
queItem* prvqueItem;
};
// stack for show landed.
struct plate {
Plane plane;
plate* nxtPlate;
};
//current landed plane in stack
plate* currentPlate;
//current crashed plane in stack
plate* currentCrash;
//traversal que node
queItem* currentqueItem;
//front of que
queItem* headqueItem;
//Set Bool, so that there can only be one Air Force plane flying
bool hasAirForce1;
public:
// Contructor
Airport();
//Destructor
~Airport();
//Pusher
void stackPush(Plane airplane);
//Pusher for crashed planes
void stackedPushCrashed(Plane airplane);
//Creates the plane as by its status then fills in the rest such as name and fuel, pre adding to the que
void CreatePlane(std::string pname, int pfuel, int ptype);
//adding airplane to a vector, within the vector fuction values with sort in numeral order
//aswell as code using a for loop so once value gets to the front of the vector to insert and push the list over that its not operating with a null pointer by mistake
void addAirplane(Plane newPlane);
//show status, clasifies plane by its class; QUEUED, CIRCLING, LANDING_NEXT, LANDED, and CRASHED. via Couting vector
void showStatus();
//standard stack operations.
void landedstackShow();
void crashedstackShow();
//simulation loop, each time space button is hit, an interation goes through and subtract 5% from all flying planes, and has high priority plane land
//aswell as reorganizing priority, if plane goes in to emergency state then we remove it from the vector and insert it to the front giving it a higher priority.
void simLoop();
//functions the same as simLoop, except goes through the list untill all planes are either crashed or landed
void fullsimLoop();
//remove head node.
Plane dequeAirplane(struct queItem* currentqueItem);
};