From ec2a02ae29f150a76d6c2180198234c7ba2c791a Mon Sep 17 00:00:00 2001 From: iobyte Date: Sat, 26 Feb 2022 00:26:42 +0000 Subject: [PATCH] only use TORCS campatibility functions in robots git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8050 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: efe85a6c95c32b3738356012ee2d852bcf843acf Former-commit-id: dc88145c33e58e8a58667ea592b8a648ced74789 --- src/modules/graphic/osggraph/Car/OsgCar.cpp | 18 +++++++++--------- src/modules/graphic/osggraph/Car/OsgWheel.cpp | 2 +- .../graphic/osggraph/Render/OsgRender.cpp | 4 ++-- .../graphic/osggraph/Render/OsgShader.cpp | 2 +- .../graphic/osggraph/Scenery/OsgBackground.cpp | 2 +- .../graphic/osggraph/Scenery/OsgScenery.cpp | 10 +++++----- src/modules/graphic/osggraph/Viewer/OsgHUD.cpp | 6 +++--- src/modules/racing/genparoptv1/racemain.cpp | 8 ++++---- src/modules/racing/standardgame/racetrack.cpp | 4 ++-- .../racing/standardgame/racewebmetar.cpp | 2 +- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/modules/graphic/osggraph/Car/OsgCar.cpp b/src/modules/graphic/osggraph/Car/OsgCar.cpp index 45cdb42ca..385a73634 100644 --- a/src/modules/graphic/osggraph/Car/OsgCar.cpp +++ b/src/modules/graphic/osggraph/Car/OsgCar.cpp @@ -199,7 +199,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat osgLoader loader; - std::string TmpPath = GetDataDir(); + std::string TmpPath = GfDataDir(); std::string strTPath; index = car->index; /* current car's index */ @@ -261,7 +261,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat car->_carName); /* default car 3D model file */ snprintf(path, nMaxTexPathSize, "%s/%s/1", SECT_GROBJECTS, LST_RANGES); - std::string strPath = GetDataDir(); + std::string strPath = GfDataDir(); if(bMasterModel) snprintf(buf, nMaxTexPathSize, "cars/models/%s/%s.acc", car->_masterModel, car->_masterModel); @@ -313,7 +313,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat { _wing1 = true; - std::string tmp = GetDataDir(); + std::string tmp = GfDataDir(); snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName); tmp = tmp+buf; @@ -391,7 +391,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat this->DRMSelector2 = new osg::Switch; this->RearWingSelector = new osg::Switch; this->RearWingSelector->setName("WINGREAR"); - std::string tmp = GetDataDir(); + std::string tmp = GfDataDir(); snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName); tmp = tmp+buf; @@ -430,7 +430,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat if (param) { _cockpit = true; - std::string tmp = GetDataDir(); + std::string tmp = GfDataDir(); snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName); tmp = tmp+buf; @@ -455,7 +455,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat if (param) { _steer = true; - std::string tmpPath = GetDataDir(); + std::string tmpPath = GfDataDir(); snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName); tmpPath = tmpPath+buf; @@ -499,7 +499,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat if (param) { - tmpPath = GetDataDir(); + tmpPath = GfDataDir(); snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName); tmpPath = tmpPath+buf; @@ -552,7 +552,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat this->DRMSelector = new osg::Switch; this->carTransform->addChild(DriverSelector.get()); - std::string tmp = GetLocalDir(); + std::string tmp = GfLocalDir(); std::string driver_path; // add the drivers @@ -690,7 +690,7 @@ osg::ref_ptr SDCar::initOcclusionQuad(tCarElt *car) int i; char buf[512]; - std::string TmpPath = GetDataDir(); + std::string TmpPath = GfDataDir(); // GfOut("\n################## LOADING SHADOW ###############################\n"); std::string shadowTextureName = GfParmGetStr(car->_carHandle, SECT_GROBJECTS, PRM_SHADOW_TEXTURE, ""); diff --git a/src/modules/graphic/osggraph/Car/OsgWheel.cpp b/src/modules/graphic/osggraph/Car/OsgWheel.cpp index d9c3ae2bc..5914c4fcf 100644 --- a/src/modules/graphic/osggraph/Car/OsgWheel.cpp +++ b/src/modules/graphic/osggraph/Car/OsgWheel.cpp @@ -82,7 +82,7 @@ osg::ref_ptr SDWheels::initWheel(int wheelIndex, const cha const bool bCustomSkin = strlen(this->car->_skinName) != 0; std::string bSkinName; - std::string TmpPath = GetDataDir(); + std::string TmpPath = GfDataDir(); if (bCustomSkin) { diff --git a/src/modules/graphic/osggraph/Render/OsgRender.cpp b/src/modules/graphic/osggraph/Render/OsgRender.cpp index ec408fe57..aeb385d76 100644 --- a/src/modules/graphic/osggraph/Render/OsgRender.cpp +++ b/src/modules/graphic/osggraph/Render/OsgRender.cpp @@ -160,7 +160,7 @@ void SDRender::Init(tTrack *track) { SDTrack = track; - std::string datapath = GetDataDir(); + std::string datapath = GfDataDir(); //datapath +="/"; thesky = new SDSky; GfLogDebug("SDSky class\n"); @@ -798,7 +798,7 @@ void SDRender::UpdateSky(double currentTime, double accelTime, double X, double void SDRender::weather(void) { - std::string datapath = GetDataDir(); + std::string datapath = GfDataDir(); double domeSizeRatio = SDSkyDomeDistance / 80000.0; // Cloud layers. diff --git a/src/modules/graphic/osggraph/Render/OsgShader.cpp b/src/modules/graphic/osggraph/Render/OsgShader.cpp index d1cf21027..e5a765502 100644 --- a/src/modules/graphic/osggraph/Render/OsgShader.cpp +++ b/src/modules/graphic/osggraph/Render/OsgShader.cpp @@ -33,7 +33,7 @@ SDCarShader::SDCarShader(osg::Node *car, SDCar *c) { - std::string TmpPath = GetDataDir(); + std::string TmpPath = GfDataDir(); program = new osg::Program; program->addShader(osgDB::readShaderFile(osg::Shader::VERTEX, diff --git a/src/modules/graphic/osggraph/Scenery/OsgBackground.cpp b/src/modules/graphic/osggraph/Scenery/OsgBackground.cpp index ddcde731d..751d45f75 100644 --- a/src/modules/graphic/osggraph/Scenery/OsgBackground.cpp +++ b/src/modules/graphic/osggraph/Scenery/OsgBackground.cpp @@ -43,7 +43,7 @@ void SDBackground::build(int X, int Y, int Z, const std::string& TrackPath) { osgDB::Registry::instance()->clearObjectCache(); - std::string LocalPath = GetDataDir(); + std::string LocalPath = GfDataDir(); osgDB::FilePathList pathList = osgDB::Registry::instance()->getDataFilePathList(); diff --git a/src/modules/graphic/osggraph/Scenery/OsgScenery.cpp b/src/modules/graphic/osggraph/Scenery/OsgScenery.cpp index 2b9727372..e25e96110 100644 --- a/src/modules/graphic/osggraph/Scenery/OsgScenery.cpp +++ b/src/modules/graphic/osggraph/Scenery/OsgScenery.cpp @@ -122,7 +122,7 @@ void SDScenery::LoadScene(tTrack *track) GfLogError("No specified track 3D model file\n"); } - std::string PathTmp = GetDataDir(); + std::string PathTmp = GfDataDir(); _bgsky = strcmp(GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_BGSKY, GR_ATT_BGSKY_DISABLED), GR_ATT_BGSKY_ENABLED) == 0; if (_bgsky) @@ -134,7 +134,7 @@ void SDScenery::LoadScene(tTrack *track) GfLogDebug("Background loaded\n"); } - std::string strPath = GetDataDir(); + std::string strPath = GfDataDir(); snprintf(buf, 256, "tracks/%s/%s/", SDTrack->category, SDTrack->internalname); std::string ext = osgDB::getFileExtension(acname); @@ -152,7 +152,7 @@ void SDScenery::LoadScene(tTrack *track) { strPath+=buf; - std::string strTPath = GetDataDir(); + std::string strTPath = GfDataDir(); osgDB::FilePathList pathList = osgDB::Registry::instance()->getDataFilePathList(); pathList.push_back(strPath); GfLogDebug("Track Path : %s\n", pathList.back().c_str()); @@ -233,7 +233,7 @@ bool SDScenery::LoadTrack(std::string& strTrack) GfLogDebug("Texture Path : %s\n", _strTexturePath.c_str()); loader.AddSearchPath(_strTexturePath); - std::string strTPath = GetDataDir(); + std::string strTPath = GfDataDir(); strTPath += "data/textures/"; GfLogDebug("Texture Path : %s\n", strTPath.c_str()); loader.AddSearchPath(strTPath); @@ -245,7 +245,7 @@ bool SDScenery::LoadTrack(std::string& strTrack) pTrack->getOrCreateStateSet()->setRenderBinDetails(TRACKBIN,"RenderBin"); _scenery->addChild(pTrack); #if 0 - std::string Tpath = GetLocalDir(); + std::string Tpath = GfLocalDir(); Tpath = Tpath+"/track.osg"; osgDB::writeNodeFile( *pTrack, Tpath); #endif diff --git a/src/modules/graphic/osggraph/Viewer/OsgHUD.cpp b/src/modules/graphic/osggraph/Viewer/OsgHUD.cpp index 083421011..cb02fde6a 100644 --- a/src/modules/graphic/osggraph/Viewer/OsgHUD.cpp +++ b/src/modules/graphic/osggraph/Viewer/OsgHUD.cpp @@ -141,7 +141,7 @@ OSGPLOT::OSGPLOT( osgTitle->setColor(color); std::string fontFileUrl = "/vera/Vera.ttf"; - std::string fontsMainDirectory = GetDataDir(); + std::string fontsMainDirectory = GfDataDir(); fontsMainDirectory = fontsMainDirectory+"data/fonts"; fontFileUrl = fontsMainDirectory+fontFileUrl; osgTitle->setFont(fontFileUrl); @@ -1635,7 +1635,7 @@ osg::ref_ptr SDHUD::generateHudFromXmlFile(int scrH, int scrW) //set the font { - std::string fontsMainDirectory = GetDataDir(); + std::string fontsMainDirectory = GfDataDir(); fontsMainDirectory = fontsMainDirectory+"data/fonts"; fontFileUrl = fontsMainDirectory+fontFileUrl; text->setFont(fontFileUrl); @@ -1718,7 +1718,7 @@ osg::ref_ptr SDHUD::generateHudFromXmlFile(int scrH, int scrW) GfLogDebug("OSGHUD: Generate image object: %s \n", elementId.c_str()); //start preparing the image - std::string filename = GetDataDir(); + std::string filename = GfDataDir(); filename = filename+url; //get the bounding box diff --git a/src/modules/racing/genparoptv1/racemain.cpp b/src/modules/racing/genparoptv1/racemain.cpp index 973a4acd7..4fdad72e1 100644 --- a/src/modules/racing/genparoptv1/racemain.cpp +++ b/src/modules/racing/genparoptv1/racemain.cpp @@ -929,12 +929,12 @@ const char* SetupGlobalFileName(char* buf, int size, tgenData* Data, const char* if (Data->WeatherCode == 0) { snprintf(buf,size,"%sdrivers/%s/%s/%s%s", - GetLocalDir(),Data->RobotName,Data->CarType,Data->TrackName,Ext); + GfLocalDir(),Data->RobotName,Data->CarType,Data->TrackName,Ext); } else { snprintf(buf,size,"%sdrivers/%s/%s/%s-%d%s", - GetLocalDir(),Data->RobotName,Data->CarType,Data->TrackName,Data->WeatherCode,Ext); + GfLocalDir(),Data->RobotName,Data->CarType,Data->TrackName,Data->WeatherCode,Ext); } } else @@ -942,12 +942,12 @@ const char* SetupGlobalFileName(char* buf, int size, tgenData* Data, const char* if (Data->WeatherCode == 0) { snprintf(buf,size,"%sdrivers/%s/%s/default%s", - GetLocalDir(),Data->RobotName,Data->CarType,Ext); + GfLocalDir(),Data->RobotName,Data->CarType,Ext); } else { snprintf(buf,size,"%sdrivers/%s/%s/default-%d%s", - GetLocalDir(),Data->RobotName,Data->CarType,Data->WeatherCode,Ext); + GfLocalDir(),Data->RobotName,Data->CarType,Data->WeatherCode,Ext); } } diff --git a/src/modules/racing/standardgame/racetrack.cpp b/src/modules/racing/standardgame/racetrack.cpp index 3d3fe71e2..a8caf9af2 100644 --- a/src/modules/racing/standardgame/racetrack.cpp +++ b/src/modules/racing/standardgame/racetrack.cpp @@ -530,7 +530,7 @@ reTrackInitRealWeather(void) else { char buffer[1024]; - snprintf(buffer, sizeof(buffer), "%sconfig/weather.txt", GetLocalDir()); + snprintf(buffer, sizeof(buffer), "%sconfig/weather.txt", GfLocalDir()); std::string data = buffer; GfLogDebug("Path weather.txt : %s\n", data.c_str()); @@ -739,7 +739,7 @@ reTrackInitSimuWeather(void) #endif std::ostringstream weatherfile; - weatherfile << GetDataDir() << "data/weather/" << trackLocal->station << "/" + weatherfile << GfDataDir() << "data/weather/" << trackLocal->station << "/" << std::setw(2) << std::setfill('0') << std::right << now.tm_mday << "-" << std::setw(2) << std::setfill('0') << std::right << (now.tm_mon + 1) << ".txt"; diff --git a/src/modules/racing/standardgame/racewebmetar.cpp b/src/modules/racing/standardgame/racewebmetar.cpp index 6d6129907..6193d1abc 100755 --- a/src/modules/racing/standardgame/racewebmetar.cpp +++ b/src/modules/racing/standardgame/racewebmetar.cpp @@ -106,7 +106,7 @@ bool ReWebMetar::ReWebMetarFtp(const string& m) CURLcode res; char buffer[1024]; - snprintf(buffer, sizeof(buffer), "%sconfig/weather.txt", GetLocalDir()); + snprintf(buffer, sizeof(buffer), "%sconfig/weather.txt", GfLocalDir()); GfLogDebug("Save Weather file in = %s\n", buffer); GfLogDebug("URL WebMetar = %s\n", m.c_str());