Re #787 Fixed MSVC 2005 warnings

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5353 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
pouillot 2013-03-24 10:26:22 +00:00
parent 5be631e407
commit 844769ce56
23 changed files with 52 additions and 40 deletions

View File

@ -1891,7 +1891,8 @@ float Driver::getClutch()
// move offset to allow for bends (if any)
float Driver::adjustOffset(float offset)
{
return offset;
return offset;
#if 0
float adjustment = (float) (rldata->rInverse * 10);
float width = (float) (car->_trkPos.seg->width * 0.75);
@ -1938,6 +1939,7 @@ return offset;
offset -= adjustment;
return offset;
#endif
}
// Compute target point for steering.
@ -2077,6 +2079,7 @@ vec2f Driver::getTargetPoint(bool use_lookahead, double targetoffset)
return s;
}
#if 0
// all the BT code below is for steering into pits only.
s.x = (seg->vertex[TR_SL].x + seg->vertex[TR_SR].x)/2;
s.y = (seg->vertex[TR_SL].y + seg->vertex[TR_SR].y)/2;
@ -2108,6 +2111,7 @@ vec2f Driver::getTargetPoint(bool use_lookahead, double targetoffset)
return t;
}
#endif
}
@ -3662,6 +3666,7 @@ float Driver::filterTrk(float accel)
{
return accel;
#if 0
tTrackSeg* seg = car->_trkPos.seg;
if (car->_speed_x < MAX_UNSTUCK_SPEED || // Too slow.
@ -3693,6 +3698,7 @@ float Driver::filterTrk(float accel)
}
}
}
#endif
}

View File

@ -751,6 +751,7 @@ real ANN_RBFBackpropagate(LISTITEM * p, real * d, bool use_eligibility, real TD)
}
return 0.0f;
/*
//update weights
for (i = 0; i < l->n_inputs; i++) {
RBFConnection *c = &l->rbf[i * l->n_outputs];
@ -766,6 +767,7 @@ real ANN_RBFBackpropagate(LISTITEM * p, real * d, bool use_eligibility, real TD)
}
}
return 0.0f;
*/
}
/// Perform batch adaptation

View File

@ -146,7 +146,7 @@ SGVec3<float>::fromGeod(const SGGeod& geod)
{
SGVec3<double> cart;
SGGeodesy::SGGeodToCart(geod, cart);
return SGVec3<float>(cart(0), cart(1), cart(2));
return SGVec3<float>((float)cart(0), (float)cart(1), (float)cart(2));
}
template<>
@ -166,7 +166,7 @@ SGVec3<float>::fromGeoc(const SGGeoc& geoc)
{
SGVec3<double> cart;
SGGeodesy::SGGeocToCart(geoc, cart);
return SGVec3<float>(cart(0), cart(1), cart(2));
return SGVec3<float>((float)cart(0), (float)cart(1), (float)cart(2));
}
/// Unary +, do nothing ...

View File

@ -56,7 +56,6 @@ bool RtInitTimer()
#else
return false;
#endif
return false;
}
// Get timer frequency [Hz]

View File

@ -94,7 +94,7 @@ int GfEventLoop::Private::translateKeySym(int code, int modifier, int unicode)
{
// Truncate unicodes above GF_MAX_KEYCODE (no need for more).
keyUnicode = unicode ? (unicode & GF_MAX_KEYCODE) : code;
_mapUnicodes[keyId] = keyUnicode;
_mapUnicodes[keyId] = (unsigned short)keyUnicode;
GfLogDebug("translateKeySym(c=%X, m=%X, u=%X) : '%c', id=%X, ucode=%X (nk=%d)\n",
code, modifier, unicode, // Truncate high bits for MSVC 2010 bugs.
(keyUnicode > 0 && keyUnicode < 128 && isprint(keyUnicode & 0x7F))

View File

@ -1560,6 +1560,8 @@ static tFormAnswer func_op_compare( tFormNode *node, void *parmHandle, char cons
found = equal || ( smaller && greater );
result.boolean = ( arg1.boolean == arg2.boolean && equal ) ||
( arg1.boolean != arg2.boolean && smaller && greater );
} else {
result.boolean = FALSE;
}
if( found ) {
@ -1814,7 +1816,7 @@ static tFormAnswer func_toAlpha( tFormNode *node, void *parmHandle, char const *
result.string[ length ] = '\0';
//GfLogDebug( "result.string[ %d ] = \'\\0\'\n", length );
for( xx = length - 1; xx >= 0; --xx ) {
result.string[ xx ] = 'A' + ( number % 26 );
result.string[ xx ] = (char)( 'A' + ( number % 26 ) );
number -= number % 26;
number /= 26;
}

View File

@ -22,7 +22,7 @@
#include "openalmusicplayer.h"
const int OpenALMusicPlayer::BUFFERSIZE = 4096*64;
const ALfloat OpenALMusicPlayer::FADESTEP = 0.01;
const ALfloat OpenALMusicPlayer::FADESTEP = 0.01f;
OpenALMusicPlayer::OpenALMusicPlayer(SoundStream* soundStream):
_device(NULL),

View File

@ -470,7 +470,7 @@ public:
inline float getVisibility() const { return effective_visibility; }
inline void setVisibility( float v )
{
effective_visibility = visibility = (v <= 25.0) ? 25.0 : v;
effective_visibility = visibility = (v <= 25.0f) ? 25.0f : v;
}
};

View File

@ -1213,7 +1213,7 @@ grDrawCar(tSituation *s, tCarElt *car, tCarElt *curCar, int dispCarFlag, int dis
// choose a rearwing model to display
int curDRM = 0;
float curAngle = 0.0f;
int lastDRM = grCarInfo[index].DRMSelector->getSelect();
//int lastDRM = grCarInfo[index].DRMSelector->getSelect();
for (i=0; i<grCarInfo[index].nDRM; i++)
{

View File

@ -414,18 +414,19 @@ void doAnisotropicFiltering(){
GLfloat fLargest;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &fLargest);
if(aniS ==1)
{
aniD = fLargest/2;
}
if(aniS==2)
{
aniD = fLargest;
switch(aniS)
{
case 1:
aniD = fLargest/2;
break;
case 2:
aniD = fLargest;
break;
default:
aniD = 0;
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniD);/**/
}
}

View File

@ -319,7 +319,7 @@ void grTrackLightInit()
void grTrackLightUpdate( tSituation *s )
{
char phase = ( (int)floor( fmod( s->currentTime + 120.0f, (double)0.3f ) / 0.3f ) % 2 ) + 1;
char phase = (char)( ( (int)floor( fmod( s->currentTime + 120.0f, (double)0.3f ) / 0.3f ) % 2 ) + 1 );
manageStartLights( &trackLights, s, phase );
}

View File

@ -196,7 +196,7 @@ bool NetClient::ConnectToServer(const char *pAddress,int port, NetDriver *pDrive
ENetEvent event;
enet_address_set_host (& address, pAddress);
address.port = port;
address.port = (enet_uint16)port;
/* Initiate the connection, allocating the two channels 0 and 1. */
GfLogError ("Initiating network connection to host '%s:%d' ...\n", pAddress, port);
@ -675,7 +675,7 @@ void NetClient::ReadAllDriverReadyPacket(ENetPacket *pPacket)
pNData->m_vecReadyStatus.clear();
pNData->m_vecReadyStatus.resize(rsize);
for (int i=0;i<rsize;i++)
pNData->m_vecReadyStatus[i] = msg.unpack_int();
pNData->m_vecReadyStatus[i] = msg.unpack_int() ? true : false;
UnlockNetworkData();
SetRaceInfoChanged(true);

View File

@ -105,7 +105,7 @@ bool RobotXml::ReadRobotDrivers(const char*pRobotName,std::vector<NetDriver> &ve
ENetAddress address;
enet_address_set_host (& address, strHost.c_str());
driver.address.host = address.host;
driver.address.port = (int)GfParmGetNum(params, path2, "port",NULL,0);
driver.address.port = (enet_uint16)GfParmGetNum(params, path2, "port",NULL,0);
strncpy(driver.module,NETWORKROBOT,64);
vecDrivers.push_back(driver);
printf("Adding driver \n");

View File

@ -137,7 +137,7 @@ bool NetServer::Start(int port)
m_address.host = ENET_HOST_ANY;
/* Bind the server to port*/
m_address.port = port;
m_address.port = (enet_uint16)port;
assert(m_pServer ==NULL);
@ -615,11 +615,12 @@ void NetServer::ReadDriverReadyPacket(ENetPacket *pPacket)
{
msg.unpack_ubyte();
idx = msg.unpack_int();
bReady = msg.unpack_int();
bReady = msg.unpack_int() ? true : false;
}
catch (PackedBufferException &e)
{
GfLogFatal("SendRaceSetupPacket: packed buffer error\n");
bReady = false;
}
NetMutexData *pNData = LockNetworkData();
@ -658,7 +659,7 @@ void NetServer::ReadDriverInfoPacket(ENetPacket *pPacket, ENetPeer * pPeer)
driver.blue = msg.unpack_float();
msg.unpack_string(driver.module, sizeof driver.module);
msg.unpack_string(driver.type, sizeof driver.type);
driver.client = msg.unpack_int();
driver.client = msg.unpack_int() ? true : false;
}
catch (PackedBufferException &e)
{
@ -809,7 +810,7 @@ void NetServer::SendFilePacket(const char *pszFile)
unsigned int filesize = size;
GfLogTrace("Server file size %u\n",filesize);
short namelen = strlen(pszFile);
short namelen = (short)strlen(pszFile);
/* On 64 bit systems, the following calculates a buffer size that is
* bigger than necessary, but that is safe. Better too big than too

View File

@ -100,12 +100,12 @@ static void ReCareerUtilManipString( char* string, int number, int bufLength )
break;
case 'A':
memmove( &(string[curPos]), &(string[curPos+1]), ( bufLength - curPos - 1 ) * sizeof( char ) );
string[curPos] = 'A' + number;
string[curPos] = (char)( 'A' + number );
++curPos;
break;
case 'a':
memmove( &(string[curPos]), &(string[curPos+1]), ( bufLength - curPos - 1 ) * sizeof( char ) );
string[curPos] = 'a' + number;
string[curPos] = (char)( 'a' + number );
++curPos;
break;
case '1':
@ -120,7 +120,7 @@ static void ReCareerUtilManipString( char* string, int number, int bufLength )
if( curPos + numLength < bufLength ) {
memmove( &(string[curPos + numLength]), &(string[curPos + 2]), (bufLength - curPos - numLength) * sizeof( char ) );
for( xx = numLength - 1; xx >= 0; --xx ) {
string[ curPos + xx ] = '0' + ( num % 10 );
string[ curPos + xx ] = (char)( '0' + ( num % 10 ) );
num /= 10;
}
string[ bufLength - 1 ] = '\0';
@ -436,7 +436,7 @@ static void* ReCareerNewClass( const char* filename, void *prevParam, void **fir
groupAlpha[ 0 ] = '_';
groupAlpha[ 2 ] = '\0';
for( xx = 0; xx < nbGroups; ++xx ) {
groupAlpha[ 1 ] = 'A' + xx;
groupAlpha[ 1 ] = (char)( 'A' + xx );
curParam = ReCareerNewGroup( filename, subparam, groupAlpha, nbDrivers / nbGroups + ( ( nbDrivers % nbGroups ) > xx ? 1 : 0 ),
totalTracks, xx );
if( curParam ) {

View File

@ -688,7 +688,7 @@ SimCarCollideInit(tTrack *track)
// Hmm, why is caching disabled, are our objects too fast, so it does not work?
// TODO: understand this and reconsider caching.
dtDisableCaching();
dtSetTolerance(0.001);
dtSetTolerance((DT_Scalar)0.001);
fixedid = 0;

View File

@ -683,7 +683,7 @@ SimCarCollideInit(tTrack *track)
// Hmm, why is caching disabled, are our objects too fast, so it does not work?
// TODO: understand this and reconsider caching.
dtDisableCaching();
dtSetTolerance(0.001);
dtSetTolerance((DT_Scalar)0.001);
fixedid = 0;

View File

@ -955,7 +955,7 @@ SimCarCollideInit(void)
{
dtSetDefaultResponse(SimCarCollideResponse, DT_SMART_RESPONSE, NULL);
dtDisableCaching();
dtSetTolerance(0.001);
dtSetTolerance((DT_Scalar)0.001);
}

View File

@ -171,7 +171,7 @@ SimWingUpdate(tCar *car, int index, tSituation* s)
}
else // 30 deg -> 90 deg smoothly reduced downforce
{
sinaoa = 0.25 * (1 - ((aoa-PI_3)/PI_6)*((aoa-PI_3)/PI_6)*((aoa-PI_3)/PI_6));
sinaoa = 0.25f * (1.0f - ((aoa-PI_3)/PI_6)*((aoa-PI_3)/PI_6)*((aoa-PI_3)/PI_6));
}
wing->forces.z = (float) MIN(0.0,wing->Kz * vt2 * sinaoa);
}

View File

@ -272,8 +272,8 @@ SimCarUpdateForces(tCar *car)
/* desired torque to stop yaw */
desiredTq = - car->DynGC.vel.az / ( SimDeltaTime * car->Iinv.z );
if ( (fabs(desiredTq - F.M.z)) < 0.5 * w * car->wheelbase) {F.M.z = desiredTq;}
else if ( (desiredTq - F.M.z) > 0.0 ) {F.M.z += 0.5 * w * car->wheelbase;}
else {F.M.z -= 0.5 * w * car->wheelbase;}
else if ( (desiredTq - F.M.z) > 0.0 ) {F.M.z += 0.5f * w * car->wheelbase;}
else {F.M.z -= 0.5f * w * car->wheelbase;}
/* desired force to really stop the car when braking to 0 */
if ( ((car->ctrl->brakeCmd > 0.05) || (car->ctrl->ebrakeCmd > 0.1) || (car->ctrl->brakeFrontLeftCmd > 0.02)
|| (car->ctrl->brakeFrontRightCmd > 0.02) || (car->ctrl->brakeRearLeftCmd > 0.02) || (car->ctrl->brakeRearRightCmd > 0.02) )

View File

@ -215,7 +215,7 @@ void SimWheelUpdateForce(tCar *car, int index)
sy = 0.0f;
} else {
if (car->features & FEAT_SLOWGRIP) {
sx = (vt - wrl) / MAX(fabs(vt), 1.0); //avoid divergence
sx = (vt - wrl) / MAX(fabs(vt), 1.0f); //avoid divergence
sy = sin(sa);
} else {
sx = (vt - wrl) / fabs(vt);

View File

@ -137,7 +137,7 @@ GetTrackHeader(void *TrackHandle) {
// Read Local Info section
tTrackLocalInfo *local = &theTrack->local;
local->station = GfParmGetStr(TrackHandle, TRK_SECT_LOCAL, TRK_ATT_STATION, "LFPG");
local->timezone = GfParmGetNum(TrackHandle, TRK_SECT_LOCAL, TRK_ATT_TIMEZONE, (char*)NULL, 0);
local->timezone = (int)GfParmGetNum(TrackHandle, TRK_SECT_LOCAL, TRK_ATT_TIMEZONE, (char*)NULL, 0);
local->anyrainlkhood = GfParmGetNum(TrackHandle, TRK_SECT_LOCAL, TRK_ATT_ANYRAINLKHD, (char*)NULL, 0);
local->littlerainlkhood = GfParmGetNum(TrackHandle, TRK_SECT_LOCAL, TRK_ATT_LITTLERAINLKHD, (char*)NULL, 0);
local->mediumrainlkhood = GfParmGetNum(TrackHandle, TRK_SECT_LOCAL, TRK_ATT_MEDIUMRAINLKHD, (char*)NULL, 0);

View File

@ -2387,13 +2387,13 @@ void computeObjectTriNorm(ob_t * object)
int checkMustSmoothVector(point_t *n1, point_t *n2, point_t *t1, point_t *t2)
{
return FALSE;
/*
double dot, cos_angle;
cos_angle = cos(smooth_angle * M_PI / 180.0);
if (fabs(t1->x - t2->x) <= 0.05 && fabs(t1->y - t2->y) <= 0.05
&& fabs(t1->z - t2->z) <= 0.05)
{
/* GUIONS */
// GUIONS
dot = n1->x * n2->x + n1->y * n2->y + n1->z * n2->z;
if (dot > cos_angle)
{
@ -2402,6 +2402,7 @@ int checkMustSmoothVector(point_t *n1, point_t *n2, point_t *t1, point_t *t2)
}
return FALSE;
*/
}
void smoothTriNorm(ob_t * object)