]> git.localhorst.tv Git - l2e.git/blob - src/common/Script.cpp
relocate scripts
[l2e.git] / src / common / Script.cpp
1 #include "Script.h"
2
3 #include "../math/Vector.h"
4
5 namespace common {
6
7 Script::Script()
8 : text(0)
9 , textlen(0) {
10
11 }
12
13 Script::~Script() {
14
15 }
16
17
18 unsigned int Script::Code::Size() const {
19         unsigned int size = sizeof(Code);
20         if (numParams == 0) {
21                 return size;
22         }
23         unsigned int argSize = 0;
24         switch (type) {
25                 default:
26                         argSize = 0;
27                         break;
28                 case TYPE_ADDRESS:
29                         argSize = sizeof(void *);
30                         break;
31                 case TYPE_INTEGER:
32                         argSize = sizeof(int);
33                         break;
34                 case TYPE_VECTOR:
35                         argSize = sizeof(math::Vector<int>);
36                         break;
37         }
38         switch (numParams) {
39                 case 3:
40                 case 2:
41                         if (reg2 == 7) {
42                                 size += argSize;
43                         }
44                 case 1:
45                         if (reg1 == 7) {
46                                 size += argSize;
47                         }
48                 default:
49                         break;
50         }
51         return size;
52 }
53
54 }