use const for readonly strings and set some functions to static
This commit is contained in:
@@ -111,7 +111,7 @@ KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities et
|
||||
|
||||
#define KX_BLENDERTRUNC(x) (( x < 0.0001 && x > -0.0001 ) ? 0.0 : x)
|
||||
|
||||
void BL_ConvertActuators(char* maggiename,
|
||||
void BL_ConvertActuators(const char* maggiename,
|
||||
struct Object* blenderobject,
|
||||
KX_GameObject* gameobj,
|
||||
SCA_LogicManager* logicmgr,
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#ifndef __KX_CONVERTACTUATORS_H
|
||||
#define __KX_CONVERTACTUATORS_H
|
||||
|
||||
void BL_ConvertActuators(char* maggiename,
|
||||
void BL_ConvertActuators(const char* maggiename,
|
||||
struct Object* blenderobject,
|
||||
class KX_GameObject* gameobj,
|
||||
class SCA_LogicManager* logicmgr,
|
||||
|
@@ -102,9 +102,9 @@ public:
|
||||
// Initialize() functions are not put here since they have
|
||||
// different prototypes for Unix and Windows
|
||||
void StartLoadingAnimation();
|
||||
bool Start(char *filename); // file-on-disk starter
|
||||
bool Start(const char *filename); // file-on-disk starter
|
||||
bool Start(unsigned char *blenderDataBuffer,
|
||||
unsigned int blenderDataBufferSize); // file-in-memory starter
|
||||
unsigned int blenderDataBufferSize); // file-in-memory starter
|
||||
|
||||
void Stop();
|
||||
virtual void Exit();
|
||||
|
@@ -346,7 +346,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
|
||||
return true;
|
||||
}
|
||||
|
||||
CValue *KX_CameraActuator::findObject(char *obName)
|
||||
CValue *KX_CameraActuator::findObject(const char *obName)
|
||||
{
|
||||
/* hook to object system */
|
||||
return NULL;
|
||||
|
@@ -77,7 +77,7 @@ private :
|
||||
float m_damping;
|
||||
|
||||
/* get the KX_IGameObject with this name */
|
||||
CValue *findObject(char *obName);
|
||||
CValue *findObject(const char *obName);
|
||||
|
||||
/* parse x or y to a toggle pick */
|
||||
bool string2axischoice(const char *axisString);
|
||||
|
@@ -382,7 +382,8 @@ void KX_IpoActuator::ResetStartTime()
|
||||
this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0;
|
||||
}
|
||||
|
||||
int KX_IpoActuator::string2mode(char* modename) {
|
||||
int KX_IpoActuator::string2mode(const char *modename)
|
||||
{
|
||||
IpoActType res = KX_ACT_IPO_NODEF;
|
||||
|
||||
if (strcmp(modename, S_KX_ACT_IPO_PLAY_STRING)==0) {
|
||||
|
@@ -118,7 +118,7 @@ public:
|
||||
static const char *S_KX_ACT_IPO_KEY2KEY_STRING;
|
||||
static const char *S_KX_ACT_IPO_FROM_PROP_STRING;
|
||||
|
||||
int string2mode(char* modename);
|
||||
int string2mode(const char *modename);
|
||||
|
||||
int m_type;
|
||||
|
||||
|
@@ -1089,7 +1089,7 @@ static PyObject* gPyDisableMotionBlur(PyObject*)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
int getGLSLSettingFlag(char *setting)
|
||||
static int getGLSLSettingFlag(const char *setting)
|
||||
{
|
||||
if(strcmp(setting, "lights") == 0)
|
||||
return GAME_GLSL_NO_LIGHTS;
|
||||
@@ -1725,7 +1725,7 @@ static void backupPySysObjects(void)
|
||||
*
|
||||
* "/home/me/foo.blend" -> "/home/me/scripts"
|
||||
*/
|
||||
static void initPySysObjects__append(PyObject *sys_path, char *filename)
|
||||
static void initPySysObjects__append(PyObject *sys_path, const char *filename)
|
||||
{
|
||||
PyObject *item;
|
||||
char expanded[FILE_MAXDIR + FILE_MAXFILE];
|
||||
@@ -2325,7 +2325,7 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pathGamePythonConfig( char *path )
|
||||
void pathGamePythonConfig(char *path)
|
||||
{
|
||||
int len = strlen(gp_GamePythonPathOrig); // Always use the first loaded blend filename
|
||||
|
||||
@@ -2339,7 +2339,7 @@ void pathGamePythonConfig( char *path )
|
||||
}
|
||||
}
|
||||
|
||||
void setGamePythonPath(char *path)
|
||||
void setGamePythonPath(const char *path)
|
||||
{
|
||||
BLI_strncpy(gp_GamePythonPath, path, sizeof(gp_GamePythonPath));
|
||||
BLI_cleanup_file(NULL, gp_GamePythonPath); /* not absolutely needed but makes resolving path problems less confusing later */
|
||||
|
@@ -54,7 +54,7 @@ void exitGamePythonScripting();
|
||||
|
||||
void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *blenderdata, PyObject *pyGlobalDict, PyObject **gameLogic, PyObject **gameLogic_keys, int argc, char** argv);
|
||||
|
||||
void setGamePythonPath(char *path);
|
||||
void setGamePythonPath(const char *path);
|
||||
void resetGamePythonPath();
|
||||
void pathGamePythonConfig( char *path );
|
||||
int saveGamePythonConfig( char **marshal_buffer);
|
||||
|
@@ -190,7 +190,7 @@ bool KX_SceneActuator::Update()
|
||||
|
||||
|
||||
/* returns a camera if the name is valid */
|
||||
KX_Camera* KX_SceneActuator::FindCamera(char *camName)
|
||||
KX_Camera* KX_SceneActuator::FindCamera(const char *camName)
|
||||
{
|
||||
KX_SceneList* sl = m_KetsjiEngine->CurrentScenes();
|
||||
STR_String name = STR_String(camName);
|
||||
@@ -208,7 +208,7 @@ KX_Camera* KX_SceneActuator::FindCamera(char *camName)
|
||||
|
||||
|
||||
|
||||
KX_Scene* KX_SceneActuator::FindScene(char * sceneName)
|
||||
KX_Scene* KX_SceneActuator::FindScene(const char * sceneName)
|
||||
{
|
||||
return m_KetsjiEngine->FindScene(sceneName);
|
||||
}
|
||||
|
@@ -54,9 +54,9 @@ class KX_SceneActuator : public SCA_IActuator
|
||||
class KX_Camera* m_camera;
|
||||
|
||||
/** Is this a valid scene? */
|
||||
class KX_Scene* FindScene(char* sceneName);
|
||||
class KX_Scene* FindScene(const char* sceneName);
|
||||
/** Is this a valid camera? */
|
||||
class KX_Camera* FindCamera(char* cameraName);
|
||||
class KX_Camera* FindCamera(const char* cameraName);
|
||||
|
||||
public:
|
||||
enum SCA_SceneActuatorMode
|
||||
|
@@ -107,7 +107,7 @@ RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID)
|
||||
|
||||
|
||||
// get material ID
|
||||
short getMaterialID (PyObject * obj, char * name)
|
||||
short getMaterialID(PyObject * obj, const char *name)
|
||||
{
|
||||
// search for material
|
||||
for (short matID = 0;; ++matID)
|
||||
|
@@ -85,7 +85,7 @@ void loadTexture (unsigned int texId, unsigned int * texture, short * size,
|
||||
RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID);
|
||||
|
||||
// get material ID
|
||||
short getMaterialID (PyObject * obj, char * name);
|
||||
short getMaterialID (PyObject * obj, const char *name);
|
||||
|
||||
// Exceptions
|
||||
extern ExceptionID MaterialNotAvail;
|
||||
|
Reference in New Issue
Block a user