-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpaceTreeAgent.cpp
More file actions
46 lines (38 loc) · 973 Bytes
/
SpaceTreeAgent.cpp
File metadata and controls
46 lines (38 loc) · 973 Bytes
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
#include "SpaceTreeAgent.h"
SpaceTreeAgent::SpaceTreeAgent(ColliderShape *arg_obj, int id)
: next(nullptr)
, prev(nullptr)
, cell(nullptr)
, _shape(arg_obj)
{
index = id;
}
SpaceTreeAgent::~SpaceTreeAgent()
{
prev = nullptr;
next = nullptr;
cell = nullptr;
_shape = nullptr;
}
bool SpaceTreeAgent::RemoveFromLink()
{
//リンクを管理する空間から外れてたら終了
if (cell == nullptr)
return false;
//自分の所属するリンクを管理する空間にリンクから外れると通知
cell->Pop(this);
//外したあとリンクを結びつける
if (prev != nullptr)
prev->next = next;
if (next != nullptr)
next->prev = prev;
//最後に初期化
prev = nullptr;
next = nullptr;
cell = nullptr;
return true;
}
void SpaceTreeAgent::Debug()
{
//DrawFormatString(0, 120 + index * 32, GetColor(0xff, 0x00, 0x00), "cell: %d", cell->mKey);
}