-
Notifications
You must be signed in to change notification settings - Fork 0
/
StudentWorld.h
106 lines (67 loc) · 1.82 KB
/
StudentWorld.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef STUDENTWORLD_H_
#define STUDENTWORLD_H_
#include "GameWorld.h"
#include "GameConstants.h"
#include <string>
#include <vector>
class Actor;
class FrackMan;
class Dirt;
class Boulder;
class Protester;
class GraphObject;
// Students: Add code to this file, StudentWorld.cpp, Actor.h, and Actor.cpp
class Coord
{
public:
Coord(int x, int y) : m_x(x), m_y(y) {}
int x() const { return m_x; }
int y() const { return m_y; }
private:
int m_x;
int m_y;
};
class StudentWorld : public GameWorld
{
public:
StudentWorld(std::string assetDir);
virtual ~StudentWorld();
virtual int init();
virtual int move();
virtual void cleanUp();
bool removeDirt(int x, int y);
bool isThereObstacle(int x, int y, Actor *a = nullptr);
void pathToNext(bool radar = false, int x = 60, int y = 60, int maxStep = 0);
bool causeAnnoyance(int ID, int HP = 2, int x = -1, int y = -1);
bool isInDirectLine(Actor *origin, char &dir);
int randInt(int min, int max);
bool dirtUnderneath(Actor *a);
void annoySurroundings(Actor *a, int HP);
void storeNewActor(Actor *a);
bool isThereHuman(Actor *a, bool lookForFrackMan, int range);
int sumOfSquares(int dx, int dy);
int square(int n);
int max(int n1, int n2);
void addToInventory(int ID);
void sonarHidden(Actor *a);
int min(int n1, int n2);
bool overlap(int x, int y, int range = 6);
bool isOnMineshaft(int x);
void setDisplayText();
void barrelFound();
void adjustText(std::string &str, int length, std::string attach);
std::string numToStr(int num);
bool successOrFail(int probability);
void addPool();
void whereIsFrackMan(int &x, int &y);
private:
FrackMan *p_FrackMan;
Dirt *p_Dirt[64][64];
std::vector<Actor*> p_Actor;
int m_nTotalBarrels;
int m_nBarrels;
int m_timeSinceLastProtester;
int m_nMaxProtester;
int m_nProtesters;
};
#endif // STUDENTWORLD_H_