remove warnings for the BGE

- variables that shadow vers declared earlier
- Py_Fatal print an error to the stderr
- gcc was complaining about the order of initialized vars (for classes)
- const return values for ints and bools didnt do anything.
- braces for ambiguous if  statements
This commit is contained in:
Campbell Barton 2009-02-25 03:26:02 +00:00
parent 56e9c87309
commit 2eb85c01f3
32 changed files with 104 additions and 99 deletions

@ -563,10 +563,12 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area,
// get some preferences
SYS_SystemHandle syshandle = SYS_GetSystem();
/*
bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0);
bool usefixed = (SYS_GetCommandLineInt(syshandle, "fixedtime", 0) != 0);
bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0);
bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
*/
bool game2ipo = true;//(SYS_GetCommandLineInt(syshandle, "game2ipo", 0) != 0);
bool displaylists = (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0);
bool usemat = false;

@ -1997,18 +1997,18 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
MT_Vector3 x(ori.getColumn(0));
MT_Vector3 y(ori.getColumn(1));
MT_Vector3 z(ori.getColumn(2));
MT_Vector3 scale(x.length(), y.length(), z.length());
if (!MT_fuzzyZero(scale[0]))
x /= scale[0];
if (!MT_fuzzyZero(scale[1]))
y /= scale[1];
if (!MT_fuzzyZero(scale[2]))
z /= scale[2];
MT_Vector3 parscale(x.length(), y.length(), z.length());
if (!MT_fuzzyZero(parscale[0]))
x /= parscale[0];
if (!MT_fuzzyZero(parscale[1]))
y /= parscale[1];
if (!MT_fuzzyZero(parscale[2]))
z /= parscale[2];
ori.setColumn(0, x);
ori.setColumn(1, y);
ori.setColumn(2, z);
parentinversenode->SetLocalOrientation(ori);
parentinversenode->SetLocalScale(scale);
parentinversenode->SetLocalScale(parscale);
parentinversenode->AddChild(gameobj->GetSGNode());
}
@ -2194,18 +2194,18 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
MT_Vector3 x(ori.getColumn(0));
MT_Vector3 y(ori.getColumn(1));
MT_Vector3 z(ori.getColumn(2));
MT_Vector3 scale(x.length(), y.length(), z.length());
if (!MT_fuzzyZero(scale[0]))
x /= scale[0];
if (!MT_fuzzyZero(scale[1]))
y /= scale[1];
if (!MT_fuzzyZero(scale[2]))
z /= scale[2];
MT_Vector3 localscale(x.length(), y.length(), z.length());
if (!MT_fuzzyZero(localscale[0]))
x /= localscale[0];
if (!MT_fuzzyZero(localscale[1]))
y /= localscale[1];
if (!MT_fuzzyZero(localscale[2]))
z /= localscale[2];
ori.setColumn(0, x);
ori.setColumn(1, y);
ori.setColumn(2, z);
parentinversenode->SetLocalOrientation(ori);
parentinversenode->SetLocalScale(scale);
parentinversenode->SetLocalScale(localscale);
parentinversenode->AddChild(gameobj->GetSGNode());
}

