Colobot
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
script
scriptfunc.h
Go to the documentation of this file.
1
/*
2
* This file is part of the Colobot: Gold Edition source code
3
* Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
4
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
* See the GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see http://gnu.org/licenses
18
*/
19
25
#pragma once
26
27
#include "
CBot/CBotDll.h
"
28
29
#include "common/error.h"
30
31
#include <string>
32
#include <unordered_map>
33
#include <memory>
34
35
class
CObject
;
36
class
CScript
;
37
class
CExchangePost
;
38
39
40
class
CScriptFunctions
41
{
42
public
:
43
static
void
Init();
44
static
CBotVar
* CreateObjectVar(
CObject
* obj);
45
static
void
DestroyObjectVar(
CBotVar
* botVar,
bool
permanent);
46
47
private
:
48
static
CBotTypResult
cNull(
CBotVar
* &var,
void
* user);
49
static
CBotTypResult
cOneFloat(
CBotVar
* &var,
void
* user);
50
static
CBotTypResult
cTwoFloat(
CBotVar
* &var,
void
* user);
51
static
CBotTypResult
cString(
CBotVar
* &var,
void
* user);
52
static
CBotTypResult
cStringString(
CBotVar
* &var,
void
* user);
53
static
CBotTypResult
cOneInt(
CBotVar
* &var,
void
* user);
54
static
CBotTypResult
cOneIntReturnBool(
CBotVar
* &var,
void
* user);
55
static
CBotTypResult
cEndMission(
CBotVar
* &var,
void
* user);
56
static
CBotTypResult
cPlayMusic(
CBotVar
* &var,
void
* user);
57
static
CBotTypResult
cGetObject(
CBotVar
* &var,
void
* user);
58
static
CBotTypResult
cDelete(
CBotVar
* &var,
void
* user);
59
static
CBotTypResult
cSearch(
CBotVar
* &var,
void
* user);
60
static
CBotTypResult
cRadar(
CBotVar
* &var,
void
* user);
61
static
CBotTypResult
cDetect(
CBotVar
* &var,
void
* user);
62
static
CBotTypResult
cDirection(
CBotVar
* &var,
void
* user);
63
static
CBotTypResult
cProduce(
CBotVar
* &var,
void
* user);
64
static
CBotTypResult
cDistance(
CBotVar
* &var,
void
* user);
65
static
CBotTypResult
cSpace(
CBotVar
* &var,
void
* user);
66
static
CBotTypResult
cFlatSpace(
CBotVar
* &var,
void
* user);
67
static
CBotTypResult
cFlatGround(
CBotVar
* &var,
void
* user);
68
static
CBotTypResult
cGoto(
CBotVar
* &var,
void
* user);
69
static
CBotTypResult
cGrabDrop(
CBotVar
* &var,
void
* user);
70
static
CBotTypResult
cReceive(
CBotVar
* &var,
void
* user);
71
static
CBotTypResult
cSend(
CBotVar
* &var,
void
* user);
72
static
CBotTypResult
cDeleteInfo(
CBotVar
* &var,
void
* user);
73
static
CBotTypResult
cTestInfo(
CBotVar
* &var,
void
* user);
74
static
CBotTypResult
cShield(
CBotVar
* &var,
void
* user);
75
static
CBotTypResult
cFire(
CBotVar
* &var,
void
* user);
76
static
CBotTypResult
cAim(
CBotVar
* &var,
void
* user);
77
static
CBotTypResult
cMotor(
CBotVar
* &var,
void
* user);
78
static
CBotTypResult
cTopo(
CBotVar
* &var,
void
* user);
79
static
CBotTypResult
cMessage(
CBotVar
* &var,
void
* user);
80
static
CBotTypResult
cPenDown(
CBotVar
* &var,
void
* user);
81
static
CBotTypResult
cOnePoint(
CBotVar
* &var,
void
* user);
82
static
CBotTypResult
cPoint(
CBotVar
* &var,
void
* user);
83
static
CBotTypResult
cOneObject(
CBotVar
* &var,
void
* user);
84
85
86
static
bool
rSin(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
87
static
bool
rCos(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
88
static
bool
rTan(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
89
static
bool
rSqrt(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
90
static
bool
rPow(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
91
static
bool
rRand(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
92
static
bool
rAbs(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
93
static
bool
rFloor(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
94
static
bool
rCeil(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
95
static
bool
rRound(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
96
static
bool
rTrunc(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
97
static
bool
rEndMission(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
98
static
bool
rPlayMusic(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
99
static
bool
rStopMusic(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
100
static
bool
rGetBuild(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
101
static
bool
rGetResearchEnable(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
102
static
bool
rGetResearchDone(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
103
static
bool
rSetBuild(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
104
static
bool
rSetResearchEnable(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
105
static
bool
rSetResearchDone(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
106
static
bool
rGetObjectById(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
107
static
bool
rGetObject(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
108
static
bool
rDelete(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
109
static
bool
rSearch(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
110
static
bool
rRadar(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
111
static
bool
rDetect(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
112
static
bool
rDirection(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
113
static
bool
rCanBuild(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
114
static
bool
rCanResearch(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
115
static
bool
rResearched(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
116
static
bool
rBuildingEnabled(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
117
static
bool
rBuild(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
118
static
bool
rProduce(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
119
static
bool
rDistance(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
120
static
bool
rDistance2d(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
121
static
bool
rSpace(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
122
static
bool
rFlatSpace(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
123
static
bool
rFlatGround(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
124
static
bool
rWait(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
125
static
bool
rMove(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
126
static
bool
rTurn(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
127
static
bool
rGoto(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
128
static
bool
rFind(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
129
static
bool
rGrab(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
130
static
bool
rDrop(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
131
static
bool
rSniff(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
132
static
bool
rReceive(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
133
static
bool
rSend(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
134
static
bool
rDeleteInfo(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
135
static
bool
rTestInfo(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
136
static
bool
rThump(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
137
static
bool
rRecycle(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
138
static
bool
rShield(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
139
static
bool
rFire(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
140
static
bool
rAim(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
141
static
bool
rMotor(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
142
static
bool
rJet(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
143
static
bool
rTopo(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
144
static
bool
rMessage(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
145
static
bool
rCmdline(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
146
static
bool
rIsMovie(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
147
static
bool
rErrMode(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
148
static
bool
rIPF(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
149
static
bool
rAbsTime(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
150
static
bool
rDeleteFile(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
151
static
bool
rPenDown(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
152
static
bool
rPenUp(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
153
static
bool
rPenColor(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
154
static
bool
rPenWidth(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
155
static
bool
rCameraFocus(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
156
157
158
static
CBotTypResult
cBusy(
CBotVar
* thisclass,
CBotVar
* &var);
159
static
CBotTypResult
cFactory(
CBotVar
* thisclass,
CBotVar
* &var);
160
static
CBotTypResult
cClassNull(
CBotVar
* thisclass,
CBotVar
* &var);
161
static
CBotTypResult
cClassOneFloat(
CBotVar
* thisclass,
CBotVar
* &var);
162
163
static
bool
rBusy(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
164
static
bool
rFactory(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
165
static
bool
rResearch(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
166
static
bool
rTakeOff(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
167
static
bool
rDestroy(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
168
169
170
static
CBotTypResult
cfconstruct (
CBotVar
* pThis,
CBotVar
* &pVar);
171
static
CBotTypResult
cfopen (
CBotVar
* pThis,
CBotVar
* &pVar);
172
static
CBotTypResult
cfclose (
CBotVar
* pThis,
CBotVar
* &pVar);
173
static
CBotTypResult
cfwrite (
CBotVar
* pThis,
CBotVar
* &pVar);
174
static
CBotTypResult
cfread (
CBotVar
* pThis,
CBotVar
* &pVar);
175
static
CBotTypResult
cfeof (
CBotVar
* pThis,
CBotVar
* &pVar);
176
static
bool
rfconstruct (
CBotVar
* pThis,
CBotVar
* pVar,
CBotVar
* pResult,
int
& Exception,
void
* user);
177
static
bool
rfdestruct (
CBotVar
* pThis,
CBotVar
* pVar,
CBotVar
* pResult,
int
& Exception,
void
* user);
178
static
bool
rfopen (
CBotVar
* pThis,
CBotVar
* pVar,
CBotVar
* pResult,
int
& Exception,
void
* user);
179
static
bool
rfclose (
CBotVar
* pThis,
CBotVar
* pVar,
CBotVar
* pResult,
int
& Exception,
void
* user);
180
static
bool
rfwrite (
CBotVar
* pThis,
CBotVar
* pVar,
CBotVar
* pResult,
int
& Exception,
void
* user);
181
static
bool
rfread (
CBotVar
* pThis,
CBotVar
* pVar,
CBotVar
* pResult,
int
& Exception,
void
* user);
182
static
bool
rfeof (
CBotVar
* pThis,
CBotVar
* pVar,
CBotVar
* pResult,
int
& Exception,
void
* user);
183
184
static
CBotTypResult
cPointConstructor(
CBotVar
* pThis,
CBotVar
* &var);
185
static
bool
rPointConstructor(
CBotVar
* pThis,
CBotVar
* var,
CBotVar
* pResult,
int
& Exception,
void
* user);
186
187
static
void
uObject(
CBotVar
* botThis,
void
* user);
188
189
public
:
190
static
int
m_numberOfOpenFiles;
191
192
private
:
193
static
bool
WaitForForegroundTask(
CScript
* script,
CBotVar
* result,
int
&exception);
194
static
bool
WaitForBackgroundTask(
CScript
* script,
CBotVar
* result,
int
&exception);
195
static
bool
ShouldTaskStop(Error err,
int
errMode);
196
static
CExchangePost
* FindExchangePost(
CObject
*
object
,
float
power);
197
198
static
bool
FileClassOpenFile(
CBotVar
* pThis,
CBotVar
* pVar,
CBotVar
* pResult,
int
& Exception);
199
200
static
std::unordered_map<int, std::unique_ptr<std::ios>> m_files;
201
static
int
m_nextFile;
202
};
CExchangePost
Definition:
exchange_post.h:46
CBotDll.h
Library for interpretation of CBOT language.
CScriptFunctions
Definition:
scriptfunc.h:40
CScript
Definition:
script.h:58
CBotTypResult
CBotTypResult class to define the complete type of a result.
Definition:
CBotDll.h:90
CBotVar
Definition:
CBotDll.h:557
CObject
Base class for all 3D in-game objects.
Definition:
object.h:59
Generated by
1.8.9.1