summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/cbottoken.cpp23
-rw-r--r--src/script/cbottoken.h10
-rw-r--r--src/script/cmdtoken.cpp150
-rw-r--r--src/script/cmdtoken.h44
-rw-r--r--src/script/script.cpp1220
-rw-r--r--src/script/script.h178
6 files changed, 828 insertions, 797 deletions
diff --git a/src/script/cbottoken.cpp b/src/script/cbottoken.cpp
index 223da4d..a9cc599 100644
--- a/src/script/cbottoken.cpp
+++ b/src/script/cbottoken.cpp
@@ -15,25 +15,16 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
-#include "common/global.h"
-#include "common/event.h"
-#include "object/object.h"
#include "script/cbottoken.h"
+#include "object/object.h"
+#include <string.h>
// Seeking the name of an object.
-char* RetObjectName(ObjectType type)
+char* GetObjectName(ObjectType type)
{
if ( type == OBJECT_PORTICO ) return "Portico";
if ( type == OBJECT_BASE ) return "SpaceShip";
@@ -126,7 +117,7 @@ char* RetObjectName(ObjectType type)
// Seeking the name of a secondary object.
// (because Otto thinks that Germans do not like nuclear power)
-char* RetObjectAlias(ObjectType type)
+char* GetObjectAlias(ObjectType type)
{
if ( type == OBJECT_NUCLEAR ) return "FuelCellPlant";
if ( type == OBJECT_URANIUM ) return "PlatinumOre";
@@ -139,7 +130,7 @@ char* RetObjectAlias(ObjectType type)
// Returns the help file to use for the object.
-char* RetHelpFilename(ObjectType type)
+char* GetHelpFilename(ObjectType type)
{
if ( type == OBJECT_BASE ) return "help\\object\\base.txt";
if ( type == OBJECT_DERRICK ) return "help\\object\\derrick.txt";
@@ -224,7 +215,7 @@ char* RetHelpFilename(ObjectType type)
// Returns the help file to use for instruction.
-char* RetHelpFilename(const char *token)
+char* GetHelpFilename(const char *token)
{
if ( strcmp(token, "if" ) == 0 ) return "help\\cbot\\if.txt";
if ( strcmp(token, "else" ) == 0 ) return "help\\cbot\\if.txt";
@@ -436,7 +427,7 @@ bool IsFunction(const char *token)
// Returns using a compact instruction.
-char* RetHelpText(const char *token)
+char* GetHelpText(const char *token)
{
if ( strcmp(token, "if" ) == 0 ) return "if ( condition ) { bloc }";
if ( strcmp(token, "else" ) == 0 ) return "else { bloc }";
diff --git a/src/script/cbottoken.h b/src/script/cbottoken.h
index c1a6a65..4be5f03 100644
--- a/src/script/cbottoken.h
+++ b/src/script/cbottoken.h
@@ -25,12 +25,12 @@
// Procedures.
-extern char* RetObjectName(ObjectType type);
-extern char* RetObjectAlias(ObjectType type);
-extern char* RetHelpFilename(ObjectType type);
-extern char* RetHelpFilename(const char *token);
+extern char* GetObjectName(ObjectType type);
+extern char* GetObjectAlias(ObjectType type);
+extern char* GetHelpFilename(ObjectType type);
+extern char* GetHelpFilename(const char *token);
extern bool IsType(const char *token);
extern bool IsFunction(const char *token);
-extern char* RetHelpText(const char *token);
+extern char* GetHelpText(const char *token);
diff --git a/src/script/cmdtoken.cpp b/src/script/cmdtoken.cpp
index 256b580..d79fbf1 100644
--- a/src/script/cmdtoken.cpp
+++ b/src/script/cmdtoken.cpp
@@ -15,23 +15,11 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
-#include "common/global.h"
-#include "common/event.h"
-#include "old/water.h"
-#include "old/pyro.h"
-#include "old/camera.h"
-#include "object/object.h"
#include "script/cmdtoken.h"
+#include "common/global.h"
+#include <string.h>
@@ -48,7 +36,7 @@ char* SkipSpace(char *line)
// Checks if a line contains a command.
-bool Cmd(char *line, char *token)
+bool Cmd(char *line, const char *token)
{
char* p;
@@ -59,7 +47,7 @@ bool Cmd(char *line, char *token)
// Seeking an operator.
-char* SearchOp(char *line, char *op)
+char* SearchOp(char *line, const char *op)
{
char opeq[50];
char* p;
@@ -418,7 +406,7 @@ ObjectType GetTypeObject(char *line, int rank, ObjectType def)
// Returns the name of an object type.
-char* GetTypeObject(ObjectType type)
+const char* GetTypeObject(ObjectType type)
{
if ( type == OBJECT_PORTICO ) return "Portico";
if ( type == OBJECT_BASE ) return "SpaceShip";
@@ -663,35 +651,35 @@ char* GetTypeObject(ObjectType type)
// Returns the type of water.
-WaterType GetTypeWater(char *line, int rank, WaterType def)
+Gfx::WaterType GetTypeWater(char *line, int rank, Gfx::WaterType def)
{
char* p;
p = SearchArg(line, rank);
if ( *p == 0 ) return def;
- if ( Cmd(p, "NULL" ) ) return WATER_NULL;
- if ( Cmd(p, "TT" ) ) return WATER_TT;
- if ( Cmd(p, "TO" ) ) return WATER_TO;
- if ( Cmd(p, "CT" ) ) return WATER_CT;
- if ( Cmd(p, "CO" ) ) return WATER_CO;
+ if ( Cmd(p, "NULL" ) ) return Gfx::WATER_NULL;
+ if ( Cmd(p, "TT" ) ) return Gfx::WATER_TT;
+ if ( Cmd(p, "TO" ) ) return Gfx::WATER_TO;
+ if ( Cmd(p, "CT" ) ) return Gfx::WATER_CT;
+ if ( Cmd(p, "CO" ) ) return Gfx::WATER_CO;
return def;
}
// Returns the type of terrain.
-D3DTypeObj GetTypeTerrain(char *line, int rank, D3DTypeObj def)
+Gfx::EngineObjectType GetTypeTerrain(char *line, int rank, Gfx::EngineObjectType def)
{
char* p;
p = SearchArg(line, rank);
if ( *p == 0 ) return def;
- if ( Cmd(p, "Terrain" ) ) return TYPETERRAIN;
- if ( Cmd(p, "Object" ) ) return TYPEFIX;
- if ( Cmd(p, "Quartz" ) ) return TYPEQUARTZ;
- if ( Cmd(p, "Metal" ) ) return TYPEMETAL;
+ if ( Cmd(p, "Terrain" ) ) return Gfx::ENG_OBJTYPE_TERRAIN;
+ if ( Cmd(p, "Object" ) ) return Gfx::ENG_OBJTYPE_FIX;
+ if ( Cmd(p, "Quartz" ) ) return Gfx::ENG_OBJTYPE_QUARTZ;
+ if ( Cmd(p, "Metal" ) ) return Gfx::ENG_OBJTYPE_METAL;
return def;
}
@@ -753,64 +741,64 @@ int GetResearch(char *line, int rank)
// Returns the type of pyrotechnic effect.
-PyroType GetPyro(char *line, int rank)
+Gfx::PyroType GetPyro(char *line, int rank)
{
char* p;
p = SearchArg(line, rank);
- if ( *p == 0 ) return PT_NULL;
-
- if ( Cmd(p, "FRAGt" ) ) return PT_FRAGT;
- if ( Cmd(p, "FRAGo" ) ) return PT_FRAGO;
- if ( Cmd(p, "FRAGw" ) ) return PT_FRAGW;
- if ( Cmd(p, "EXPLOt" ) ) return PT_EXPLOT;
- if ( Cmd(p, "EXPLOo" ) ) return PT_EXPLOO;
- if ( Cmd(p, "EXPLOw" ) ) return PT_EXPLOW;
- if ( Cmd(p, "SHOTt" ) ) return PT_SHOTT;
- if ( Cmd(p, "SHOTh" ) ) return PT_SHOTH;
- if ( Cmd(p, "SHOTm" ) ) return PT_SHOTM;
- if ( Cmd(p, "SHOTw" ) ) return PT_SHOTW;
- if ( Cmd(p, "EGG" ) ) return PT_EGG;
- if ( Cmd(p, "BURNt" ) ) return PT_BURNT;
- if ( Cmd(p, "BURNo" ) ) return PT_BURNO;
- if ( Cmd(p, "SPIDER" ) ) return PT_SPIDER;
- if ( Cmd(p, "FALL" ) ) return PT_FALL;
- if ( Cmd(p, "RESET" ) ) return PT_RESET;
- if ( Cmd(p, "WIN" ) ) return PT_WIN;
- if ( Cmd(p, "LOST" ) ) return PT_LOST;
-
- return PT_NULL;
+ if ( *p == 0 ) return Gfx::PT_NULL;
+
+ if ( Cmd(p, "FRAGt" ) ) return Gfx::PT_FRAGT;
+ if ( Cmd(p, "FRAGo" ) ) return Gfx::PT_FRAGO;
+ if ( Cmd(p, "FRAGw" ) ) return Gfx::PT_FRAGW;
+ if ( Cmd(p, "EXPLOt" ) ) return Gfx::PT_EXPLOT;
+ if ( Cmd(p, "EXPLOo" ) ) return Gfx::PT_EXPLOO;
+ if ( Cmd(p, "EXPLOw" ) ) return Gfx::PT_EXPLOW;
+ if ( Cmd(p, "SHOTt" ) ) return Gfx::PT_SHOTT;
+ if ( Cmd(p, "SHOTh" ) ) return Gfx::PT_SHOTH;
+ if ( Cmd(p, "SHOTm" ) ) return Gfx::PT_SHOTM;
+ if ( Cmd(p, "SHOTw" ) ) return Gfx::PT_SHOTW;
+ if ( Cmd(p, "EGG" ) ) return Gfx::PT_EGG;
+ if ( Cmd(p, "BURNt" ) ) return Gfx::PT_BURNT;
+ if ( Cmd(p, "BURNo" ) ) return Gfx::PT_BURNO;
+ if ( Cmd(p, "SPIDER" ) ) return Gfx::PT_SPIDER;
+ if ( Cmd(p, "FALL" ) ) return Gfx::PT_FALL;
+ if ( Cmd(p, "RESET" ) ) return Gfx::PT_RESET;
+ if ( Cmd(p, "WIN" ) ) return Gfx::PT_WIN;
+ if ( Cmd(p, "LOST" ) ) return Gfx::PT_LOST;
+
+ return Gfx::PT_NULL;
}
// Returns the type of camera.
-CameraType GetCamera(char *line, int rank)
+Gfx::CameraType GetCamera(char *line, int rank)
{
char* p;
p = SearchArg(line, rank);
- if ( *p == 0 ) return CAMERA_NULL;
+ if ( *p == 0 ) return Gfx::CAM_TYPE_NULL;
- if ( Cmd(p, "BACK" ) ) return CAMERA_BACK;
- if ( Cmd(p, "PLANE" ) ) return CAMERA_PLANE;
- if ( Cmd(p, "ONBOARD" ) ) return CAMERA_ONBOARD;
- if ( Cmd(p, "FIX" ) ) return CAMERA_FIX;
+ if ( Cmd(p, "BACK" ) ) return Gfx::CAM_TYPE_BACK;
+ if ( Cmd(p, "PLANE" ) ) return Gfx::CAM_TYPE_PLANE;
+ if ( Cmd(p, "ONBOARD" ) ) return Gfx::CAM_TYPE_ONBOARD;
+ if ( Cmd(p, "FIX" ) ) return Gfx::CAM_TYPE_FIX;
- return CAMERA_NULL;
+ return Gfx::CAM_TYPE_NULL;
}
// Returns the name of a camera.
-char* GetCamera(CameraType type)
+const char* GetCamera(Gfx::CameraType type)
{
- if ( type == CAMERA_ONBOARD ) return "ONBOARD";
- if ( type == CAMERA_FIX ) return "FIX";
+ if ( type == Gfx::CAM_TYPE_ONBOARD ) return "ONBOARD";
+ if ( type == Gfx::CAM_TYPE_FIX ) return "FIX";
return "BACK";
}
// Returns an integer.
-int OpInt(char *line, char *op, int def)
+int OpInt(char *line, const char *op, int def)
{
line = SearchOp(line, op);
if ( *line == 0 ) return def;
@@ -819,7 +807,7 @@ int OpInt(char *line, char *op, int def)
// Returns a float number.
-float OpFloat(char *line, char *op, float def)
+float OpFloat(char *line, const char *op, float def)
{
line = SearchOp(line, op);
if ( *line == 0 ) return def;
@@ -852,7 +840,7 @@ ObjectType OpTypeObject(char *line, char *op, ObjectType def)
// Returns the type of a water.
-WaterType OpTypeWater(char *line, char *op, WaterType def)
+Gfx::WaterType OpTypeWater(char *line, char *op, Gfx::WaterType def)
{
line = SearchOp(line, op);
if ( *line == 0 ) return def;
@@ -861,7 +849,7 @@ WaterType OpTypeWater(char *line, char *op, WaterType def)
// Returns the type of a terrain.
-D3DTypeObj OpTypeTerrain(char *line, char *op, D3DTypeObj def)
+Gfx::EngineObjectType OpTypeTerrain(char *line, char *op, Gfx::EngineObjectType def)
{
line = SearchOp(line, op);
if ( *line == 0 ) return def;
@@ -879,19 +867,19 @@ int OpResearch(char *line, char *op)
// Returns the type of pyrotechnic effect.
-PyroType OpPyro(char *line, char *op)
+Gfx::PyroType OpPyro(char *line, char *op)
{
line = SearchOp(line, op);
- if ( *line == 0 ) return PT_NULL;
+ if ( *line == 0 ) return Gfx::PT_NULL;
return GetPyro(line, 0);
}
// Returns the type of camera.
-CameraType OpCamera(char *line, char *op)
+Gfx::CameraType OpCamera(char *line, const char *op)
{
line = SearchOp(line, op);
- if ( *line == 0 ) return CAMERA_NULL;
+ if ( *line == 0 ) return Gfx::CAM_TYPE_NULL;
return GetCamera(line, 0);
}
@@ -924,7 +912,7 @@ Math::Vector OpPos(char *line, char *op)
// Returns a direction.
-Math::Vector OpDir(char *line, char *op)
+Math::Vector OpDir(char *line, const char *op)
{
Math::Vector dir;
@@ -940,28 +928,10 @@ Math::Vector OpDir(char *line, char *op)
return dir;
}
-// Reads a color (0 .. 255).
-
-D3DCOLOR OpColor(char *line, char *op, D3DCOLOR def)
-{
- D3DCOLOR color;
-
- line = SearchOp(line, op);
- if ( *line == 0 ) return def;
-
- color = 0;
- color |= (GetInt(line, 0, 0)&0xff)<<16; // r
- color |= (GetInt(line, 1, 0)&0xff)<<8; // g
- color |= (GetInt(line, 2, 0)&0xff)<<0; // b
- color |= (GetInt(line, 3, 0)&0xff)<<24; // a
- return color;
-}
-
// Reads a color (-1 .. 1).
-
-D3DCOLORVALUE OpColorValue(char *line, char *op, D3DCOLORVALUE def)
+Gfx::Color OpColor(char *line, char *op, Gfx::Color def)
{
- D3DCOLORVALUE color;
+ Gfx::Color color;
line = SearchOp(line, op);
if ( *line == 0 ) return def;
diff --git a/src/script/cmdtoken.h b/src/script/cmdtoken.h
index 05ff758..e457d96 100644
--- a/src/script/cmdtoken.h
+++ b/src/script/cmdtoken.h
@@ -18,47 +18,41 @@
#pragma once
-
-#include "old/d3denum.h"
-#include "old/d3dengine.h"
-#include "object/object.h"
-#include "old/water.h"
-#include "old/pyro.h"
-#include "old/camera.h"
+#include "graphics/engine/water.h"
+#include "graphics/engine/engine.h"
+#include "graphics/engine/pyro.h"
// Procedures.
-extern bool Cmd(char *line, char *token);
-extern char* SearchOp(char *line, char *op);
+extern bool Cmd(char *line, const char *token);
+extern char* SearchOp(char *line, const char *op);
extern int GetInt(char *line, int rank, int def);
extern float GetFloat(char *line, int rank, float def);
extern void GetString(char *line, int rank, char *buffer);
extern ObjectType GetTypeObject(char *line, int rank, ObjectType def);
-extern char* GetTypeObject(ObjectType type);
-extern WaterType GetTypeWater(char *line, int rank, WaterType def);
-extern D3DTypeObj GetTypeTerrain(char *line, int rank, D3DTypeObj def);
+extern const char* GetTypeObject(ObjectType type);
+extern Gfx::WaterType GetTypeWater(char *line, int rank, Gfx::WaterType def);
+extern Gfx::EngineObjectType GetTypeTerrain(char *line, int rank, Gfx::EngineObjectType def);
extern int GetBuild(char *line, int rank);
extern int GetResearch(char *line, int rank);
-extern PyroType GetPyro(char *line, int rank);
-extern CameraType GetCamera(char *line, int rank);
-extern char* GetCamera(CameraType type);
+extern Gfx::PyroType GetPyro(char *line, int rank);
+extern Gfx::CameraType GetCamera(char *line, int rank);
+extern const char* GetCamera(Gfx::CameraType type);
-extern int OpInt(char *line, char *op, int def);
-extern float OpFloat(char *line, char *op, float def);
+extern int OpInt(char *line, const char *op, int def);
+extern float OpFloat(char *line, const char *op, float def);
extern void OpString(char *line, char *op, char *buffer);
extern ObjectType OpTypeObject(char *line, char *op, ObjectType def);
-extern WaterType OpTypeWater(char *line, char *op, WaterType def);
-extern D3DTypeObj OpTypeTerrain(char *line, char *op, D3DTypeObj def);
+extern Gfx::WaterType OpTypeWater(char *line, char *op, Gfx::WaterType def);
+extern Gfx::EngineObjectType OpTypeTerrain(char *line, char *op, Gfx::EngineObjectType def);
extern int OpResearch(char *line, char *op);
-extern PyroType OpPyro(char *line, char *op);
-extern CameraType OpCamera(char *line, char *op);
+extern Gfx::PyroType OpPyro(char *line, char *op);
+extern Gfx::CameraType OpCamera(char *line, const char *op);
extern int OpBuild(char *line, char *op);
extern Math::Vector OpPos(char *line, char *op);
-extern Math::Vector OpDir(char *line, char *op);
-extern D3DCOLOR OpColor(char *line, char *op, D3DCOLOR def);
-extern D3DCOLORVALUE OpColorValue(char *line, char *op, D3DCOLORVALUE def);
-
+extern Math::Vector OpDir(char *line, const char *op);
+extern Gfx::Color OpColor(char *line, char *op, Gfx::Color def);
diff --git a/src/script/script.cpp b/src/script/script.cpp
index d9d6444..4f7f1ee 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -17,38 +17,28 @@
// script.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+#include "script/script.h"
-#include "CBot/CBotDll.h"
-#include "common/struct.h"
-#include "math/geometry.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
#include "common/global.h"
-#include "common/event.h"
-#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/math3d.h"
-#include "object/robotmain.h"
-#include "old/terrain.h"
-#include "old/water.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/water.h"
+#include "graphics/engine/text.h"
+#include "math/geometry.h"
+#include "math/vector.h"
#include "object/object.h"
+#include "object/robotmain.h"
+#include "object/task/taskmanager.h"
#include "physics/physics.h"
+#include "script/cbottoken.h"
#include "ui/interface.h"
#include "ui/edit.h"
#include "ui/list.h"
-#include "old/text.h"
#include "ui/displaytext.h"
-#include "object/task/taskmanager.h"
-#include "object/task/task.h"
-#include "object/task/taskmanip.h"
-#include "object/task/taskgoto.h"
-#include "object/task/taskshield.h"
-#include "script/cbottoken.h"
-#include "script/script.h"
+
+
+#include <stdio.h>
@@ -62,7 +52,7 @@ const int ERM_STOP = 1; // if error -> stop
// Compiling a procedure without any parameters.
-CBotTypResult cNull(CBotVar* &var, void* user)
+CBotTypResult CScript::cNull(CBotVar* &var, void* user)
{
if ( var != 0 ) return CBotErrOverParam;
return CBotTypResult(CBotTypFloat);
@@ -70,26 +60,26 @@ CBotTypResult cNull(CBotVar* &var, void* user)
// Compiling a procedure with a single real number.
-CBotTypResult cOneFloat(CBotVar* &var, void* user)
+CBotTypResult CScript::cOneFloat(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
// Compiling a procedure with two real numbers.
-CBotTypResult cTwoFloat(CBotVar* &var, void* user)
+CBotTypResult CScript::cTwoFloat(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -97,26 +87,26 @@ CBotTypResult cTwoFloat(CBotVar* &var, void* user)
// Compiling a procedure with a "dot".
-CBotTypResult cPoint(CBotVar* &var, void* user)
+CBotTypResult CScript::cPoint(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() <= CBotTypDouble )
+ if ( var->GetType() <= CBotTypDouble )
{
- var = var->GivNext();
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
//? if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
-//? if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
-//? var = var->GivNext();
+//? if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+//? var = var->GetNext();
return CBotTypResult(0);
}
- if ( var->GivType() == CBotTypClass )
+ if ( var->GetType() == CBotTypClass )
{
if ( !var->IsElemOfClass("point") ) return CBotTypResult(CBotErrBadParam);
- var = var->GivNext();
+ var = var->GetNext();
return CBotTypResult(0);
}
@@ -125,12 +115,12 @@ CBotTypResult cPoint(CBotVar* &var, void* user)
// Compiling a procedure with a single "point".
-CBotTypResult cOnePoint(CBotVar* &var, void* user)
+CBotTypResult CScript::cOnePoint(CBotVar* &var, void* user)
{
CBotTypResult ret;
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -138,12 +128,12 @@ CBotTypResult cOnePoint(CBotVar* &var, void* user)
// Compiling a procedure with a single string.
-CBotTypResult cString(CBotVar* &var, void* user)
+CBotTypResult CScript::cString(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString &&
- var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString &&
+ var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
@@ -155,8 +145,8 @@ bool FindList(CBotVar* array, int type)
{
while ( array != 0 )
{
- if ( type == array->GivValInt() ) return true;
- array = array->GivNext();
+ if ( type == array->GetValInt() ) return true;
+ array = array->GetNext();
}
return false;
}
@@ -168,40 +158,40 @@ bool GetPoint(CBotVar* &var, int& exception, Math::Vector& pos)
{
CBotVar *pX, *pY, *pZ;
- if ( var->GivType() <= CBotTypDouble )
+ if ( var->GetType() <= CBotTypDouble )
{
- pos.x = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ pos.x = var->GetValFloat()*g_unit;
+ var = var->GetNext();
- pos.z = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ pos.z = var->GetValFloat()*g_unit;
+ var = var->GetNext();
pos.y = 0.0f;
}
else
{
- pX = var->GivItem("x");
+ pX = var->GetItem("x");
if ( pX == NULL )
{
exception = CBotErrUndefItem; return true;
}
- pos.x = pX->GivValFloat()*g_unit;
+ pos.x = pX->GetValFloat()*g_unit;
- pY = var->GivItem("y");
+ pY = var->GetItem("y");
if ( pY == NULL )
{
exception = CBotErrUndefItem; return true;
}
- pos.z = pY->GivValFloat()*g_unit; // attention y -> z !
+ pos.z = pY->GetValFloat()*g_unit; // attention y -> z !
- pZ = var->GivItem("z");
+ pZ = var->GetItem("z");
if ( pZ == NULL )
{
exception = CBotErrUndefItem; return true;
}
- pos.y = pZ->GivValFloat()*g_unit; // attention z -> y !
+ pos.y = pZ->GetValFloat()*g_unit; // attention z -> y !
- var = var->GivNext();
+ var = var->GetNext();
}
return true;
}
@@ -209,33 +199,33 @@ bool GetPoint(CBotVar* &var, int& exception, Math::Vector& pos)
// Instruction "sin(degrees)".
-bool rSin(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSin(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(sinf(value*Math::PI/180.0f));
return true;
}
// Instruction "cos(degrees)".
-bool rCos(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rCos(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(cosf(value*Math::PI/180.0f));
return true;
}
// Instruction "tan(degrees)".
-bool rTan(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rTan(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(tanf(value*Math::PI/180.0f));
return true;
}
@@ -246,7 +236,7 @@ bool raSin(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(asinf(value)*180.0f/Math::PI);
return true;
}
@@ -257,7 +247,7 @@ bool raCos(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(acosf(value)*180.0f/Math::PI);
return true;
}
@@ -268,38 +258,38 @@ bool raTan(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(atanf(value)*180.0f/Math::PI);
return true;
}
// Instruction "sqrt(value)".
-bool rSqrt(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSqrt(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(sqrtf(value));
return true;
}
// Instruction "pow(x, y)".
-bool rPow(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPow(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float x, y;
- x = var->GivValFloat();
- var = var->GivNext();
- y = var->GivValFloat();
+ x = var->GetValFloat();
+ var = var->GetNext();
+ y = var->GetValFloat();
result->SetValFloat(powf(x, y));
return true;
}
// Instruction "rand()".
-bool rRand(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rRand(CBotVar* var, CBotVar* result, int& exception, void* user)
{
result->SetValFloat(Math::Rand());
return true;
@@ -307,11 +297,11 @@ bool rRand(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "abs()".
-bool rAbs(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rAbs(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(fabs(value));
return true;
}
@@ -319,11 +309,11 @@ bool rAbs(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "retobject(rank)".
-CBotTypResult cRetObject(CBotVar* &var, void* user)
+CBotTypResult CScript::cGetObject(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypPointer, "object");
@@ -331,22 +321,22 @@ CBotTypResult cRetObject(CBotVar* &var, void* user)
// Instruction "retobject(rank)".
-bool rRetObject(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rGetObject(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject*>(user))->GetRunScript();
CObject* pObj;
int rank;
- rank = var->GivValInt();
+ rank = var->GetValInt();
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, rank);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, rank));
if ( pObj == 0 )
{
result->SetPointer(0);
}
else
{
- result->SetPointer(pObj->RetBotVar());
+ result->SetPointer(pObj->GetBotVar());
}
return true;
}
@@ -354,24 +344,24 @@ bool rRetObject(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "search(type, pos)".
-CBotTypResult cSearch(CBotVar* &var, void* user)
+CBotTypResult CScript::cSearch(CBotVar* &var, void* user)
{
CBotVar* array;
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
if ( array == 0 ) return CBotTypResult(CBotTypPointer);
- if ( array->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ if ( array->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
}
- else if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ else if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 )
{
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
}
@@ -380,9 +370,9 @@ CBotTypResult cSearch(CBotVar* &var, void* user)
// Instruction "search(type, pos)".
-bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CObject *pObj, *pBest;
CBotVar* array;
Math::Vector pos, oPos;
@@ -391,17 +381,17 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
float min, dist;
int type, oType, i;
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
bArray = true;
}
else
{
- type = var->GivValInt();
+ type = var->GetValInt();
bArray = false;
}
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
if ( !GetPoint(var, exception, pos) ) return true;
@@ -412,13 +402,13 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetActif() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
@@ -455,7 +445,7 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( bNearest )
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(pos, oPos);
if ( dist < min )
{
@@ -476,7 +466,7 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
}
else
{
- result->SetPointer(pBest->RetBotVar());
+ result->SetPointer(pBest->GetBotVar());
}
return true;
}
@@ -484,47 +474,47 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of instruction "radar(type, angle, focus, min, max, sens)".
-CBotTypResult cRadar(CBotVar* &var, void* user)
+CBotTypResult CScript::cRadar(CBotVar* &var, void* user)
{
CBotVar* array;
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
if ( array == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( array->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
+ if ( array->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
}
- else if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
- var = var->GivNext();
+ else if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // angle
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // angle
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // focus
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // focus
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // min
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // min
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // max
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // max
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // sense
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // sense
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // filter
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // filter
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
return CBotTypResult(CBotErrOverParam);
}
// Instruction "radar(type, angle, focus, min, max, sens, filter)".
-bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CObject *pObj, *pBest;
CPhysics* physics;
CBotVar* array;
@@ -544,46 +534,46 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var != 0 )
{
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
bArray = true;
}
else
{
- type = var->GivValInt();
+ type = var->GetValInt();
bArray = false;
}
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- angle = -var->GivValFloat()*Math::PI/180.0f;
+ angle = -var->GetValFloat()*Math::PI/180.0f;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- focus = var->GivValFloat()*Math::PI/180.0f;
+ focus = var->GetValFloat()*Math::PI/180.0f;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- minDist = var->GivValFloat()*g_unit;
+ minDist = var->GetValFloat()*g_unit;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- maxDist = var->GivValFloat()*g_unit;
+ maxDist = var->GetValFloat()*g_unit;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- sens = var->GivValFloat();
+ sens = var->GetValFloat();
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- filter = (RadarFilter)var->GivValInt();
+ filter = static_cast<RadarFilter>(var->GetValInt());
}
}
}
@@ -592,8 +582,8 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
}
}
- iPos = pThis->RetPosition(0);
- iAngle = pThis->RetAngleY(0)+angle;
+ iPos = pThis->GetPosition(0);
+ iAngle = pThis->GetAngleY(0)+angle;
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
if ( sens >= 0.0f ) best = 100000.0f;
@@ -601,15 +591,15 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == pThis ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
@@ -637,13 +627,13 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( filter == FILTER_ONLYLANDING )
{
- physics = pObj->RetPhysics();
- if ( physics != 0 && !physics->RetLand() ) continue;
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && !physics->GetLand() ) continue;
}
if ( filter == FILTER_ONLYFLYING )
{
- physics = pObj->RetPhysics();
- if ( physics != 0 && physics->RetLand() ) continue;
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && physics->GetLand() ) continue;
}
if ( bArray )
@@ -655,7 +645,7 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( type != oType && type != OBJECT_NULL ) continue;
}
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
d = Math::DistanceProjected(iPos, oPos);
if ( d < minDist || d > maxDist ) continue; // too close or too far?
@@ -688,7 +678,7 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
}
else
{
- result->SetPointer(pBest->RetBotVar());
+ result->SetPointer(pBest->GetBotVar());
}
return true;
}
@@ -696,7 +686,7 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
// Monitoring a task.
-bool Process(CScript* script, CBotVar* result, int &exception)
+bool CScript::Process(CScript* script, CBotVar* result, int &exception)
{
Error err;
@@ -726,21 +716,21 @@ bool Process(CScript* script, CBotVar* result, int &exception)
// Compilation of the instruction "detect(type)".
-CBotTypResult cDetect(CBotVar* &var, void* user)
+CBotTypResult CScript::cDetect(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypBoolean);
}
// Instruction "detect(type)".
-bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CObject *pObj, *pGoal, *pBest;
CPhysics* physics;
CBotVar* array;
@@ -765,20 +755,20 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var != 0 )
{
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
bArray = true;
}
else
{
- type = var->GivValInt();
+ type = var->GetValInt();
bArray = false;
}
}
- iPos = pThis->RetPosition(0);
- iAngle = pThis->RetAngleY(0)+angle;
+ iPos = pThis->GetPosition(0);
+ iAngle = pThis->GetAngleY(0)+angle;
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
bGoal = 100000.0f;
@@ -788,15 +778,15 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == pThis ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
@@ -824,13 +814,13 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( filter == FILTER_ONLYLANDING )
{
- physics = pObj->RetPhysics();
- if ( physics != 0 && !physics->RetLand() ) continue;
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && !physics->GetLand() ) continue;
}
if ( filter == FILTER_ONLYFLYING )
{
- physics = pObj->RetPhysics();
- if ( physics != 0 && physics->RetLand() ) continue;
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && physics->GetLand() ) continue;
}
if ( bArray )
@@ -842,7 +832,7 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( type != oType && type != OBJECT_NULL ) continue;
}
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
d = Math::DistanceProjected(iPos, oPos);
a = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
@@ -911,13 +901,13 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "direction(pos)".
-CBotTypResult cDirection(CBotVar* &var, void* user)
+CBotTypResult CScript::cDirection(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -925,18 +915,17 @@ CBotTypResult cDirection(CBotVar* &var, void* user)
// Instruction "direction(pos)".
-bool rDirection(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDirection(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
Math::Vector iPos, oPos;
- float a, g;
+ float a, g;
if ( !GetPoint(var, exception, oPos) ) return true;
- iPos = pThis->RetPosition(0);
+ iPos = pThis->GetPosition(0);
- a = pThis->RetAngleY(0);
+ a = pThis->GetAngleY(0);
g = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
result->SetValFloat(-Math::Direction(a, g)*180.0f/Math::PI);
@@ -946,25 +935,25 @@ bool rDirection(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "produce(pos, angle, type, scriptName)".
-CBotTypResult cProduce(CBotVar* &var, void* user)
+CBotTypResult CScript::cProduce(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -973,9 +962,9 @@ CBotTypResult cProduce(CBotVar* &var, void* user)
// Instruction "produce(pos, angle, type, scriptName)".
-bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CObject* object;
CBotString cbs;
const char* name;
@@ -985,13 +974,13 @@ bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( !GetPoint(var, exception, pos) ) return true;
- angle = var->GivValFloat()*Math::PI/180.0f;
- var = var->GivNext();
+ angle = var->GetValFloat()*Math::PI/180.0f;
+ var = var->GetNext();
- type = (ObjectType)var->GivValInt();
- var = var->GivNext();
+ type = static_cast<ObjectType>(var->GetValInt());
+ var = var->GetNext();
- cbs = var->GivValString();
+ cbs = var->GetValString();
name = cbs;
if ( type == OBJECT_FRET ||
@@ -1054,7 +1043,7 @@ bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
return true;
}
object->SetActivity(false);
- object->ReadProgram(0, (char*)name);
+ object->ReadProgram(0, static_cast<const char*>(name));
object->RunProgram(0);
result->SetValInt(0); // no error
@@ -1064,17 +1053,17 @@ bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "distance(p1, p2)".
-CBotTypResult cDistance(CBotVar* &var, void* user)
+CBotTypResult CScript::cDistance(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -1083,7 +1072,7 @@ CBotTypResult cDistance(CBotVar* &var, void* user)
// Instruction "distance(p1, p2)".
-bool rDistance(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDistance(CBotVar* var, CBotVar* result, int& exception, void* user)
{
Math::Vector p1, p2;
float value;
@@ -1098,7 +1087,7 @@ bool rDistance(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "distance2d(p1, p2)".
-bool rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user)
{
Math::Vector p1, p2;
float value;
@@ -1114,25 +1103,25 @@ bool rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "space(center, rMin, rMax, dist)".
-CBotTypResult cSpace(CBotVar* &var, void* user)
+CBotTypResult CScript::cSpace(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotTypIntrinsic, "point");
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotTypIntrinsic, "point");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypIntrinsic, "point");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypIntrinsic, "point");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypIntrinsic, "point");
@@ -1140,10 +1129,10 @@ CBotTypResult cSpace(CBotVar* &var, void* user)
// Instruction "space(center, rMin, rMax, dist)".
-bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CBotVar* pSub;
Math::Vector center;
float rMin, rMax, dist;
@@ -1154,7 +1143,7 @@ bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var == 0 )
{
- center = pThis->RetPosition(0);
+ center = pThis->GetPosition(0);
}
else
{
@@ -1162,18 +1151,18 @@ bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var != 0 )
{
- rMin = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ rMin = var->GetValFloat()*g_unit;
+ var = var->GetNext();
if ( var != 0 )
{
- rMax = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ rMax = var->GetValFloat()*g_unit;
+ var = var->GetNext();
if ( var != 0 )
{
- dist = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ dist = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
}
}
@@ -1182,13 +1171,13 @@ bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( result != 0 )
{
- pSub = result->GivItemList();
+ pSub = result->GetItemList();
if ( pSub != 0 )
{
pSub->SetValFloat(center.x/g_unit);
- pSub = pSub->GivNext(); // "y"
+ pSub = pSub->GetNext(); // "y"
pSub->SetValFloat(center.z/g_unit);
- pSub = pSub->GivNext(); // "z"
+ pSub = pSub->GetNext(); // "z"
pSub->SetValFloat(center.y/g_unit);
}
}
@@ -1198,17 +1187,17 @@ bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "flatground(center, rMax)".
-CBotTypResult cFlatGround(CBotVar* &var, void* user)
+CBotTypResult CScript::cFlatGround(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -1217,18 +1206,18 @@ CBotTypResult cFlatGround(CBotVar* &var, void* user)
// Instruction "flatground(center, rMax)".
-bool rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
Math::Vector center;
float rMax, dist;
if ( !GetPoint(var, exception, center) ) return true;
- rMax = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ rMax = var->GetValFloat()*g_unit;
+ var = var->GetNext();
- dist = script->m_main->RetFlatZoneRadius(center, rMax, pThis);
+ dist = script->m_main->GetFlatZoneRadius(center, rMax, pThis);
result->SetValFloat(dist/g_unit);
return true;
@@ -1237,9 +1226,9 @@ bool rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "wait(t)".
-bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rWait(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
Error err;
@@ -1248,7 +1237,7 @@ bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- value = var->GivValFloat();
+ value = var->GetValFloat();
err = script->m_primaryTask->StartTaskWait(value);
if ( err != ERR_OK )
{
@@ -1268,9 +1257,9 @@ bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "move(dist)".
-bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rMove(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
Error err;
@@ -1279,7 +1268,7 @@ bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- value = var->GivValFloat();
+ value = var->GetValFloat();
err = script->m_primaryTask->StartTaskAdvance(value*g_unit);
if ( err != ERR_OK )
{
@@ -1299,9 +1288,9 @@ bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "turn(angle)".
-bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rTurn(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
Error err;
@@ -1310,7 +1299,7 @@ bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- value = var->GivValFloat();
+ value = var->GetValFloat();
err = script->m_primaryTask->StartTaskTurn(-value*Math::PI/180.0f);
if ( err != ERR_OK )
{
@@ -1330,25 +1319,25 @@ bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "goto(pos, altitude, crash, goal)".
-CBotTypResult cGoto(CBotVar* &var, void* user)
+CBotTypResult CScript::cGoto(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
@@ -1356,9 +1345,9 @@ CBotTypResult cGoto(CBotVar* &var, void* user)
// Instruction "goto(pos, altitude, mode)".
-bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rGoto(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Math::Vector pos;
TaskGotoGoal goal;
TaskGotoCrash crash;
@@ -1378,17 +1367,17 @@ bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var != 0 )
{
- altitude = var->GivValFloat()*g_unit;
+ altitude = var->GetValFloat()*g_unit;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- goal = (TaskGotoGoal)var->GivValInt();
+ goal = static_cast<TaskGotoGoal>(var->GetValInt());
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- crash = (TaskGotoCrash)var->GivValInt();
+ crash = static_cast<TaskGotoCrash>(var->GetValInt());
}
}
}
@@ -1412,19 +1401,19 @@ bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "find(type)".
-bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Math::Vector pos;
TaskGotoGoal goal;
TaskGotoCrash crash;
float altitude;
Error err;
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
CObject *pObj, *pBest;
CBotVar* array;
Math::Vector iPos, oPos;
- float best, minDist, maxDist, sens, iAngle, angle, focus, d, a;
+ float best, minDist, maxDist, iAngle, focus, d, a;
int type, oType, i;
bool bArray;
@@ -1433,20 +1422,18 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
type = OBJECT_NULL;
- angle = 0.0f;
focus = Math::PI*2.0f;
minDist = 0.0f*g_unit;
maxDist = 1000.0f*g_unit;
- sens = 1.0f;
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
bArray = true;
}
else
{
- type = var->GivValInt();
+ type = var->GetValInt();
bArray = false;
}
@@ -1454,15 +1441,15 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == pThis ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
@@ -1497,7 +1484,7 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( type != oType && type != OBJECT_NULL ) continue;
}
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
d = Math::DistanceProjected(iPos, oPos);
if ( d < minDist || d > maxDist ) continue; // too close or too far?
@@ -1528,7 +1515,7 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
return false;
}
- pos = pBest->RetPosition(0);
+ pos = pBest->GetPosition(0);
goal = TGG_DEFAULT;
crash = TGC_DEFAULT;
altitude = 0.0f*g_unit;
@@ -1553,21 +1540,21 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation "grab/drop(oper)".
-CBotTypResult cGrabDrop(CBotVar* &var, void* user)
+CBotTypResult CScript::cGrabDrop(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
// Instruction "grab(oper)".
-bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rGrab(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
ObjectType oType;
TaskManipArm type;
Error err;
@@ -1577,10 +1564,16 @@ bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- if ( var == 0 ) type = TMA_FFRONT;
- else type = (TaskManipArm)var->GivValInt();
+ if ( var == 0 )
+ {
+ type = TMA_FFRONT;
+ }
+ else
+ {
+ type = static_cast<TaskManipArm>(var->GetValInt());
+ }
- oType = pThis->RetType();
+ oType = pThis->GetType();
if ( oType == OBJECT_HUMAN ||
oType == OBJECT_TECH )
{
@@ -1609,10 +1602,10 @@ bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "drop(oper)".
-bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDrop(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
ObjectType oType;
TaskManipArm type;
Error err;
@@ -1623,9 +1616,9 @@ bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user)
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
if ( var == 0 ) type = TMA_FFRONT;
- else type = (TaskManipArm)var->GivValInt();
+ else type = static_cast<TaskManipArm>(var->GetValInt());
- oType = pThis->RetType();
+ oType = pThis->GetType();
if ( oType == OBJECT_HUMAN ||
oType == OBJECT_TECH )
{
@@ -1654,9 +1647,9 @@ bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "sniff()".
-bool rSniff(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSniff(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Error err;
exception = 0;
@@ -1683,15 +1676,15 @@ bool rSniff(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "receive(nom, power)".
-CBotTypResult cReceive(CBotVar* &var, void* user)
+CBotTypResult CScript::cReceive(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -1699,10 +1692,10 @@ CBotTypResult cReceive(CBotVar* &var, void* user)
// Instruction "receive(nom, power)".
-bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CBotString cbs;
Error err;
const char* p;
@@ -1714,18 +1707,18 @@ bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- var = var->GivNext();
+ var = var->GetNext();
power = 10.0f*g_unit;
if ( var != 0 )
{
- power = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ power = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
- err = script->m_primaryTask->StartTaskInfo((char*)p, 0.0f, power, false);
+ err = script->m_primaryTask->StartTaskInfo(static_cast<const char*>(p), 0.0f, power, false);
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -1736,7 +1729,7 @@ bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
}
if ( !Process(script, result, exception) ) return false; // not finished
- value = pThis->RetInfoReturn();
+ value = pThis->GetInfoReturn();
if ( value == NAN )
{
result->SetInit(IS_NAN);
@@ -1750,19 +1743,19 @@ bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "send(nom, value, power)".
-CBotTypResult cSend(CBotVar* &var, void* user)
+CBotTypResult CScript::cSend(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -1770,10 +1763,9 @@ CBotTypResult cSend(CBotVar* &var, void* user)
// Instruction "send(nom, value, power)".
-bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSend(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CBotString cbs;
Error err;
const char* p;
@@ -1785,21 +1777,21 @@ bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user)
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- var = var->GivNext();
+ var = var->GetNext();
- value = var->GivValFloat();
- var = var->GivNext();
+ value = var->GetValFloat();
+ var = var->GetNext();
power = 10.0f*g_unit;
if ( var != 0 )
{
- power = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ power = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
- err = script->m_primaryTask->StartTaskInfo((char*)p, value, power, true);
+ err = script->m_primaryTask->StartTaskInfo(static_cast<const char*>(p), value, power, true);
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -1818,7 +1810,7 @@ bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user)
// Seeks the nearest information terminal.
-CObject* SearchInfo(CScript* script, CObject* object, float power)
+CObject* CScript::SearchInfo(CScript* script, CObject* object, float power)
{
CObject *pObj, *pBest;
Math::Vector iPos, oPos;
@@ -1826,21 +1818,21 @@ CObject* SearchInfo(CScript* script, CObject* object, float power)
float dist, min;
int i;
- iPos = object->RetPosition(0);
+ iPos = object->GetPosition(0);
min = 100000.0f;
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_INFO ) continue;
- if ( !pObj->RetActif() ) continue;
+ if ( !pObj->GetActif() ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, iPos);
if ( dist > power ) continue; // too far?
if ( dist < min )
@@ -1855,15 +1847,15 @@ CObject* SearchInfo(CScript* script, CObject* object, float power)
// Compilation of the instruction "deleteinfo(nom, power)".
-CBotTypResult cDeleteInfo(CBotVar* &var, void* user)
+CBotTypResult CScript::cDeleteInfo(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -1871,10 +1863,10 @@ CBotTypResult cDeleteInfo(CBotVar* &var, void* user)
// Instruction "deleteinfo(nom, power)".
-bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CObject* pInfo;
CBotString cbs;
Info info;
@@ -1884,15 +1876,15 @@ bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
exception = 0;
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- var = var->GivNext();
+ var = var->GetNext();
power = 10.0f*g_unit;
if ( var != 0 )
{
- power = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ power = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
pInfo = SearchInfo(script, pThis, power);
@@ -1902,10 +1894,10 @@ bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
return true;
}
- total = pInfo->RetInfoTotal();
+ total = pInfo->GetInfoTotal();
for ( i=0 ; i<total ; i++ )
{
- info = pInfo->RetInfo(i);
+ info = pInfo->GetInfo(i);
if ( strcmp(info.name, p) == 0 )
{
pInfo->DeleteInfo(i);
@@ -1919,15 +1911,15 @@ bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "testinfo(nom, power)".
-CBotTypResult cTestInfo(CBotVar* &var, void* user)
+CBotTypResult CScript::cTestInfo(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypBoolean);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypBoolean);
@@ -1935,10 +1927,10 @@ CBotTypResult cTestInfo(CBotVar* &var, void* user)
// Instruction "testinfo(nom, power)".
-bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CObject* pInfo;
CBotString cbs;
Info info;
@@ -1948,15 +1940,15 @@ bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
exception = 0;
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- var = var->GivNext();
+ var = var->GetNext();
power = 10.0f*g_unit;
if ( var != 0 )
{
- power = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ power = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
pInfo = SearchInfo(script, pThis, power);
@@ -1966,10 +1958,10 @@ bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
return true;
}
- total = pInfo->RetInfoTotal();
+ total = pInfo->GetInfoTotal();
for ( i=0 ; i<total ; i++ )
{
- info = pInfo->RetInfo(i);
+ info = pInfo->GetInfo(i);
if ( strcmp(info.name, p) == 0 )
{
result->SetValInt(true);
@@ -1982,9 +1974,9 @@ bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "thump()".
-bool rThump(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rThump(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Error err;
exception = 0;
@@ -2011,9 +2003,9 @@ bool rThump(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "recycle()".
-bool rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Error err;
exception = 0;
@@ -2040,15 +2032,15 @@ bool rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation "shield(oper, radius)".
-CBotTypResult cShield(CBotVar* &var, void* user)
+CBotTypResult CScript::cShield(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -2057,17 +2049,17 @@ CBotTypResult cShield(CBotVar* &var, void* user)
// Instruction "shield(oper, radius)".
-bool rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
float oper, radius;
Error err;
- oper = var->GivValFloat(); // 0=down, 1=up
- var = var->GivNext();
+ oper = var->GetValFloat(); // 0=down, 1=up
+ var = var->GetNext();
- radius = var->GivValFloat();
+ radius = var->GetValFloat();
if ( radius < 10.0f ) radius = 10.0f;
if ( radius > 25.0f ) radius = 25.0f;
radius = (radius-10.0f)/15.0f;
@@ -2111,13 +2103,13 @@ bool rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation "fire(delay)".
-CBotTypResult cFire(CBotVar* &var, void* user)
+CBotTypResult CScript::cFire(CBotVar* &var, void* user)
{
#if 0
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
ObjectType type;
- type = pThis->RetType();
+ type = pThis->GetType();
if ( type == OBJECT_ANT )
{
@@ -2130,8 +2122,8 @@ CBotTypResult cFire(CBotVar* &var, void* user)
else
{
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
@@ -2142,10 +2134,10 @@ CBotTypResult cFire(CBotVar* &var, void* user)
// Instruction "fire(delay)".
-bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
float delay;
Math::Vector impact;
Error err;
@@ -2157,12 +2149,12 @@ bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- type = pThis->RetType();
+ type = pThis->GetType();
if ( type == OBJECT_ANT )
{
if ( !GetPoint(var, exception, impact) ) return true;
- impact.y += pThis->RetWaterLevel();
+ impact.y += pThis->GetWaterLevel();
err = script->m_primaryTask->StartTaskFireAnt(impact);
}
else if ( type == OBJECT_SPIDER )
@@ -2172,7 +2164,7 @@ bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
else
{
if ( var == 0 ) delay = 0.0f;
- else delay = var->GivValFloat();
+ else delay = var->GetValFloat();
err = script->m_primaryTask->StartTaskFire(delay);
}
@@ -2189,9 +2181,9 @@ bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "aim(dir)".
-bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
Error err;
@@ -2200,7 +2192,7 @@ bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- value = var->GivValFloat();
+ value = var->GetValFloat();
err = script->m_primaryTask->StartTaskGunGoal(value*Math::PI/180.0f, 0.0f);
if ( err != ERR_OK )
{
@@ -2215,15 +2207,15 @@ bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "motor(left, right)".
-CBotTypResult cMotor(CBotVar* &var, void* user)
+CBotTypResult CScript::cMotor(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -2232,15 +2224,15 @@ CBotTypResult cMotor(CBotVar* &var, void* user)
// Instruction "motor(left, right)".
-bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CObject* pThis = (CObject*)user;
- CPhysics* physics = ((CObject*)user)->RetPhysics();
+ CObject* pThis = static_cast<CObject *>(user);
+ CPhysics* physics = (static_cast<CObject *>(user))->GetPhysics();
float left, right, speed, turn;
- left = var->GivValFloat();
- var = var->GivNext();
- right = var->GivValFloat();
+ left = var->GetValFloat();
+ var = var->GetNext();
+ right = var->GetValFloat();
speed = (left+right)/2.0f;
if ( speed < -1.0f ) speed = -1.0f;
@@ -2250,7 +2242,7 @@ bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( turn < -1.0f ) turn = -1.0f;
if ( turn > 1.0f ) turn = 1.0f;
- if ( pThis->RetFixed() ) // ant on the back?
+ if ( pThis->GetFixed() ) // ant on the back?
{
speed = 0.0f;
turn = 0.0f;
@@ -2264,12 +2256,12 @@ bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "jet(power)".
-bool rJet(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rJet(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CPhysics* physics = ((CObject*)user)->RetPhysics();
+ CPhysics* physics = (static_cast<CObject *>(user))->GetPhysics();
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
physics->SetMotorSpeedY(value);
return true;
@@ -2277,13 +2269,13 @@ bool rJet(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "topo(pos)".
-CBotTypResult cTopo(CBotVar* &var, void* user)
+CBotTypResult CScript::cTopo(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ ret = CScript::cPoint(var, user);
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
@@ -2291,9 +2283,9 @@ CBotTypResult cTopo(CBotVar* &var, void* user)
// Instruction "topo(pos)".
-bool rTopo(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rTopo(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Math::Vector pos;
float level;
@@ -2301,24 +2293,24 @@ bool rTopo(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( !GetPoint(var, exception, pos) ) return true;
- level = script->m_terrain->RetFloorLevel(pos);
- level -= script->m_water->RetLevel();
+ level = script->m_terrain->GetFloorLevel(pos);
+ level -= script->m_water->GetLevel();
result->SetValFloat(level/g_unit);
return true;
}
// Compilation of the instruction "message(string, type)".
-CBotTypResult cMessage(CBotVar* &var, void* user)
+CBotTypResult CScript::cMessage(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString &&
- var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString &&
+ var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
@@ -2326,40 +2318,39 @@ CBotTypResult cMessage(CBotVar* &var, void* user)
// Instruction "message(string, type)".
-bool rMessage(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rMessage(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CBotString cbs;
const char* p;
- TextType type;
+ Ui::TextType type;
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- type = TT_MESSAGE;
- var = var->GivNext();
+ type = Ui::TT_MESSAGE;
+ var = var->GetNext();
if ( var != 0 )
{
- type = (TextType)var->GivValInt();
+ type = static_cast<Ui::TextType>(var->GetValInt());
}
- script->m_displayText->DisplayText((char*)p, script->m_object, 10.0f, type);
- script->m_main->CheckEndMessage((char*)p);
+ script->m_displayText->DisplayText(p, script->m_object, 10.0f, type);
+ script->m_main->CheckEndMessage(p);
return true;
}
// Instruction "cmdline(rank)".
-bool rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
float value;
int rank;
- rank = var->GivValInt();
- value = pThis->RetCmdLine(rank);
+ rank = var->GetValInt();
+ value = pThis->GetCmdLine(rank);
result->SetValFloat(value);
return true;
@@ -2367,12 +2358,12 @@ bool rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "ismovie()".
-bool rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
- value = script->m_main->RetMovieLock()?1.0f:0.0f;
+ value = script->m_main->GetMovieLock()?1.0f:0.0f;
result->SetValFloat(value);
return true;
@@ -2380,12 +2371,12 @@ bool rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "errmode(mode)".
-bool rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
int value;
- value = var->GivValInt();
+ value = var->GetValInt();
if ( value < 0 ) value = 0;
if ( value > 1 ) value = 1;
script->m_errMode = value;
@@ -2395,12 +2386,12 @@ bool rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "ipf(num)".
-bool rIPF(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rIPF(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
int value;
- value = var->GivValInt();
+ value = var->GetValInt();
if ( value < 1 ) value = 1;
if ( value > 10000 ) value = 10000;
script->m_ipf = value;
@@ -2410,12 +2401,12 @@ bool rIPF(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "abstime()".
-bool rAbsTime(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rAbsTime(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
- value = script->m_main->RetGameTime();
+ value = script->m_main->GetGameTime();
result->SetValFloat(value);
return true;
}
@@ -2450,33 +2441,32 @@ void PrepareFilename(CBotString &filename, char *dir)
// Instruction "deletefile(filename)".
-bool rDeleteFile(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDeleteFile(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CBotString cbs;
- const char* p;
+ const char* filename;
char* dir;
- cbs = var->GivValString();
- dir = script->m_main->RetFilesDir();
+ cbs = var->GetValString();
+ dir = script->m_main->GetFilesDir();
PrepareFilename(cbs, dir);
- p = cbs;
- DeleteFile(p);
-
- return true;
+ filename = cbs;
+ //std function that removes file.
+ return (!remove(filename));
}
// Compilation of the instruction "pendown(color, width)".
-CBotTypResult cPenDown(CBotVar* &var, void* user)
+CBotTypResult CScript::cPenDown(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
@@ -2484,15 +2474,15 @@ CBotTypResult cPenDown(CBotVar* &var, void* user)
// Instruction "pendown(color, width)".
-bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
int color;
float width;
Error err;
- if ( pThis->RetType() == OBJECT_MOBILEdr )
+ if ( pThis->GetType() == OBJECT_MOBILEdr )
{
exception = 0;
@@ -2500,15 +2490,15 @@ bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
{
if ( var != 0 )
{
- color = var->GivValInt();
+ color = var->GetValInt();
if ( color < 0 ) color = 0;
if ( color > 17 ) color = 17;
pThis->SetTraceColor(color);
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- width = var->GivValFloat();
+ width = var->GetValFloat();
if ( width < 0.1f ) width = 0.1f;
if ( width > 1.0f ) width = 1.0f;
pThis->SetTraceWidth(width);
@@ -2517,7 +2507,7 @@ bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
pThis->SetTraceDown(true);
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- err = script->m_primaryTask->StartTaskPen(pThis->RetTraceDown(), pThis->RetTraceColor());
+ err = script->m_primaryTask->StartTaskPen(pThis->GetTraceDown(), pThis->GetTraceColor());
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -2537,15 +2527,15 @@ bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
{
if ( var != 0 )
{
- color = var->GivValInt();
+ color = var->GetValInt();
if ( color < 0 ) color = 0;
if ( color > 17 ) color = 17;
pThis->SetTraceColor(color);
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- width = var->GivValFloat();
+ width = var->GetValFloat();
if ( width < 0.1f ) width = 0.1f;
if ( width > 1.0f ) width = 1.0f;
pThis->SetTraceWidth(width);
@@ -2559,13 +2549,13 @@ bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "penup()".
-bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
Error err;
- if ( pThis->RetType() == OBJECT_MOBILEdr )
+ if ( pThis->GetType() == OBJECT_MOBILEdr )
{
exception = 0;
@@ -2574,7 +2564,7 @@ bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user)
pThis->SetTraceDown(false);
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- err = script->m_primaryTask->StartTaskPen(pThis->RetTraceDown(), pThis->RetTraceColor());
+ err = script->m_primaryTask->StartTaskPen(pThis->GetTraceDown(), pThis->GetTraceColor());
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -2599,27 +2589,26 @@ bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "pencolor()".
-bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CPhysics* physics = ((CObject*)user)->RetPhysics();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
int color;
Error err;
- if ( pThis->RetType() == OBJECT_MOBILEdr )
+ if ( pThis->GetType() == OBJECT_MOBILEdr )
{
exception = 0;
if ( script->m_primaryTask == 0 ) // no task in progress?
{
- color = var->GivValInt();
+ color = var->GetValInt();
if ( color < 0 ) color = 0;
if ( color > 17 ) color = 17;
pThis->SetTraceColor(color);
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- err = script->m_primaryTask->StartTaskPen(pThis->RetTraceDown(), pThis->RetTraceColor());
+ err = script->m_primaryTask->StartTaskPen(pThis->GetTraceDown(), pThis->GetTraceColor());
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -2637,7 +2626,7 @@ bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user)
}
else
{
- color = var->GivValInt();
+ color = var->GetValInt();
if ( color < 0 ) color = 0;
if ( color > 17 ) color = 17;
pThis->SetTraceColor(color);
@@ -2648,12 +2637,12 @@ bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "penwidth()".
-bool rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
float width;
- width = var->GivValFloat();
+ width = var->GetValFloat();
if ( width < 0.1f ) width = 0.1f;
if ( width > 1.0f ) width = 1.0f;
pThis->SetTraceWidth(width);
@@ -2669,15 +2658,13 @@ CScript::CScript(CInstanceManager* iMan, CObject* object, CTaskManager** seconda
m_iMan = iMan;
m_iMan->AddInstance(CLASS_SCRIPT, this, 100);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_botProg = 0;
- m_object = object;
- m_primaryTask = 0;
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_botProg = 0;
+ m_object = object;
+ m_primaryTask = 0;
m_secondaryTask = secondaryTask;
m_ipf = CBOT_IPF;
@@ -2697,58 +2684,58 @@ CScript::CScript(CInstanceManager* iMan, CObject* object, CTaskManager** seconda
void CScript::InitFonctions()
{
- CBotProgram::AddFunction("sin", rSin, cOneFloat);
- CBotProgram::AddFunction("cos", rCos, cOneFloat);
- CBotProgram::AddFunction("tan", rTan, cOneFloat);
- CBotProgram::AddFunction("asin", raSin, cOneFloat);
- CBotProgram::AddFunction("acos", raCos, cOneFloat);
- CBotProgram::AddFunction("atan", raTan, cOneFloat);
- CBotProgram::AddFunction("sqrt", rSqrt, cOneFloat);
- CBotProgram::AddFunction("pow", rPow, cTwoFloat);
- CBotProgram::AddFunction("rand", rRand, cNull);
- CBotProgram::AddFunction("abs", rAbs, cOneFloat);
-
- CBotProgram::AddFunction("retobject", rRetObject, cRetObject);
- CBotProgram::AddFunction("search", rSearch, cSearch);
- CBotProgram::AddFunction("radar", rRadar, cRadar);
- CBotProgram::AddFunction("detect", rDetect, cDetect);
- CBotProgram::AddFunction("direction", rDirection, cDirection);
- CBotProgram::AddFunction("produce", rProduce, cProduce);
- CBotProgram::AddFunction("distance", rDistance, cDistance);
- CBotProgram::AddFunction("distance2d",rDistance2d,cDistance);
- CBotProgram::AddFunction("space", rSpace, cSpace);
- CBotProgram::AddFunction("flatground",rFlatGround,cFlatGround);
- CBotProgram::AddFunction("wait", rWait, cOneFloat);
- CBotProgram::AddFunction("move", rMove, cOneFloat);
- CBotProgram::AddFunction("turn", rTurn, cOneFloat);
- CBotProgram::AddFunction("goto", rGoto, cGoto);
- CBotProgram::AddFunction("find", rFind, cOneFloat);
- CBotProgram::AddFunction("grab", rGrab, cGrabDrop);
- CBotProgram::AddFunction("drop", rDrop, cGrabDrop);
- CBotProgram::AddFunction("sniff", rSniff, cNull);
- CBotProgram::AddFunction("receive", rReceive, cReceive);
- CBotProgram::AddFunction("send", rSend, cSend);
- CBotProgram::AddFunction("deleteinfo",rDeleteInfo,cDeleteInfo);
- CBotProgram::AddFunction("testinfo", rTestInfo, cTestInfo);
- CBotProgram::AddFunction("thump", rThump, cNull);
- CBotProgram::AddFunction("recycle", rRecycle, cNull);
- CBotProgram::AddFunction("shield", rShield, cShield);
- CBotProgram::AddFunction("fire", rFire, cFire);
- CBotProgram::AddFunction("aim", rAim, cOneFloat);
- CBotProgram::AddFunction("motor", rMotor, cMotor);
- CBotProgram::AddFunction("jet", rJet, cOneFloat);
- CBotProgram::AddFunction("topo", rTopo, cTopo);
- CBotProgram::AddFunction("message", rMessage, cMessage);
- CBotProgram::AddFunction("cmdline", rCmdline, cOneFloat);
- CBotProgram::AddFunction("ismovie", rIsMovie, cNull);
- CBotProgram::AddFunction("errmode", rErrMode, cOneFloat);
- CBotProgram::AddFunction("ipf", rIPF, cOneFloat);
- CBotProgram::AddFunction("abstime", rAbsTime, cNull);
- CBotProgram::AddFunction("deletefile",rDeleteFile,cString);
- CBotProgram::AddFunction("pendown", rPenDown, cPenDown);
- CBotProgram::AddFunction("penup", rPenUp, cNull);
- CBotProgram::AddFunction("pencolor", rPenColor, cOneFloat);
- CBotProgram::AddFunction("penwidth", rPenWidth, cOneFloat);
+ CBotProgram::AddFunction("sin", rSin, CScript::cOneFloat);
+ CBotProgram::AddFunction("cos", rCos, CScript::cOneFloat);
+ CBotProgram::AddFunction("tan", rTan, CScript::cOneFloat);
+ CBotProgram::AddFunction("asin", raSin, CScript::cOneFloat);
+ CBotProgram::AddFunction("acos", raCos, CScript::cOneFloat);
+ CBotProgram::AddFunction("atan", raTan, CScript::cOneFloat);
+ CBotProgram::AddFunction("sqrt", rSqrt, CScript::cOneFloat);
+ CBotProgram::AddFunction("pow", rPow, CScript::cTwoFloat);
+ CBotProgram::AddFunction("rand", rRand, CScript::cNull);
+ CBotProgram::AddFunction("abs", rAbs, CScript::cOneFloat);
+
+ CBotProgram::AddFunction("retobject", rGetObject, CScript::cGetObject);
+ CBotProgram::AddFunction("search", rSearch, CScript::cSearch);
+ CBotProgram::AddFunction("radar", rRadar, CScript::cRadar);
+ CBotProgram::AddFunction("detect", rDetect, CScript::cDetect);
+ CBotProgram::AddFunction("direction", rDirection, CScript::cDirection);
+ CBotProgram::AddFunction("produce", rProduce, CScript::cProduce);
+ CBotProgram::AddFunction("distance", rDistance, CScript::cDistance);
+ CBotProgram::AddFunction("distance2d",rDistance2d,CScript::cDistance);
+ CBotProgram::AddFunction("space", rSpace, CScript::cSpace);
+ CBotProgram::AddFunction("flatground",rFlatGround,CScript::cFlatGround);
+ CBotProgram::AddFunction("wait", rWait, CScript::cOneFloat);
+ CBotProgram::AddFunction("move", rMove, CScript::cOneFloat);
+ CBotProgram::AddFunction("turn", rTurn, CScript::cOneFloat);
+ CBotProgram::AddFunction("goto", rGoto, CScript::cGoto);
+ CBotProgram::AddFunction("find", rFind, CScript::cOneFloat);
+ CBotProgram::AddFunction("grab", rGrab, CScript::cGrabDrop);
+ CBotProgram::AddFunction("drop", rDrop, CScript::cGrabDrop);
+ CBotProgram::AddFunction("sniff", rSniff, CScript::cNull);
+ CBotProgram::AddFunction("receive", rReceive, CScript::cReceive);
+ CBotProgram::AddFunction("send", rSend, CScript::cSend);
+ CBotProgram::AddFunction("deleteinfo",rDeleteInfo,CScript::cDeleteInfo);
+ CBotProgram::AddFunction("testinfo", rTestInfo, CScript::cTestInfo);
+ CBotProgram::AddFunction("thump", rThump, CScript::cNull);
+ CBotProgram::AddFunction("recycle", rRecycle, CScript::cNull);
+ CBotProgram::AddFunction("shield", rShield, CScript::cShield);
+ CBotProgram::AddFunction("fire", rFire, CScript::cFire);
+ CBotProgram::AddFunction("aim", rAim, CScript::cOneFloat);
+ CBotProgram::AddFunction("motor", rMotor, CScript::cMotor);
+ CBotProgram::AddFunction("jet", rJet, CScript::cOneFloat);
+ CBotProgram::AddFunction("topo", rTopo, CScript::cTopo);
+ CBotProgram::AddFunction("message", rMessage, CScript::cMessage);
+ CBotProgram::AddFunction("cmdline", rCmdline, CScript::cOneFloat);
+ CBotProgram::AddFunction("ismovie", rIsMovie, CScript::cNull);
+ CBotProgram::AddFunction("errmode", rErrMode, CScript::cOneFloat);
+ CBotProgram::AddFunction("ipf", rIPF, CScript::cOneFloat);
+ CBotProgram::AddFunction("abstime", rAbsTime, CScript::cNull);
+ CBotProgram::AddFunction("deletefile",rDeleteFile,CScript::cString);
+ CBotProgram::AddFunction("pendown", rPenDown, CScript::cPenDown);
+ CBotProgram::AddFunction("penup", rPenUp, CScript::cNull);
+ CBotProgram::AddFunction("pencolor", rPenColor, CScript::cOneFloat);
+ CBotProgram::AddFunction("penwidth", rPenWidth, CScript::cOneFloat);
}
// Object's destructor.
@@ -2767,7 +2754,7 @@ CScript::~CScript()
// Gives the script editable block of text.
-void CScript::PutScript(CEdit* edit, char* name)
+void CScript::PutScript(Ui::CEdit* edit, char* name)
{
if ( m_script == 0 )
{
@@ -2784,15 +2771,15 @@ void CScript::PutScript(CEdit* edit, char* name)
// The script takes a paved text.
-bool CScript::GetScript(CEdit* edit)
+bool CScript::GetScript(Ui::CEdit* edit)
{
int len;
delete m_script;
m_script = 0;
- len = edit->RetTextLength();
- m_script = (char*)malloc(sizeof(char)*(len+1));
+ len = edit->GetTextLength();
+ m_script = static_cast<char*>(malloc(sizeof(char)*(len+1)));
edit->GetText(m_script, len+1);
edit->GetCursor(m_cursor2, m_cursor1);
@@ -2819,7 +2806,7 @@ bool CScript::GetScript(CEdit* edit)
// Indicates whether a program is compiled correctly.
-bool CScript::RetCompile()
+bool CScript::GetCompile()
{
return m_bCompile;
}
@@ -2846,17 +2833,17 @@ bool CScript::CheckToken()
CBotToken* bt;
CBotString bs;
const char* token;
- int error, type, cursor1, cursor2, i;
+ int error, cursor1, cursor2, i;
char used[100];
- if ( !m_object->RetCheckToken() ) return true;
+ if ( !m_object->GetCheckToken() ) return true;
m_error = 0;
m_title[0] = 0;
m_token[0] = 0;
m_bCompile = false;
- for ( i=0 ; i<m_main->RetObligatoryToken() ; i++ )
+ for ( i=0 ; i<m_main->GetObligatoryToken() ; i++ )
{
used[i] = 0; // token not used
}
@@ -2864,20 +2851,19 @@ bool CScript::CheckToken()
bt = CBotToken::CompileTokens(m_script, error);
while ( bt != 0 )
{
- bs = bt->GivString();
+ bs = bt->GetString();
token = bs;
- type = bt->GivType();
- cursor1 = bt->GivStart();
- cursor2 = bt->GivEnd();
+ cursor1 = bt->GetStart();
+ cursor2 = bt->GetEnd();
- i = m_main->IsObligatoryToken((char*)token);
+ i = m_main->IsObligatoryToken(token);
if ( i != -1 )
{
used[i] = 1; // token used
}
- if ( !m_main->IsProhibitedToken((char*)token) )
+ if ( !m_main->IsProhibitedToken(token) )
{
m_error = ERR_PROHIBITEDTOKEN;
m_cursor1 = cursor1;
@@ -2887,15 +2873,15 @@ bool CScript::CheckToken()
return false;
}
- bt = bt->GivNext();
+ bt = bt->GetNext();
}
// At least once every obligatory instruction?
- for ( i=0 ; i<m_main->RetObligatoryToken() ; i++ )
+ for ( i=0 ; i<m_main->GetObligatoryToken() ; i++ )
{
if ( used[i] == 0 ) // token not used?
{
- strcpy(m_token, m_main->RetObligatoryToken(i));
+ strcpy(m_token, m_main->GetObligatoryToken(i));
m_error = ERR_OBLIGATORYTOKEN;
strcpy(m_title, "<erreur>");
CBotToken::Delete(bt);
@@ -2930,12 +2916,12 @@ bool CScript::Compile()
if ( m_botProg == 0 )
{
- m_botProg = new CBotProgram(m_object->RetBotVar());
+ m_botProg = new CBotProgram(m_object->GetBotVar());
}
if ( m_botProg->Compile(m_script, liste, this) )
{
- if ( liste.GivSize() == 0 )
+ if ( liste.GetSize() == 0 )
{
strcpy(m_title, "<sans nom>");
}
@@ -3014,7 +3000,7 @@ bool CScript::Run()
if ( m_bStepMode ) // step by step mode?
{
Event newEvent;
- ZeroMemory(&newEvent, sizeof(Event));
+ memset(&newEvent, 0, sizeof(Event));
Step(newEvent);
}
@@ -3054,7 +3040,7 @@ bool CScript::Continue(const Event &event)
{
char s[100];
GetError(s);
- m_displayText->DisplayText(s, m_object, 10.0f, TT_ERROR);
+ m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR);
}
m_engine->SetPause(true); // gives pause
return true;
@@ -3087,7 +3073,7 @@ bool CScript::Continue(const Event &event)
{
char s[100];
GetError(s);
- m_displayText->DisplayText(s, m_object, 10.0f, TT_ERROR);
+ m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR);
}
return true;
}
@@ -3105,7 +3091,7 @@ bool CScript::Step(const Event &event)
if ( !m_bStepMode ) return false;
m_engine->SetPause(false);
- m_engine->StepSimul(0.01f); // advance of 10ms
+ // TODO: m_app StepSimulation??? m_engine->StepSimulation(0.01f); // advance of 10ms
m_engine->SetPause(true);
m_event = event;
@@ -3129,7 +3115,7 @@ bool CScript::Step(const Event &event)
{
char s[100];
GetError(s);
- m_displayText->DisplayText(s, m_object, 10.0f, TT_ERROR);
+ m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR);
}
return true;
}
@@ -3201,7 +3187,7 @@ bool CScript::GetCursor(int &cursor1, int &cursor2)
// Put of the variables in a list.
-void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankList)
+void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, int &rankList)
{
CBotString bs;
CBotVar *svar, *pStatic;
@@ -3221,13 +3207,13 @@ void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankLi
while ( var != 0 )
{
var->Maj(NULL, false);
- pStatic = var->GivStaticVar(); // finds the static element
+ pStatic = var->GetStaticVar(); // finds the static element
- bs = pStatic->GivName(); // variable name
+ bs = pStatic->GetName(); // variable name
p = bs;
//? if ( strcmp(p, "this") == 0 )
//? {
-//? var = var->GivNext();
+//? var = var->GetNext();
//? continue;
//? }
@@ -3247,12 +3233,12 @@ void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankLi
}
}
- type = pStatic->GivType();
+ type = pStatic->GetType();
if ( type < CBotTypBoolean )
{
CBotString value;
- value = pStatic->GivValString();
+ value = pStatic->GetValString();
p = value;
sprintf(buffer, "%s = %s;", varName, p);
list->SetName(rankList++, buffer);
@@ -3260,20 +3246,20 @@ void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankLi
else if ( type == CBotTypString )
{
CBotString value;
- value = pStatic->GivValString();
+ value = pStatic->GetValString();
p = value;
sprintf(buffer, "%s = \"%s\";", varName, p);
list->SetName(rankList++, buffer);
}
else if ( type == CBotTypArrayPointer )
{
- svar = pStatic->GivItemList();
+ svar = pStatic->GetItemList();
PutList(varName, true, svar, list, rankList);
}
else if ( type == CBotTypClass ||
type == CBotTypPointer )
{
- svar = pStatic->GivItemList();
+ svar = pStatic->GetItemList();
PutList(varName, false, svar, list, rankList);
}
else
@@ -3283,13 +3269,13 @@ void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankLi
}
index ++;
- var = var->GivNext();
+ var = var->GetNext();
}
}
// Fills a list with variables.
-void CScript::UpdateList(CList* list)
+void CScript::UpdateList(Ui::CList* list)
{
CBotVar *var;
const char *progName, *funcName;
@@ -3297,8 +3283,8 @@ void CScript::UpdateList(CList* list)
if( m_botProg == 0 ) return;
- total = list->RetTotal();
- select = list->RetSelect();
+ total = list->GetTotal();
+ select = list->GetSelect();
list->Flush(); // empty list
m_botProg->GetRunPos(progName, cursor1, cursor2);
@@ -3308,70 +3294,71 @@ void CScript::UpdateList(CList* list)
rank = 0;
while ( true )
{
- var = m_botProg->GivStackVars(funcName, level--);
+ var = m_botProg->GetStackVars(funcName, level--);
if ( funcName != progName ) break;
PutList("", false, var, list, rank);
}
- if ( total == list->RetTotal() ) // same total?
+ if ( total == list->GetTotal() ) // same total?
{
list->SetSelect(select);
}
list->SetTooltip("");
- list->SetState(STATE_ENABLE);
+ list->SetState(Ui::STATE_ENABLE);
}
// Colorize the text according to syntax.
-void CScript::ColorizeScript(CEdit* edit)
+void CScript::ColorizeScript(Ui::CEdit* edit)
{
CBotToken* bt;
CBotString bs;
const char* token;
- int error, type, cursor1, cursor2, color;
+ int error, type, cursor1, cursor2;
+ Gfx::FontHighlight color;
edit->ClearFormat();
- bt = CBotToken::CompileTokens(edit->RetText(), error);
+ bt = CBotToken::CompileTokens(edit->GetText(), error);
while ( bt != 0 )
{
- bs = bt->GivString();
+ bs = bt->GetString();
token = bs;
- type = bt->GivType();
+ type = bt->GetType();
- cursor1 = bt->GivStart();
- cursor2 = bt->GivEnd();
+ cursor1 = bt->GetStart();
+ cursor2 = bt->GetEnd();
- color = 0;
+ color = Gfx::FONT_HIGHLIGHT_NONE;
if ( type >= TokenKeyWord && type < TokenKeyWord+100 )
{
- color = COLOR_TOKEN;
+ color = Gfx::FONT_HIGHLIGHT_TOKEN;
}
if ( type >= TokenKeyDeclare && type < TokenKeyDeclare+100 )
{
- color = COLOR_TYPE;
+ color = Gfx::FONT_HIGHLIGHT_TYPE;
}
if ( type >= TokenKeyVal && type < TokenKeyVal+100 )
{
- color = COLOR_CONST;
+ color = Gfx::FONT_HIGHLIGHT_CONST;
}
if ( type == TokenTypVar )
{
if ( IsType(token) )
{
- color = COLOR_TYPE;
+ color = Gfx::FONT_HIGHLIGHT_TYPE;
}
else if ( IsFunction(token) )
{
- color = COLOR_TOKEN;
+ color = Gfx::FONT_HIGHLIGHT_TOKEN;
}
}
if ( type == TokenTypDef )
{
- color = COLOR_CONST;
+ color =Gfx::FONT_HIGHLIGHT_CONST;
}
if ( cursor1 < cursor2 && color != 0 )
@@ -3379,7 +3366,7 @@ void CScript::ColorizeScript(CEdit* edit)
edit->SetFormat(cursor1, cursor2, color);
}
- bt = bt->GivNext();
+ bt = bt->GetNext();
}
CBotToken::Delete(bt);
@@ -3389,7 +3376,8 @@ void CScript::ColorizeScript(CEdit* edit)
// Seeks a token at random in a script.
// Returns the index of the start of the token found, or -1.
-int SearchToken(char* script, char* token)
+
+int SearchToken(char* script, const char* token)
{
int lScript, lToken, i, iFound;
int found[100];
@@ -3425,7 +3413,7 @@ void DeleteToken(char* script, int pos, int len)
// Inserts a token in a script.
-void InsertToken(char* script, int pos, char* token)
+void InsertToken(char* script, int pos, const char* token)
{
int lScript, lToken, i;
@@ -3446,7 +3434,7 @@ bool CScript::IntroduceVirus()
int found[11*2];
char* newScript;
- char* names[11*2] =
+ const char* names[11*2] =
{
"==", "!=",
"!=", "==",
@@ -3477,7 +3465,7 @@ bool CScript::IntroduceVirus()
start = found[i+1];
i = found[i+0];
- newScript = (char*)malloc(sizeof(char)*(m_len+strlen(names[i+1])+1));
+ newScript = static_cast<char*>(malloc(sizeof(char)*(m_len+strlen(names[i+1])+1)));
strcpy(newScript, m_script);
delete m_script;
m_script = newScript;
@@ -3493,7 +3481,7 @@ bool CScript::IntroduceVirus()
// Returns the number of the error.
-int CScript::RetError()
+int CScript::GetError()
{
return m_error;
}
@@ -3528,7 +3516,7 @@ void CScript::GetError(char* buffer)
// New program.
-void CScript::New(CEdit* edit, char* name)
+void CScript::New(Ui::CEdit* edit, char* name)
{
FILE *file = NULL;
char res[100];
@@ -3553,7 +3541,7 @@ void CScript::New(CEdit* edit, char* name)
}
else
{
- if ( edit->RetAutoIndent() )
+ if ( edit->GetAutoIndent() )
{
cursor1 = 20+strlen(text)+6;
cursor2 = cursor1; // cursor in { }
@@ -3569,7 +3557,7 @@ void CScript::New(CEdit* edit, char* name)
edit->ShowSelect();
edit->SetFocus(true);
- sf = m_main->RetScriptFile();
+ sf = m_main->GetScriptFile();
if ( sf[0] != 0 ) // Load an empty program specific?
{
strcpy(filename, "script\\");
@@ -3599,7 +3587,7 @@ void CScript::New(CEdit* edit, char* name)
continue;
}
- if ( buffer[i] == '\t' && edit->RetAutoIndent() )
+ if ( buffer[i] == '\t' && edit->GetAutoIndent() )
{
i ++;
continue;
@@ -3642,7 +3630,7 @@ void CScript::New(CEdit* edit, char* name)
bool CScript::SendScript(char* text)
{
m_len = strlen(text);
- m_script = (char*)malloc(sizeof(char)*(m_len+1));
+ m_script = static_cast<char*>(malloc(sizeof(char)*(m_len+1)));
strcpy(m_script, text);
if ( !CheckToken() ) return false;
if ( !Compile() ) return false;
@@ -3652,10 +3640,10 @@ bool CScript::SendScript(char* text)
// Reads a script as a text file.
-bool CScript::ReadScript(char* filename)
+bool CScript::ReadScript(const char* filename)
{
FILE* file;
- CEdit* edit;
+ Ui::CEdit* edit;
char name[100];
if ( strchr(filename, '\\') == 0 )
@@ -3677,8 +3665,8 @@ bool CScript::ReadScript(char* filename)
m_script = 0;
edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9);
- edit->SetMaxChar(EDITSTUDIOMAX);
- edit->SetAutoIndent(m_engine->RetEditIndentMode());
+ edit->SetMaxChar(Ui::EDITSTUDIOMAX);
+ edit->SetAutoIndent(m_engine->GetEditIndentMode());
edit->ReadText(name);
GetScript(edit);
m_interface->DeleteControl(EVENT_EDIT9);
@@ -3687,9 +3675,9 @@ bool CScript::ReadScript(char* filename)
// Writes a script as a text file.
-bool CScript::WriteScript(char* filename)
+bool CScript::WriteScript(const char* filename)
{
- CEdit* edit;
+ Ui::CEdit* edit;
char name[100];
if ( strchr(filename, '\\') == 0 )
@@ -3709,8 +3697,8 @@ bool CScript::WriteScript(char* filename)
}
edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9);
- edit->SetMaxChar(EDITSTUDIOMAX);
- edit->SetAutoIndent(m_engine->RetEditIndentMode());
+ edit->SetMaxChar(Ui::EDITSTUDIOMAX);
+ edit->SetAutoIndent(m_engine->GetEditIndentMode());
edit->SetText(m_script);
edit->WriteText(name);
m_interface->DeleteControl(EVENT_EDIT9);
@@ -3769,7 +3757,7 @@ void CScript::SetFilename(char *filename)
strcpy(m_filename, filename);
}
-char* CScript::RetFilename()
+char* CScript::GetFilename()
{
return m_filename;
}
diff --git a/src/script/script.h b/src/script/script.h
index 8b2ae0b..5462a18 100644
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -22,20 +22,26 @@
#include <stdio.h>
#include "common/event.h"
+#include "CBot/CBotDll.h"
class CInstanceManager;
-class CD3DEngine;
-class CInterface;
-class CDisplayText;
-class CEdit;
-class CList;
class CObject;
class CTaskManager;
-class CBotProgram;
class CRobotMain;
+
+namespace Ui{
+class CDisplayText;
+class CEdit;
+class CInterface;
+class CList;
+} /* Ui */
+
+namespace Gfx {
+class CEngine;
class CTerrain;
class CWater;
+} /* Gfx */
@@ -47,9 +53,9 @@ public:
static void InitFonctions();
- void PutScript(CEdit* edit, char* name);
- bool GetScript(CEdit* edit);
- bool RetCompile();
+ void PutScript(Ui::CEdit* edit, char* name);
+ bool GetScript(Ui::CEdit* edit);
+ bool GetCompile();
void GetTitle(char* buffer);
@@ -61,58 +67,140 @@ public:
bool IsRunning();
bool IsContinue();
bool GetCursor(int &cursor1, int &cursor2);
- void UpdateList(CList* list);
- void ColorizeScript(CEdit* edit);
+ void UpdateList(Ui::CList* list);
+ void ColorizeScript(Ui::CEdit* edit);
bool IntroduceVirus();
- int RetError();
+ int GetError();
void GetError(char* buffer);
- void New(CEdit* edit, char* name);
+ void New(Ui::CEdit* edit, char* name);
bool SendScript(char* text);
- bool ReadScript(char* filename);
- bool WriteScript(char* filename);
+ bool ReadScript(const char* filename);
+ bool WriteScript(const char* filename);
bool ReadStack(FILE *file);
bool WriteStack(FILE *file);
bool Compare(CScript* other);
void SetFilename(char *filename);
- char* RetFilename();
+ char* GetFilename();
protected:
bool IsEmpty();
bool CheckToken();
bool Compile();
-public:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CInterface* m_interface;
- CDisplayText* m_displayText;
- CBotProgram* m_botProg;
- CRobotMain* m_main;
- CTerrain* m_terrain;
- CWater* m_water;
- CTaskManager* m_primaryTask;
- CTaskManager** m_secondaryTask;
- CObject* m_object;
-
- int m_ipf; // number of instructions/second
- int m_errMode; // what to do in case of error
- int m_len; // length of the script (without <0>)
- char* m_script; // script ends with <0>
- bool m_bRun; // program during execution?
- bool m_bStepMode; // step by step
- bool m_bContinue; // external function to continue
- bool m_bCompile; // compilation ok?
- char m_title[50]; // script title
- char m_filename[50]; // file name
- char m_token[50]; // missing instruction
- int m_error; // error (0=ok)
- int m_cursor1;
- int m_cursor2;
- Event m_event;
- float m_returnValue;
+private:
+
+ static CBotTypResult cNull(CBotVar* &var, void* user);
+ static CBotTypResult cOneFloat(CBotVar* &var, void* user);
+ static CBotTypResult cTwoFloat(CBotVar* &var, void* user);
+ static CBotTypResult cString(CBotVar* &var, void* user);
+ static CBotTypResult cGetObject(CBotVar* &var, void* user);
+ static CBotTypResult cSearch(CBotVar* &var, void* user);
+ static CBotTypResult cRadar(CBotVar* &var, void* user);
+ static CBotTypResult cDetect(CBotVar* &var, void* user);
+ static CBotTypResult cDirection(CBotVar* &var, void* user);
+ static CBotTypResult cProduce(CBotVar* &var, void* user);
+ static CBotTypResult cDistance(CBotVar* &var, void* user);
+ static CBotTypResult cSpace(CBotVar* &var, void* user);
+ static CBotTypResult cFlatGround(CBotVar* &var, void* user);
+ static CBotTypResult cGoto(CBotVar* &var, void* user);
+ static CBotTypResult cGrabDrop(CBotVar* &var, void* user);
+ static CBotTypResult cReceive(CBotVar* &var, void* user);
+ static CBotTypResult cSend(CBotVar* &var, void* user);
+ static CBotTypResult cDeleteInfo(CBotVar* &var, void* user);
+ static CBotTypResult cTestInfo(CBotVar* &var, void* user);
+ static CBotTypResult cShield(CBotVar* &var, void* user);
+ static CBotTypResult cFire(CBotVar* &var, void* user);
+ static CBotTypResult cMotor(CBotVar* &var, void* user);
+ static CBotTypResult cTopo(CBotVar* &var, void* user);
+ static CBotTypResult cMessage(CBotVar* &var, void* user);
+ static CBotTypResult cPenDown(CBotVar* &var, void* user);
+ static CBotTypResult cOnePoint(CBotVar* &var, void* user);
+ static CBotTypResult cPoint(CBotVar* &var, void* user);
+
+
+ static bool rSin(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rCos(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rTan(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSqrt(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPow(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rRand(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rAbs(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rGetObject(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDirection(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDistance(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSniff(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rThump(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rShield(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rJet(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rTopo(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rMessage(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rIPF(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rAbsTime(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDeleteFile(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user);
+
+ static bool Process(CScript* script, CBotVar* result, int &exception);
+ static CObject* SearchInfo(CScript* script, CObject* object, float power);
+
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Ui::CInterface* m_interface;
+ Ui::CDisplayText* m_displayText;
+ CBotProgram* m_botProg;
+ CRobotMain* m_main;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ CTaskManager* m_primaryTask;
+ CTaskManager** m_secondaryTask;
+ CObject* m_object;
+
+ int m_ipf; // number of instructions/second
+ int m_errMode; // what to do in case of error
+ int m_len; // length of the script (without <0>)
+ char* m_script; // script ends with <0>
+ bool m_bRun; // program during execution?
+ bool m_bStepMode; // step by step
+ bool m_bContinue; // external function to continue
+ bool m_bCompile; // compilation ok?
+ char m_title[50]; // script title
+ char m_filename[50]; // file name
+ char m_token[50]; // missing instruction
+ int m_error; // error (0=ok)
+ int m_cursor1;
+ int m_cursor2;
+ Event m_event;
+ float m_returnValue;
};