@ -311,67 +311,67 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend
}
{
KX_ObColorIpoSGController* ipocontr=NULL;
KX_ObColorIpoSGController* ipocontr_obcol=NULL;
ipo = ipoList->GetScalarInterpolator(OB_COL_R);
if (ipo)
{
if (!ipocontr)
if (!ipocontr_obcol)
{
ipocontr = new KX_ObColorIpoSGController();
gameobj->GetSGNode()->AddSGController(ipocontr);
ipocontr->SetObject(gameobj->GetSGNode());
ipocontr_obcol = new KX_ObColorIpoSGController();
gameobj->GetSGNode()->AddSGController(ipocontr_obcol);
ipocontr_obcol->SetObject(gameobj->GetSGNode());
}
KX_IInterpolator *interpolator =
new KX_ScalarInterpolator(
&ipocontr->m_rgba[0],
&ipocontr_obcol->m_rgba[0],
ipo);
ipocontr->AddInterpolator(interpolator);
ipocontr_obcol->AddInterpolator(interpolator);
}
ipo = ipoList->GetScalarInterpolator(OB_COL_G);
if (ipo)
{
if (!ipocontr)
if (!ipocontr_obcol)
{
ipocontr = new KX_ObColorIpoSGController();
gameobj->GetSGNode()->AddSGController(ipocontr);
ipocontr->SetObject(gameobj->GetSGNode());
ipocontr_obcol = new KX_ObColorIpoSGController();
gameobj->GetSGNode()->AddSGController(ipocontr_obcol);
ipocontr_obcol->SetObject(gameobj->GetSGNode());
}
KX_IInterpolator *interpolator =
new KX_ScalarInterpolator(
&ipocontr->m_rgba[1],
&ipocontr_obcol->m_rgba[1],
ipo);
ipocontr->AddInterpolator(interpolator);
ipocontr_obcol->AddInterpolator(interpolator);
}
ipo = ipoList->GetScalarInterpolator(OB_COL_B);
if (ipo)
{
if (!ipocontr)
if (!ipocontr_obcol)
{
ipocontr = new KX_ObColorIpoSGController();
gameobj->GetSGNode()->AddSGController(ipocontr);
ipocontr->SetObject(gameobj->GetSGNode());
ipocontr_obcol = new KX_ObColorIpoSGController();
gameobj->GetSGNode()->AddSGController(ipocontr_obcol);
ipocontr_obcol->SetObject(gameobj->GetSGNode());
}
KX_IInterpolator *interpolator =
new KX_ScalarInterpolator(
&ipocontr->m_rgba[2],
&ipocontr_obcol->m_rgba[2],
ipo);
ipocontr->AddInterpolator(interpolator);
ipocontr_obcol->AddInterpolator(interpolator);
}
ipo = ipoList->GetScalarInterpolator(OB_COL_A);
if (ipo)
{
if (!ipocontr)
if (!ipocontr_obcol)
{
ipocontr = new KX_ObColorIpoSGController();
gameobj->GetSGNode()->AddSGController(ipocontr);
ipocontr->SetObject(gameobj->GetSGNode());
ipocontr_obcol = new KX_ObColorIpoSGController();
gameobj->GetSGNode()->AddSGController(ipocontr_obcol);
ipocontr_obcol->SetObject(gameobj->GetSGNode());
}
KX_IInterpolator *interpolator =
new KX_ScalarInterpolator(
&ipocontr->m_rgba[3],
&ipocontr_obcol->m_rgba[3],
ipo);
ipocontr->AddInterpolator(interpolator);
ipocontr_obcol->AddInterpolator(interpolator);
}
}

