Fix to human.cpp in 1.3.1 branch

Andrew Sumner <[email protected]> Thu, 11 Sep 2008 10:25:31 +1000
Newsgroups gmane.games.torcs.devel
Message-ID <817522051E65D511A2740001028074C404209D15@EX1>
The 1.3.1 version of human.cpp introduces an "auto clutch", which while very
useful was
however not allowing people to control the clutch manually using keyboard or
mouse/joystick 
buttons.  This fixes that problem.

cheers
Andrew


--- human-old.cpp	Thu Sep 11 10:19:26 2008
+++ human.cpp	Thu Sep 11 10:19:53 2008
@@ -739,6 +739,10 @@
 			break;
 	}
 
+	// if player's used the clutch manually then we dispense with
autoClutch
+	if (car->_clutchCmd != 0.0f)
+		HCtx[idx]->autoClutch = 0;
+
 	switch (cmd[CMD_THROTTLE].type) {
 		case GFCTRL_TYPE_JOY_AXIS:
 			throttle = joyInfo->ax[cmd[CMD_THROTTLE].val];
@@ -1041,7 +1045,7 @@
 		}
 	}
 
-	if (HCtx[idx]->autoClutch)
+	if (HCtx[idx]->autoClutch && car->_clutchCmd == 0.0f)
 		car->_clutchCmd = getAutoClutch(idx, car->_gear,
car->_gearCmd, car);
 
 }
@@ -1154,7 +1158,7 @@
 		}
     }
 
-	if (HCtx[idx]->autoClutch)
+	if (HCtx[idx]->autoClutch && car->_clutchCmd == 0.0f)
 	    car->_clutchCmd = getAutoClutch(idx, car->_gear, car->_gearCmd,
car);
 }

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Torcs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/torcs-devel