本文整理汇总了C++中TIMER::AddCar方法的典型用法代码示例。如果您正苦于以下问题:C++ TIMER::AddCar方法的具体用法?C++ TIMER::AddCar怎么用?C++ TIMER::AddCar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIMER
的用法示例。
在下文中一共展示了TIMER::AddCar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToolSceneXml
//.........这里部分代码省略.........
sc.SaveXml(path +"scene.xml"); /// resave
//SplineRoad rd(this); rd.LoadFile(path+"road.xml");
//rd.SaveFile(path+"road1.xml"); // resave
}
//LogO(String("::: Time ALL tracks: ") + fToStr(ti.getMilliseconds(),0,3) + " ms");
LogO("ALL tracks scene ---------");
}
#else
//-------- Game Tools --------
///............................................................................................................................
/// _Tool_ ghosts times
///............................................................................................................................
void CGui::ToolGhosts()
{
LogO("ALL ghosts ---------");
using namespace std;
const string sim = 1 /**/ ? "normal" : "easy";
String msg="\n"; const float tMax = 10000.f;
TIMER tim;
// all cars
std::vector<string> cars;
std::vector<float> plc;
for (int c=0; c < data->cars->cars.size(); ++c)
{ cars.push_back(data->cars->cars[c].id);
plc.push_back(0.f); }
// foreach track
for (int i=0; i < data->tracks->trks.size(); ++i)
{ string trk = data->tracks->trks[i].name;
if (trk.substr(0,4) == "Test" && trk.substr(0,5) != "TestC") continue;
// records
tim.Load(PATHMANAGER::Records()+"/"+ sim+"/"+ trk+".txt", 0.f, pGame->error_output);
float timeES=tMax, timeBest=tMax;
for (int c=0; c < cars.size(); ++c)
{
tim.AddCar(cars[c]);
float t = tim.GetBestLap(c, false); //not reverse
plc[c] = t;
if (t == 0.f) continue;
if (t < timeBest) timeBest = t;
if (cars[c] == "ES" || cars[c] == "S1")
if (t < timeES) timeES = t;
}
if (timeES==tMax) timeES=0.f;
if (timeBest==tMax) timeBest=0.f;
// times.xml
float timeTrk = data->tracks->times[trk];// + 2;
//float timeB = timeTrk * 1.1f; // champs factor mostly 0.1
//const float decFactor = 1.5f;
//float score = max(0.f, (1.f + (timeB-timeES)/timeB * decFactor) * 100.f);
float place = app->GetRacePos(timeES,timeTrk,1.f,false);
/// write
#if 0
// format directly like times.xml
ostringstream s;
s << "\t<track name=\""+trk+"\"";
for (int i=0; i < 18-trk.length(); ++i)
s << " "; //align
s << "time=\""+fToStr(timeES,1)+"\" />";
msg += s.str()+"\n";
#else
// stats ..
ostringstream s;
s << fixed << left << setw(18) << trk; //align
#if 0
s << " E " << CHud::GetTimeShort(timeES); // Expected car ES or S1
s << " T " << CHud::GetTimeShort(timeTrk); // trk time from .xml
s << " b " << CHud::GetTimeShort(timeES == timeBest ? 0.f : timeBest);
s << " E-b " << (timeES > 0.f && timeES != timeBest ?
fToStr(timeES - timeBest ,0,2) : " ");
s << " T-E " << (timeES > 0.f ?
fToStr(timeTrk - timeES ,0,2) : " ");
s << " pET " << (timeES > 0.f ? fToStr(place,1,3) : " ");
#endif
// race pos for all cars from cur ghosts
for (int c=0; c < cars.size(); ++c)
{
float t = plc[c];
float cmul = app->GetCarTimeMul(cars[c], sim);
float pl = app->GetRacePos(t,timeTrk, cmul,false);
s << cars[c] << " " << (t > 0.f ? (pl > 20 ? " ." : fToStr(pl,0,2)) : " ") << " ";
} //90
//s << (score > 135.f ? " ! " : " ");
msg += s.str()+"\n";
#endif
}
LogO(msg);
//LogO("ALL ghosts ---------");
}