@ -274,7 +274,7 @@ void CParser::NextSym()
} else if (((ch >= 'a') && (ch <= 'z'))
|| ((ch >= 'A') && (ch <= 'Z')))
{ // reserved word?
int start;
start = chcount;
CharRep();
GrabString(start);

@ -147,7 +147,7 @@ PyObject *PyObjectPlus::_getattr_self(const PyAttributeDef attrlist[], void *sel
if (attrdef->m_length > 1)
{
PyObject* resultlist = PyList_New(attrdef->m_length);
for (int i=0; i<attrdef->m_length; i++)
for (unsigned int i=0; i<attrdef->m_length; i++)
{
switch (attrdef->m_type) {
case KX_PYATTRIBUTE_TYPE_BOOL:

@ -73,7 +73,7 @@ typedef int Py_ssize_t;
#endif
static inline void Py_Fatal(const char *M) {
//cout << M << endl;
fprintf(stderr, "%s\n", M);
exit(-1);
};

@ -42,14 +42,14 @@ SCA_Joystick::SCA_Joystick(short int index)
m_axis21(0),
m_prec(3200),
m_buttonnum(-2),
m_axismax(-1),
m_hatdir(-2),
m_buttonmax(-1),
m_hatmax(-1),
m_isinit(0),
m_istrig_axis(0),
m_istrig_button(0),
m_istrig_hat(0),
m_axismax(-1),
m_buttonmax(-1),
m_hatmax(-1)
m_istrig_hat(0)
{
#ifndef DISABLE_SDL
m_private = new PrivateData();

@ -53,10 +53,10 @@ SCA_DelaySensor::SCA_DelaySensor(class SCA_EventManager* eventmgr,
int duration,
bool repeat,
PyTypeObject* T)
: SCA_ISensor(gameobj,eventmgr, T),
: SCA_ISensor(gameobj,eventmgr, T),
m_repeat(repeat),
m_delay(delay),
m_duration(duration),
m_repeat(repeat)
m_duration(duration)
{
Init();
}

@ -36,8 +36,8 @@ using namespace std;
SCA_IActuator::SCA_IActuator(SCA_IObject* gameobj,
PyTypeObject* T) :
m_links(0),
SCA_ILogicBrick(gameobj,T)
SCA_ILogicBrick(gameobj,T),
m_links(0)
{
// nothing to do
}

@ -36,9 +36,9 @@ class SCA_IActuator : public SCA_ILogicBrick
{
friend class SCA_LogicManager;
protected:
std::vector<CValue*> m_events;
int m_links; // number of active links to controllers
// when 0, the actuator is automatically stopped
std::vector<CValue*> m_events;
void RemoveAllEvents();
public:

@ -38,8 +38,8 @@
SCA_IController::SCA_IController(SCA_IObject* gameobj,
PyTypeObject* T)
:
m_statemask(0),
SCA_ILogicBrick(gameobj,T)
SCA_ILogicBrick(gameobj,T),
m_statemask(0)
{
}

@ -40,7 +40,7 @@
MT_Point3 SCA_IObject::m_sDummy=MT_Point3(0,0,0);
SCA_IObject::SCA_IObject(PyTypeObject* T): m_initState(0), m_state(0), CValue(T)
SCA_IObject::SCA_IObject(PyTypeObject* T): CValue(T), m_initState(0), m_state(0)
{
m_suspended = false;
}

@ -158,8 +158,8 @@ bool SCA_MouseSensor::Evaluate(CValue* event)
case KX_MOUSESENSORMODE_WHEELUP:
case KX_MOUSESENSORMODE_WHEELDOWN:
{
const SCA_InputEvent& event = mousedev->GetEventValue(m_hotkey);
switch (event.m_status){
const SCA_InputEvent& mevent = mousedev->GetEventValue(m_hotkey);
switch (mevent.m_status){
case SCA_InputEvent::KX_JUSTACTIVATED:
m_val = 1;
result = true;

@ -18,7 +18,7 @@
#define spit(x) std::cout << x << std::endl;
#define SORT_UNIFORMS 1
#define UNIFORM_MAX_LEN sizeof(float)*16
#define UNIFORM_MAX_LEN (int)sizeof(float)*16
#define MAX_LOG_LEN 262144 // bounds
BL_Uniform::BL_Uniform(int data_size)
@ -108,7 +108,7 @@ void BL_Uniform::SetData(int location, int type,bool transpose)
#endif
}
const bool BL_Shader::Ok()const
bool BL_Shader::Ok()const
{
return (mShader !=0 && mOk && mUse);
}

@ -166,7 +166,7 @@ public:
//const BL_Sampler* GetSampler(int i);
void SetSampler(int loc, int unit);
const bool Ok()const;
bool Ok()const;
unsigned int GetProg();
void SetProg(bool enable);
int GetAttribute(){return mAttr;};

@ -384,10 +384,10 @@ SG_Controller* KX_BulletPhysicsController::GetReplica(class SG_Node* destnode)
childit!= destnode->GetSGChildren().end();
++childit
) {
KX_GameObject *clientgameobj = static_cast<KX_GameObject*>( (*childit)->GetSGClientObject());
if (clientgameobj)
KX_GameObject *clientgameobj_child = static_cast<KX_GameObject*>( (*childit)->GetSGClientObject());
if (clientgameobj_child)
{
parentKxCtrl = (KX_BulletPhysicsController*)clientgameobj->GetPhysicsController();
parentKxCtrl = (KX_BulletPhysicsController*)clientgameobj_child->GetPhysicsController();
parentctrl = parentKxCtrl;
ccdParent = parentKxCtrl;
}

@ -56,9 +56,9 @@ KX_ConstraintActuator::KX_ConstraintActuator(SCA_IObject *gameobj,
int option,
char *property,
PyTypeObject* T) :
SCA_IActuator(gameobj, T),
m_refDirection(refDir),
m_currentTime(0),
SCA_IActuator(gameobj, T)
m_currentTime(0)
{
m_posDampTime = posDampTime;
m_rotDampTime = rotDampTime;

@ -132,7 +132,7 @@ bool KX_GameActuator::Update()
{
char mashal_path[512];
char *marshal_buffer = NULL;
int marshal_length;
unsigned int marshal_length;
FILE *fp = NULL;
pathGamePythonConfig(mashal_path);

@ -1462,11 +1462,9 @@ PyObject* KX_GameObject::PySetState(PyObject* self, PyObject* value)
PyObject* KX_GameObject::PyGetVelocity(PyObject* self, PyObject* args)
{
// only can get the velocity if we have a physics object connected to us...
MT_Vector3 velocity(0.0,0.0,0.0);
MT_Point3 point(0.0,0.0,0.0);
PyObject* pypos = NULL;
if (PyArg_ParseTuple(args, "|O:getVelocity", &pypos))
{
if (pypos)
@ -1478,10 +1476,11 @@ PyObject* KX_GameObject::PyGetVelocity(PyObject* self, PyObject* args)
if (m_pPhysicsController1)
{
velocity = m_pPhysicsController1->GetVelocity(point);
return PyObjectFrom(m_pPhysicsController1->GetVelocity(point));
}
else {
return PyObjectFrom(MT_Vector3(0.0,0.0,0.0));
}
return PyObjectFrom(velocity);
}
@ -2045,8 +2044,8 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
if (callback.m_hitMesh)
{
// if this field is set, then we can trust that m_hitPolygon is a valid polygon
RAS_Polygon* poly = callback.m_hitMesh->GetPolygon(callback.m_hitPolygon);
KX_PolyProxy* polyproxy = new KX_PolyProxy(callback.m_hitMesh, poly);
RAS_Polygon* polygon = callback.m_hitMesh->GetPolygon(callback.m_hitPolygon);
KX_PolyProxy* polyproxy = new KX_PolyProxy(callback.m_hitMesh, polygon);
PyTuple_SET_ITEM(returnValue, 3, polyproxy);
}
else

@ -58,8 +58,8 @@ KX_IpoSGController::KX_IpoSGController()
m_ipo_add(false),
m_ipo_local(false),
m_modified(true),
m_ipo_start_initialized(false),
m_ipotime(1.0),
m_ipo_start_initialized(false),
m_ipo_start_euler(0.0,0.0,0.0),
m_ipo_euler_initialized(false)
{

@ -713,7 +713,7 @@ void KX_KetsjiEngine::Render()
if (!BeginFrame())
return;
KX_SceneList::iterator sceneit;
for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++)
// for each scene, call the proceed functions
{

@ -240,7 +240,7 @@ bool KX_NearSensor::BroadPhaseFilterCollision(void*obj1,void*obj2)
bool KX_NearSensor::NewHandleCollision(void* obj1,void* obj2,const PHY_CollData * coll_data)
{
// KX_TouchEventManager* toucheventmgr = static_cast<KX_TouchEventManager*>(m_eventmgr);
KX_GameObject* parent = static_cast<KX_GameObject*>(GetParent());
// KX_GameObject* parent = static_cast<KX_GameObject*>(GetParent());
// need the mapping from PHY_IPhysicsController to gameobjects now

@ -65,12 +65,12 @@ KX_ObjectActuator(
m_current_linear_factor(0.0),
m_current_angular_factor(0.0),
m_damping(damping),
m_previous_error(0.0,0.0,0.0),
m_error_accumulator(0.0,0.0,0.0),
m_bitLocalFlag (flag),
m_active_combined_velocity (false),
m_linear_damping_active(false),
m_angular_damping_active(false),
m_error_accumulator(0.0,0.0,0.0),
m_previous_error(0.0,0.0,0.0)
m_angular_damping_active(false)
{
if (m_bitLocalFlag.ServoControl)
{

@ -146,8 +146,8 @@ PyObject* KX_PolyProxy::_getattr(const char *attr)
}
KX_PolyProxy::KX_PolyProxy(const RAS_MeshObject*mesh, RAS_Polygon* polygon)
: m_mesh((RAS_MeshObject*)mesh),
m_polygon(polygon)
: m_polygon(polygon),
m_mesh((RAS_MeshObject*)mesh)
{
}

@ -196,7 +196,7 @@ static PyObject* gPyGetSpectrum(PyObject*)
}
#if 0 // unused
static PyObject* gPyStartDSP(PyObject*, PyObject* args)
{
SND_IAudioDevice* audiodevice = SND_DeviceManager::Instance();
@ -213,7 +213,7 @@ static PyObject* gPyStartDSP(PyObject*, PyObject* args)
Py_RETURN_NONE;
}
#endif
static PyObject* gPyStopDSP(PyObject*, PyObject* args)
@ -257,7 +257,7 @@ static PyObject* gPySetPhysicsTicRate(PyObject*, PyObject* args)
PHY_GetActiveEnvironment()->setFixedTimeStep(true,ticrate);
Py_RETURN_NONE;
}
#if 0 // unused
static PyObject* gPySetPhysicsDebug(PyObject*, PyObject* args)
{
int debugMode;
@ -267,7 +267,7 @@ static PyObject* gPySetPhysicsDebug(PyObject*, PyObject* args)
PHY_GetActiveEnvironment()->setDebugMode(debugMode);
Py_RETURN_NONE;
}
#endif
static PyObject* gPyGetPhysicsTicRate(PyObject*)

@ -444,7 +444,7 @@ PyObject* KX_SoundActuator::PySetLooping(PyObject* self, PyObject* args, PyObjec
PyObject* KX_SoundActuator::PyGetLooping(PyObject* self, PyObject* args, PyObject* kwds)
{
int looping = (m_soundObject) ? m_soundObject->GetLoopMode() : SND_LOOP_OFF;
int looping = (m_soundObject) ? m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
PyObject* result = PyInt_FromLong(looping);
return result;

@ -317,8 +317,8 @@ static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVec
CcdPhysicsEnvironment::CcdPhysicsEnvironment(btDispatcher* dispatcher,btOverlappingPairCache* pairCache)
:m_scalingPropagated(false),
m_numIterations(10),
:m_numIterations(10),
m_scalingPropagated(false),
m_numTimeSubSteps(1),
m_ccdMode(0),
m_solverType(-1),
@ -326,8 +326,8 @@ m_profileTimings(0),
m_enableSatCollisionDetection(false),
m_solver(NULL),
m_ownPairCache(NULL),
m_ownDispatcher(NULL),
m_filterCallback(NULL)
m_filterCallback(NULL),
m_ownDispatcher(NULL)
{
for (int i=0;i<PHY_NUM_RESPONSE;i++)

@ -143,7 +143,7 @@ const STR_String& RAS_IPolyMaterial::GetTextureName() const
return m_texturename;
}
const unsigned int RAS_IPolyMaterial::GetFlag() const
unsigned int RAS_IPolyMaterial::GetFlag() const
{
return m_flag;
}

@ -138,7 +138,7 @@ public:
const STR_String& GetMaterialName() const;
dword GetMaterialNameHash() const;
const STR_String& GetTextureName() const;
const unsigned int GetFlag() const;
unsigned int GetFlag() const;
virtual bool UsesLighting(RAS_IRasterizer *rasty) const;
virtual bool UsesObjectColor() const;

@ -110,7 +110,7 @@ public:
return (unsigned char *) &m_rgba;
}
const unsigned int getOrigIndex() const {
unsigned int getOrigIndex() const {
return m_origindex;
}

@ -69,7 +69,7 @@ FilterBase * FilterBase::findFirst (void)
{
// find first filter in chain
FilterBase * frst;
for (frst = this; frst->m_previous != NULL; frst = frst->m_previous->m_filter);
for (frst = this; frst->m_previous != NULL; frst = frst->m_previous->m_filter) {};
// set first filter
return frst;
}

@ -189,9 +189,10 @@ protected:
int d = m_buffU[offset] - 128;
int e = m_buffV[offset] - 128;
// if horizontal interpolation is needed
if ((x & 1) == 1)
if ((x & 1) == 1) {
// if vertical interpolation is needed too
if ((y & 1) == 1)
{
// if this pixel is on the edge
if (isEdge(x, y, size))
{
@ -206,7 +207,8 @@ protected:
e = interpolVH(m_buffV + offset) - 128;
}
// otherwise use horizontal interpolation only
else
}
else {
// if this pixel is on the edge
if (isEdge(x, y, size))
{
@ -221,6 +223,8 @@ protected:
e = interpolH(m_buffV + offset) - 128;
}
// otherwise if only vertical interpolation is needed
}
}
else if ((y & 1) == 1)
// if this pixel is on the edge
if (isEdge(x, y, size))