-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject.cpp
More file actions
122 lines (93 loc) · 2.32 KB
/
Copy pathobject.cpp
File metadata and controls
122 lines (93 loc) · 2.32 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
117
118
119
120
121
#include "object.h"
namespace SSJServer {
Object::Object(float x, float y){
this->mapPosition.x = x;
this->mapPosition.y = y;
this->setDefaultVar();
}
Object::Object(Point position){
this->mapPosition = position;
this->setDefaultVar();
}
bool Object::isSyncNow() const
{
return syncNow;
}
void Object::setSyncNow(bool value)
{
syncNow = value;
}
bool Object::isSyncEventActive() const
{
return syncEventActive;
}
void Object::setSyncEventActive(bool value)
{
syncEventActive = value;
}
void Object::appendBlockSyncTime(sf::Time delta)
{
this->blockSyncTime += delta;
}
sf::Time Object::getBlockSyncTime() const
{
return blockSyncTime;
}
sf::Time Object::getSyncPeriod() const
{
return this->syncPeriod;
}
void Object::setBlockSyncTime(const sf::Time &value)
{
blockSyncTime = value;
}
void Object::setSyncNow()
{
this->syncNow = true;
}
void Object::setDefaultVar()
{
this->syncPeriod = sf::milliseconds(15);
this->syncEventActive = false;
this->syncNow = false;
this->blockSyncTime = sf::milliseconds(0);
}
Object::Object(){
this->mapPosition.x = 0;
this->mapPosition.y = 0;
this->setDefaultVar();
}
Point Object::getMapPosition(){
return mapPosition;
}
void Object::setMapPosition(float x, float y){
this->mapPosition.x = x;
this->mapPosition.y = y;
}
void Object::setMapPosition(Point position){
this->mapPosition = position;
}
Json::Value Object::serialize()
{
return Json::nullValue;
}
void DataContainer::GarbageCollect()
{
for(int i = 0 ; i < DataContainer::ObjectLists.size() ; ++i)
{
if(DataContainer::ObjectLists.at(i) != NULL){
if (!DataContainer::ObjectLists.at(i)->isActive() )
{
delete DataContainer::ObjectLists.at(i);
DataContainer::ObjectLists.at(i) = NULL;
}
}
}
}
void Object::setActivity(bool activity){
this->activity = activity;
}
bool Object::isActive(){
return activity;
}
}