author | truelight |
Sun, 25 Mar 2007 13:55:31 +0000 | |
branch | noai |
changeset 9525 | 1d6c509b56ee |
parent 9435 | 9dad22394553 |
child 9539 | 7416d0694d3a |
permissions | -rw-r--r-- |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
2 |
|
9422
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9404
diff
changeset
|
3 |
/** @file squirrel.hpp defines the Squirrel class */ |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
4 |
|
9422
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9404
diff
changeset
|
5 |
#ifndef SQUIRREL_HPP |
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9404
diff
changeset
|
6 |
#define SQUIRREL_HPP |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
7 |
|
9422
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9404
diff
changeset
|
8 |
class Squirrel { |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
9 |
private: |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
10 |
HSQUIRRELVM vm; ///< The VirtualMachine instnace for squirrel |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
11 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
12 |
/** |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
13 |
* The internal RunError handler. It looks up the real error and calls RunError with it. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
14 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
15 |
static SQInteger _RunError(HSQUIRRELVM vm); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
16 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
17 |
protected: |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
18 |
/** |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
19 |
* The CompileError handler. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
20 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
21 |
static void CompileError(HSQUIRRELVM vm, const SQChar *desc, const SQChar *source, SQInteger line, SQInteger column); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
22 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
23 |
/** |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
24 |
* The RunError handler. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
25 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
26 |
static void RunError(HSQUIRRELVM vm, const char *error); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
27 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
28 |
/** |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
29 |
* If a user runs 'print' inside a script, this function gets the params. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
30 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
31 |
static void PrintFunc(HSQUIRRELVM vm, const SQChar *s, ...); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
32 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
33 |
public: |
9422
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9404
diff
changeset
|
34 |
Squirrel(); |
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9404
diff
changeset
|
35 |
~Squirrel(); |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
36 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
37 |
/** |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
38 |
* Load a script. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
39 |
* @param script The full script-name to load. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
40 |
* @return False if loading failed. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
41 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
42 |
bool LoadScript(const char *script); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
43 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
44 |
/** |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
45 |
* Adds a function to the stack. Depending on the current state this means |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
46 |
* either a method or a global function. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
47 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
48 |
void AddMethod(const char *method_name, SQFUNCTION proc, uint nparam, const char *params); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
49 |
void AddMethod(const char *method_name, SQFUNCTION proc); |
9396
a05857491d2d
(svn r9188) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents:
9395
diff
changeset
|
50 |
void AddMethod(const char *method_name, SQFUNCTION proc, void *userdata, int size); |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
51 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
52 |
/** |
9525
1d6c509b56ee
(svn r9445) [NoAI] -Change: changed from sq_createslot to sq_newslot (first is deprecated)
truelight
parents:
9435
diff
changeset
|
53 |
* Adds a const to the stack. Depending on the current state this means |
1d6c509b56ee
(svn r9445) [NoAI] -Change: changed from sq_createslot to sq_newslot (first is deprecated)
truelight
parents:
9435
diff
changeset
|
54 |
* either a const to a class or to the global space. |
1d6c509b56ee
(svn r9445) [NoAI] -Change: changed from sq_createslot to sq_newslot (first is deprecated)
truelight
parents:
9435
diff
changeset
|
55 |
*/ |
1d6c509b56ee
(svn r9445) [NoAI] -Change: changed from sq_createslot to sq_newslot (first is deprecated)
truelight
parents:
9435
diff
changeset
|
56 |
void AddConst(const char *var_name, int value); |
1d6c509b56ee
(svn r9445) [NoAI] -Change: changed from sq_createslot to sq_newslot (first is deprecated)
truelight
parents:
9435
diff
changeset
|
57 |
|
1d6c509b56ee
(svn r9445) [NoAI] -Change: changed from sq_createslot to sq_newslot (first is deprecated)
truelight
parents:
9435
diff
changeset
|
58 |
/** |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
59 |
* Adds a class to the global scope. Make sure to call AddClassEnd when you |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
60 |
* are done adding methods. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
61 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
62 |
void AddClassBegin(const char *class_name); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
63 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
64 |
/** |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
65 |
* Finishes adding a class to the global scope. If this isn't called, no |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
66 |
* class is really created. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
67 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
68 |
void AddClassEnd(); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
69 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
70 |
/** |
9404
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
71 |
* Call a method of an instance, in various flavors. |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
72 |
*/ |
9404
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
73 |
void CallMethod(HSQOBJECT instance, const char *method_name, HSQOBJECT *ret); |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
74 |
void CallMethod(HSQOBJECT instance, const char *method_name) { this->CallMethod(instance, method_name, NULL); } |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
75 |
const char *CallStringMethod(HSQOBJECT instance, const char *method_name) { HSQOBJECT ret; this->CallMethod(instance, method_name, &ret); return ObjectToString(&ret); } |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
76 |
int CallIntegerMethod(HSQOBJECT instance, const char *method_name) { HSQOBJECT ret; this->CallMethod(instance, method_name, &ret); return ObjectToInteger(&ret); } |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
77 |
|
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
78 |
/** |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
79 |
* Check if a method exists in an instance. |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
80 |
*/ |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
81 |
bool MethodExists(HSQOBJECT instance, const char *method_name); |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
82 |
|
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
83 |
/** |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
84 |
* Creates a class instance. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
85 |
* @param class_name The name of the class of which we create an instance. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
86 |
* @param real_instance The instance to the real class, if it represents a real class. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
87 |
* @param instance Returning value with the pointer to the instance. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
88 |
* @return False if creating failed. |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
89 |
*/ |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
90 |
bool CreateClassInstance(const char *class_name, void *real_instance, HSQOBJECT *instance); |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
91 |
|
9394
796c684ca5b6
(svn r9186) [NoAI] -Documentation: forgot to document GetInstance()
truelight
parents:
9393
diff
changeset
|
92 |
/** |
796c684ca5b6
(svn r9186) [NoAI] -Documentation: forgot to document GetInstance()
truelight
parents:
9393
diff
changeset
|
93 |
* Get the real-instance pointer. |
796c684ca5b6
(svn r9186) [NoAI] -Documentation: forgot to document GetInstance()
truelight
parents:
9393
diff
changeset
|
94 |
* @note This will only work just after a function-call from within Squirrel |
796c684ca5b6
(svn r9186) [NoAI] -Documentation: forgot to document GetInstance()
truelight
parents:
9393
diff
changeset
|
95 |
* to your C++ function. |
796c684ca5b6
(svn r9186) [NoAI] -Documentation: forgot to document GetInstance()
truelight
parents:
9393
diff
changeset
|
96 |
*/ |
9404
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
97 |
static bool GetRealInstance(HSQUIRRELVM vm, SQUserPointer *ptr) { return SQ_SUCCEEDED(sq_getinstanceup(vm, 1, ptr, 0)); } |
9394
796c684ca5b6
(svn r9186) [NoAI] -Documentation: forgot to document GetInstance()
truelight
parents:
9393
diff
changeset
|
98 |
|
9404
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
99 |
/** |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
100 |
* Get the Squirrel-instance pointer. |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
101 |
* @note This will only work just after a function-call from within Squirrel |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
102 |
* to your C++ function. |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
103 |
*/ |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
104 |
static bool GetInstance(HSQUIRRELVM vm, HSQOBJECT *ptr) { sq_getclass(vm, 1); sq_getstackobj(vm, 1, ptr); return true; } |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
105 |
|
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
106 |
/** |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
107 |
* Convert a Squirrel-object to a string. |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
108 |
*/ |
9435
9dad22394553
(svn r9245) [NoAI] -Fix: allow compilation with _UNICODE
glx
parents:
9422
diff
changeset
|
109 |
static const char *ObjectToString(HSQOBJECT *ptr) { return FS2OTTD(sq_objtostring(ptr)); } |
9404
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
110 |
|
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
111 |
/** |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
112 |
* Convert a Squirrel-object to an integer. |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
113 |
*/ |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
114 |
static int ObjectToInteger(HSQOBJECT *ptr) { return sq_objtointeger(ptr); } |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
115 |
|
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
116 |
/** |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
117 |
* Sets a pointer in the VM that is reasable from where ever you are, what |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
118 |
* ever your state is. Useful to keep track of the main instance. |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
119 |
*/ |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
120 |
void SetGlobalPointer(void *ptr) { sq_setforeignptr(this->vm, ptr); } |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
121 |
|
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
122 |
/** |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
123 |
* Get the pointer as set by SetGlobalPointer. |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
124 |
*/ |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
125 |
static void *GetGlobalPointer(HSQUIRRELVM vm) { return sq_getforeignptr(vm); } |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
126 |
|
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
127 |
/** |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
128 |
* Throw a Squirrel error that will be nicely displayed to the user. |
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9399
diff
changeset
|
129 |
*/ |
9435
9dad22394553
(svn r9245) [NoAI] -Fix: allow compilation with _UNICODE
glx
parents:
9422
diff
changeset
|
130 |
void ThrowError(const char *error) { sq_throwerror(this->vm, OTTD2FS(error)); } |
9393
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
131 |
}; |
04bd925b9069
(svn r9185) [NoAI] -Codechange: split up the squirrel code so we have SquirrelCore
truelight
parents:
diff
changeset
|
132 |
|
9422
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9404
diff
changeset
|
133 |
#endif /* SQUIRREL_HPP */ |