-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplace.cpp
More file actions
116 lines (91 loc) · 1.8 KB
/
place.cpp
File metadata and controls
116 lines (91 loc) · 1.8 KB
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
107
108
109
110
111
112
113
114
115
116
#include "place.h"
#include <QDebug>
Place::Place(int a, double x, double y)//1表示近战路径,2表示远程路径,3表示障碍,4表示我方基地
{
px = x;
py = y;
is_melle = false, is_remote = false, is_planthome = false, is_zombiehome = false, is_obstacle = false;
plantHere = nullptr;
switch (a) {
case 1:
name = "melle";
is_melle = true;
break;
case 2:
name = "remote";
is_remote = true;
break;
case 3:
name = "obstacle";
is_obstacle = true;
break;
case 4:
name = "planthome";
is_planthome = true;
break;
case 5:
name = "zombiehome";
is_zombiehome = true;
break;
default:
qDebug() << "Create Wrong Place!" << endl;
throw 0;
break;
}
}
void Place::add_creature(Creature* crt)
{
crt->setCx(px);
crt->setCy(py);
crt->setWay(pway);
if (crt->getIs_plant()) {
plantHere = crt;
}
}
bool Place::getIs_remote() const
{
return is_remote;
}
bool Place::getIs_planthome() const
{
return is_planthome;
}
Creature *Place::getPlantHere() const
{
return plantHere;
}
QString Place::getPway() const
{
return pway;
}
void Place::setPway(const QString &value)
{
pway = value;
}
double Place::getPx() const
{
return px;
}
void Place::setPx(double value)
{
px = value;
}
double Place::getPy() const
{
return py;
}
void Place::setPy(double value)
{
py = value;
}
bool Place::getIs_melle() const
{
return is_melle;
}
void Place::setPlantHere(Creature *value)
{
plantHere = value;
}
bool Place::haveplant() {
return plantHere != nullptr;
}