Review changes
This commit is contained in:
parent
a4b92a02d9
commit
273a181f8f
|
@ -46,20 +46,16 @@ void CarlaRecorderLightScenes::Write(std::ofstream &OutFile)
|
|||
std::streampos PosStart = OutFile.tellp();
|
||||
|
||||
// write a dummy packet size
|
||||
uint32_t Total = 0;
|
||||
uint32_t Total = 2 + Lights.size() * sizeof(CarlaRecorderLightScene);
|
||||
WriteValue<uint32_t>(OutFile, Total);
|
||||
|
||||
// write total records
|
||||
Total = Lights.size();
|
||||
WriteValue<uint16_t>(OutFile, Total);
|
||||
|
||||
for (uint16_t i=0; i<Total; ++i)
|
||||
Lights[i].Write(OutFile);
|
||||
for (auto& Light : Lights)
|
||||
{
|
||||
Light.Write(OutFile);
|
||||
}
|
||||
|
||||
// write the real packet size
|
||||
std::streampos PosEnd = OutFile.tellp();
|
||||
Total = PosEnd - PosStart - sizeof(uint32_t);
|
||||
OutFile.seekp(PosStart, std::ios::beg);
|
||||
WriteValue<uint32_t>(OutFile, Total);
|
||||
OutFile.seekp(PosEnd, std::ios::beg);
|
||||
}
|
||||
|
|
|
@ -39,23 +39,16 @@ void CarlaRecorderLightVehicles::Write(std::ofstream &OutFile)
|
|||
// write the packet id
|
||||
WriteValue<char>(OutFile, static_cast<char>(CarlaRecorderPacketId::VehicleLight));
|
||||
|
||||
std::streampos PosStart = OutFile.tellp();
|
||||
|
||||
// write a dummy packet size
|
||||
uint32_t Total = 0;
|
||||
uint32_t Total = 2 + Vehicles.size() * sizeof(CarlaRecorderLightVehicle);
|
||||
WriteValue<uint32_t>(OutFile, Total);
|
||||
|
||||
// write total records
|
||||
Total = Vehicles.size();
|
||||
WriteValue<uint16_t>(OutFile, Total);
|
||||
|
||||
for (uint16_t i=0; i<Total; ++i)
|
||||
Vehicles[i].Write(OutFile);
|
||||
|
||||
// write the real packet size
|
||||
std::streampos PosEnd = OutFile.tellp();
|
||||
Total = PosEnd - PosStart - sizeof(uint32_t);
|
||||
OutFile.seekp(PosStart, std::ios::beg);
|
||||
WriteValue<uint32_t>(OutFile, Total);
|
||||
OutFile.seekp(PosEnd, std::ios::beg);
|
||||
for (auto& Vehicle : Vehicles)
|
||||
{
|
||||
Vehicle.Write(OutFile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -555,7 +555,7 @@ void CarlaReplayer::ProcessLightScene(void)
|
|||
uint16_t Total;
|
||||
CarlaRecorderLightScene LightScene;
|
||||
|
||||
// read Total walkers
|
||||
// read Total light events
|
||||
ReadValue<uint16_t>(File, Total);
|
||||
for (uint16_t i = 0; i < Total; ++i)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue