Colobot
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Pages
src
script
script.h
Go to the documentation of this file.
1
// * This file is part of the COLOBOT source code
2
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3
// *
4
// * This program is free software: you can redistribute it and/or modify
5
// * it under the terms of the GNU General Public License as published by
6
// * the Free Software Foundation, either version 3 of the License, or
7
// * (at your option) any later version.
8
// *
9
// * This program is distributed in the hope that it will be useful,
10
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// * GNU General Public License for more details.
13
// *
14
// * You should have received a copy of the GNU General Public License
15
// * along with this program. If not, see http://www.gnu.org/licenses/.
16
22
#pragma once
23
24
25
#include "
common/event.h
"
26
27
#include "
CBot/CBotDll.h
"
28
29
#include <stdio.h>
30
31
32
class
CObject
;
33
class
CTaskManager
;
34
class
CRobotMain
;
35
36
namespace
Ui{
37
class
CEdit;
38
class
CInterface;
39
class
CList;
40
}
/* Ui */
41
42
namespace
Gfx {
43
class
CEngine;
44
class
CTerrain;
45
class
CWater;
46
}
/* Gfx */
47
48
49
50
class
CScript
51
{
52
public
:
53
CScript
(
CObject
*
object
,
CTaskManager
** secondaryTask);
54
~
CScript
();
55
56
static
void
InitFonctions();
57
58
void
PutScript(
Ui::CEdit
* edit,
const
char
* name);
59
bool
GetScript(
Ui::CEdit
* edit);
60
bool
GetCompile();
61
62
void
GetTitle(
char
* buffer);
63
64
void
SetStepMode(
bool
bStep);
65
bool
Run();
66
bool
Continue(
const
Event
&event);
67
bool
Step(
const
Event
&event);
68
void
Stop();
69
bool
IsRunning();
70
bool
IsContinue();
71
bool
GetCursor(
int
&cursor1,
int
&cursor2);
72
void
UpdateList(
Ui::CList
* list);
73
void
ColorizeScript(
Ui::CEdit
* edit);
74
bool
IntroduceVirus();
75
76
int
GetError();
77
void
GetError(
char
* buffer);
78
79
void
New(
Ui::CEdit
* edit,
const
char
* name);
80
bool
SendScript(
const
char
* text);
81
bool
ReadScript(
const
char
* filename);
82
bool
WriteScript(
const
char
* filename);
83
bool
ReadStack(FILE *file);
84
bool
WriteStack(FILE *file);
85
bool
Compare(
CScript
* other);
86
87
void
SetFilename(
char
*filename);
88
char
* GetFilename();
89
90
protected
:
91
bool
IsEmpty();
92
bool
CheckToken();
93
bool
Compile();
94
95
private
:
96
static
CBotTypResult
cNull(
CBotVar
* &var,
void
* user);
97
static
CBotTypResult
cOneFloat(
CBotVar
* &var,
void
* user);
98
static
CBotTypResult
cTwoFloat(
CBotVar
* &var,
void
* user);
99
static
CBotTypResult
cString(
CBotVar
* &var,
void
* user);
100
static
CBotTypResult
cStringString(
CBotVar
* &var,
void
* user);
101
static
CBotTypResult
cEndMission(
CBotVar
* &var,
void
* user);
102
static
CBotTypResult
cPlayMusic(
CBotVar
* &var,
void
* user);
103
static
CBotTypResult
cGetObject(
CBotVar
* &var,
void
* user);
104
static
CBotTypResult
cDelete(
CBotVar
* &var,
void
* user);
105
static
CBotTypResult
cSearch(
CBotVar
* &var,
void
* user);
106
static
CBotTypResult
cRadar(
CBotVar
* &var,
void
* user);
107
static
CBotTypResult
cDetect(
CBotVar
* &var,
void
* user);
108
static
CBotTypResult
cDirection(
CBotVar
* &var,
void
* user);
109
static
CBotTypResult
cCanBuild(
CBotVar
* &var,
void
* user);
110
static
CBotTypResult
cProduce(
CBotVar
* &var,
void
* user);
111
static
CBotTypResult
cDistance(
CBotVar
* &var,
void
* user);
112
static
CBotTypResult
cSpace(
CBotVar
* &var,
void
* user);
113
static
CBotTypResult
cFlatGround(
CBotVar
* &var,
void
* user);
114
static
CBotTypResult
cGoto(
CBotVar
* &var,
void
* user);
115
static
CBotTypResult
cGrabDrop(
CBotVar
* &var,
void
* user);
116
static
CBotTypResult
cReceive(
CBotVar
* &var,
void
* user);
117
static
CBotTypResult
cSend(
CBotVar
* &var,
void
* user);
118
static
CBotTypResult
cDeleteInfo(
CBotVar
* &var,
void
* user);
119
static
CBotTypResult
cTestInfo(
CBotVar
* &var,
void
* user);
120
static
CBotTypResult
cShield(
CBotVar
* &var,
void
* user);
121
static
CBotTypResult
cFire(
CBotVar
* &var,
void
* user);
122
static
CBotTypResult
cAim(
CBotVar
* &var,
void
* user);
123
static
CBotTypResult
cMotor(
CBotVar
* &var,
void
* user);
124
static
CBotTypResult
cTopo(
CBotVar
* &var,
void
* user);
125
static
CBotTypResult
cMessage(
CBotVar
* &var,
void
* user);
126
static
CBotTypResult
cPenDown(
CBotVar
* &var,
void
* user);
127
static
CBotTypResult
cOnePoint(
CBotVar
* &var,
void
* user);
128
static
CBotTypResult
cPoint(
CBotVar
* &var,
void
* user);
129
130
131
static
bool
rSin(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
132
static
bool
rCos(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
133
static
bool
rTan(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
134
static
bool
rSqrt(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
135
static
bool
rPow(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
136
static
bool
rRand(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
137
static
bool
rAbs(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
138
static
bool
rEndMission(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
139
static
bool
rPlayMusic(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
140
static
bool
rStopMusic(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
141
static
bool
rGetBuild(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
142
static
bool
rGetResearchEnable(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
143
static
bool
rGetResearchDone(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
144
static
bool
rSetBuild(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
145
static
bool
rSetResearchEnable(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
146
static
bool
rSetResearchDone(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
147
static
bool
rGetObjectById(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
148
static
bool
rGetObject(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
149
static
bool
rProgFunc(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
150
static
bool
rDelete(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
151
static
bool
rSearch(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
152
static
bool
rRadar(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
153
static
bool
rDetect(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
154
static
bool
rDirection(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
155
static
bool
rCanBuild(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
156
static
bool
rBuild(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
157
static
bool
rProduce(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
158
static
bool
rDistance(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
159
static
bool
rDistance2d(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
160
static
bool
rSpace(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
161
static
bool
rFlatGround(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
162
static
bool
rWait(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
163
static
bool
rMove(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
164
static
bool
rTurn(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
165
static
bool
rGoto(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
166
static
bool
rFind(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
167
static
bool
rGrab(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
168
static
bool
rDrop(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
169
static
bool
rSniff(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
170
static
bool
rReceive(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
171
static
bool
rSend(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
172
static
bool
rDeleteInfo(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
173
static
bool
rTestInfo(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
174
static
bool
rThump(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
175
static
bool
rRecycle(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
176
static
bool
rShield(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
177
static
bool
rFire(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
178
static
bool
rAim(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
179
static
bool
rMotor(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
180
static
bool
rJet(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
181
static
bool
rTopo(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
182
static
bool
rMessage(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
183
static
bool
rCmdline(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
184
static
bool
rIsMovie(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
185
static
bool
rErrMode(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
186
static
bool
rIPF(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
187
static
bool
rAbsTime(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
188
static
bool
rDeleteFile(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
189
static
bool
rPenDown(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
190
static
bool
rPenUp(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
191
static
bool
rPenColor(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
192
static
bool
rPenWidth(
CBotVar
* var,
CBotVar
* result,
int
& exception,
void
* user);
193
194
public
:
195
static
CBotTypResult
cBusy(
CBotVar
* thisclass,
CBotVar
* &var);
196
static
CBotTypResult
cFactory(
CBotVar
* thisclass,
CBotVar
* &var);
197
static
CBotTypResult
cClassNull(
CBotVar
* thisclass,
CBotVar
* &var);
198
static
CBotTypResult
cClassOneFloat(
CBotVar
* thisclass,
CBotVar
* &var);
199
200
static
bool
rBusy(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception);
201
static
bool
rFactory(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception);
202
static
bool
rResearch(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception);
203
static
bool
rDestroy(
CBotVar
* thisclass,
CBotVar
* var,
CBotVar
* result,
int
& exception);
204
205
private
:
206
static
bool
Process(
CScript
* script,
CBotVar
* result,
int
&exception);
207
static
CObject
* SearchInfo(
CScript
* script,
CObject
*
object
,
float
power);
208
209
protected
:
210
Gfx::CEngine
* m_engine;
211
Ui::CInterface
* m_interface;
212
CBotProgram
* m_botProg;
213
CRobotMain
* m_main;
214
Gfx::CTerrain
* m_terrain;
215
Gfx::CWater
* m_water;
216
CTaskManager
* m_primaryTask;
217
CTaskManager
** m_secondaryTask;
218
CObject
* m_object;
219
220
int
m_ipf;
// number of instructions/second
221
int
m_errMode;
// what to do in case of error
222
int
m_len;
// length of the script (without <0>)
223
char
* m_script;
// script ends with <0>
224
bool
m_bRun;
// program during execution?
225
bool
m_bStepMode;
// step by step
226
bool
m_bContinue;
// external function to continue
227
bool
m_bCompile;
// compilation ok?
228
char
m_title[50];
// script title
229
char
m_filename[50];
// file name
230
char
m_token[50];
// missing instruction
231
int
m_error;
// error (0=ok)
232
int
m_cursor1;
233
int
m_cursor2;
234
Event
m_event;
235
float
m_returnValue;
236
};
237
CBotDll.h
Library for interpretation of CBOT language.
Ui::CList
Definition:
list.h:40
CBotProgram
Definition:
CBotDll.h:361
CRobotMain
Definition:
robotmain.h:191
CTaskManager
Definition:
taskmanager.h:31
Gfx::CTerrain
Terrain loader/generator and manager.
Definition:
terrain.h:220
Gfx::CEngine
The graphics engine.
Definition:
engine.h:681
event.h
Event types, structs and event queue.
CScript
Definition:
script.h:50
CBotTypResult
CBotTypResult class to define the complete type of a result.
Definition:
CBotDll.h:86
Gfx::CWater
Water manager/renderer.
Definition:
water.h:116
Ui::CEdit
Definition:
edit.h:129
CBotVar
Definition:
CBotDll.h:558
Event
Event sent by system, interface or game.
Definition:
event.h:687
Ui::CInterface
Definition:
interface.h:56
CObject
Definition:
object.h:372
Generated on Fri Mar 14 2014 13:34:47 for Colobot by
1.8.6