[Bf-blender-cvs] [660173e] master: BGE: Fix: VehicleWrapper compiler warning.

Thomas Szepe noreply at git.blender.org
Mon Mar 30 22:49:39 CEST 2015


Commit: 660173ed72d9c69f6891d5ad05a8c4a35ece9c7c
Author: Thomas Szepe
Date:   Mon Mar 30 22:47:09 2015 +0200
Branches: master
https://developer.blender.org/rB660173ed72d9c69f6891d5ad05a8c4a35ece9c7c

BGE: Fix: VehicleWrapper compiler warning.

The return type of raise_exc_wheel() is bool, but the method return -1. The compiler will change the return type type to an int. This can cause some problems on 64bit systems.

Reviewers: lordloki, sybren

Reviewed By: lordloki, sybren

Differential Revision: https://developer.blender.org/D1204

===================================================================

M	source/gameengine/Ketsji/KX_VehicleWrapper.cpp

===================================================================

diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index d10e51a..237f485 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -54,19 +54,20 @@ KX_VehicleWrapper::~KX_VehicleWrapper()
 #ifdef WITH_PYTHON
 
 
-static bool raise_exc_wheel(PHY_IVehicle* vehicle, int i, const char *method)
+static bool raise_exc_wheel(PHY_IVehicle *vehicle, int i, const char *method)
 {
-	if ( i < 0 || i >= vehicle->GetNumWheels() ) {
+	if (i < 0 || i >= vehicle->GetNumWheels()) {
 		PyErr_Format(PyExc_ValueError,
-		             "%s(...): wheel index %d out of range (0 to %d).", method, i, vehicle->GetNumWheels()-1);
-		return -1;
-	} else {
-		return 0;
+		             "%s(...): wheel index %d out of range (0 to %d).", method, i, vehicle->GetNumWheels() - 1);
+		return true;
+	}
+	else {
+		return false;
 	}
 }
 
 #define WHEEL_INDEX_CHECK_OR_RETURN(i, method) \
-	if (raise_exc_wheel(m_vehicle, i, method) == -1) { return NULL; } (void)0
+	if (raise_exc_wheel(m_vehicle, i, method)) {return NULL;} (void)0
 
 
 PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args)




More information about the Bf-blender-cvs mailing list