change arguments and add eof check

Revert "fix: buff station cycling and dying too soon"

This reverts commit 1c6cb2921e10eb2000ac40007d0c2636ba2ac151.

fix: buff station cycling and dying too soon

Tested that the buff station now only cycles after it has been built and has been alive for 25 seconds.
This commit is contained in:
David Markowitz 2025-04-10 19:14:03 -07:00
parent 2cf0eac8f2
commit 824e0793fa
2 changed files with 4 additions and 2 deletions

View File

@ -54,10 +54,10 @@ Sd0::Sd0(std::istream& buffer) {
return; return;
} }
while (buffer) { while (buffer && buffer.peek() != std::istream::traits_type::eof()) {
uint32_t chunkSize{}; uint32_t chunkSize{};
if (!BinaryIO::BinaryRead(buffer, chunkSize)) { if (!BinaryIO::BinaryRead(buffer, chunkSize)) {
LOG("Failed to read chunk size from stream %li %li", buffer.tellg(), m_Chunks.size()); LOG("Failed to read chunk size from stream %lld %zu", buffer.tellg(), m_Chunks.size());
break; break;
} }
auto& chunk = m_Chunks.emplace_back(); auto& chunk = m_Chunks.emplace_back();

View File

@ -8,6 +8,8 @@
#include <vector> #include <vector>
// Sd0 is comprised of multiple zlib compressed buffers stored in a row. // Sd0 is comprised of multiple zlib compressed buffers stored in a row.
// The format starts with a SD0 header (see SD0_HEADER) followed by the size of a zlib buffer, and then the zlib buffer itself.
// This repeats until end of file
class Sd0 { class Sd0 {
public: public:
using BinaryBuffer = std::vector<uint8_t>; using BinaryBuffer = std::vector<uint8_t>;