diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/cbottoken.cpp | 10 | ||||
-rw-r--r-- | src/script/cbottoken.h | 10 | ||||
-rw-r--r-- | src/script/script.cpp | 5 | ||||
-rw-r--r-- | src/script/script.h | 4 |
4 files changed, 15 insertions, 14 deletions
diff --git a/src/script/cbottoken.cpp b/src/script/cbottoken.cpp index a9cc599..0bb368c 100644 --- a/src/script/cbottoken.cpp +++ b/src/script/cbottoken.cpp @@ -24,7 +24,7 @@ // Seeking the name of an object. -char* GetObjectName(ObjectType type) +const char* GetObjectName(ObjectType type) { if ( type == OBJECT_PORTICO ) return "Portico"; if ( type == OBJECT_BASE ) return "SpaceShip"; @@ -117,7 +117,7 @@ char* GetObjectName(ObjectType type) // Seeking the name of a secondary object. // (because Otto thinks that Germans do not like nuclear power) -char* GetObjectAlias(ObjectType type) +const char* GetObjectAlias(ObjectType type) { if ( type == OBJECT_NUCLEAR ) return "FuelCellPlant"; if ( type == OBJECT_URANIUM ) return "PlatinumOre"; @@ -130,7 +130,7 @@ char* GetObjectAlias(ObjectType type) // Returns the help file to use for the object. -char* GetHelpFilename(ObjectType type) +const char* GetHelpFilename(ObjectType type) { if ( type == OBJECT_BASE ) return "help\\object\\base.txt"; if ( type == OBJECT_DERRICK ) return "help\\object\\derrick.txt"; @@ -215,7 +215,7 @@ char* GetHelpFilename(ObjectType type) // Returns the help file to use for instruction. -char* GetHelpFilename(const char *token) +const 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"; @@ -427,7 +427,7 @@ bool IsFunction(const char *token) // Returns using a compact instruction. -char* GetHelpText(const char *token) +const 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 4be5f03..1f2d6e7 100644 --- a/src/script/cbottoken.h +++ b/src/script/cbottoken.h @@ -25,12 +25,12 @@ // Procedures. -extern char* GetObjectName(ObjectType type); -extern char* GetObjectAlias(ObjectType type); -extern char* GetHelpFilename(ObjectType type); -extern char* GetHelpFilename(const char *token); +extern const char* GetObjectName(ObjectType type); +extern const char* GetObjectAlias(ObjectType type); +extern const char* GetHelpFilename(ObjectType type); +extern const char* GetHelpFilename(const char *token); extern bool IsType(const char *token); extern bool IsFunction(const char *token); -extern char* GetHelpText(const char *token); +extern const char* GetHelpText(const char *token); diff --git a/src/script/script.cpp b/src/script/script.cpp index 4f7f1ee..b29c625 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -661,6 +661,7 @@ bool CScript::rRadar(CBotVar* var, CBotVar* result, int& exception, void* user) } a = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! + //TODO uninitialized variable if ( Math::TestAngle(a, iAngle-focus/2.0f, iAngle+focus/2.0f) ) { if ( (sens >= 0.0f && d < best) || @@ -2754,7 +2755,7 @@ CScript::~CScript() // Gives the script editable block of text. -void CScript::PutScript(Ui::CEdit* edit, char* name) +void CScript::PutScript(Ui::CEdit* edit, const char* name) { if ( m_script == 0 ) { @@ -3516,7 +3517,7 @@ void CScript::GetError(char* buffer) // New program. -void CScript::New(Ui::CEdit* edit, char* name) +void CScript::New(Ui::CEdit* edit, const char* name) { FILE *file = NULL; char res[100]; diff --git a/src/script/script.h b/src/script/script.h index 5462a18..5c1118f 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -53,7 +53,7 @@ public: static void InitFonctions(); - void PutScript(Ui::CEdit* edit, char* name); + void PutScript(Ui::CEdit* edit, const char* name); bool GetScript(Ui::CEdit* edit); bool GetCompile(); @@ -74,7 +74,7 @@ public: int GetError(); void GetError(char* buffer); - void New(Ui::CEdit* edit, char* name); + void New(Ui::CEdit* edit, const char* name); bool SendScript(char* text); bool ReadScript(const char* filename); bool WriteScript(const char* filename); |