-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathUnit.cpp
More file actions
79 lines (63 loc) · 1.94 KB
/
Copy pathUnit.cpp
File metadata and controls
79 lines (63 loc) · 1.94 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
// Copyright 2008-2018 Yolo Technologies, Inc. All Rights Reserved. https://www.comblockengine.com
#include "pyscript/py_gc.h"
#include "Unit.h"
//#include "helper/eventhistory_stats.h"
//#include "math/math.h"
namespace KBEngine{
//-------------------------------------------------------------------------------------
SCRIPT_METHOD_DECLARE_BEGIN(Unit)
SCRIPT_METHOD_DECLARE("setViewRadius", pySetViewRadius, METH_VARARGS, 0)
SCRIPT_METHOD_DECLARE("printRefCnt", pyprintRefCnt, METH_VARARGS, 0)
SCRIPT_METHOD_DECLARE_END()
SCRIPT_MEMBER_DECLARE_BEGIN(Unit)
SCRIPT_MEMBER_DECLARE_END()
SCRIPT_GETSET_DECLARE_BEGIN(Unit)
SCRIPT_GET_DECLARE("id", pyGetID, 0, 0)
SCRIPT_GETSET_DECLARE_END()
BASE_SCRIPT_INIT(Unit, 0, 0, 0, 0, 0)
//-------------------------------------------------------------------------------------
int32 Unit::setViewRadius(int type)
{
if (type >5)
{
return 600;
}
else
{
return 1;
}
}
//-------------------------------------------------------------------------------------
PyObject* Unit::pySetViewRadius(int type)
{
return PyLong_FromLong(setViewRadius(type));
}
//-------------------------------------------------------------------------------------
PyObject* Unit::pyprintRefCnt()
{
S_Return;
}
//-------------------------------------------------------------------------------------
Unit::Unit(ENTITY_ID id,
PyTypeObject* pyType, bool isInitialised) :
ScriptObject(pyType, isInitialised),
id_(id)
{
script::PyGC::incTracing("Unit");
}
//-------------------------------------------------------------------------------------
Unit::~Unit()
{
script::PyGC::decTracing("Unit");
}
////-------------------------------------------------------------------------------------
//void Unit::onInitializeScript()
//{
//
//}
//-------------------------------------------------------------------------------------
void Unit::onDestroy(bool callScript)
{
}
//-------------------------------------------------------------------------------------
}