/** * @brief get the next frame size * TupleRecord consiss of two frame ( header and Body) * Transaction Record has a single frame * @return the next frame size */ size_t GetNextFrameSize(FILE *log_file, size_t log_file_size) { size_t frame_size; char buffer[sizeof(int32_t)]; // Check if the frame size is broken if (IsFileTruncated(log_file, sizeof(buffer), log_file_size)) { return 0; } // Otherwise, read the frame size size_t ret = fread(buffer, 1, sizeof(buffer), log_file); if (ret <= 0) { LOG_ERROR("Error occured in fread "); } // Read next 4 bytes as an integer CopySerializeInputBE frameCheck(buffer, sizeof(buffer)); frame_size = (frameCheck.ReadInt()) + sizeof(buffer); ; // Move back by 4 bytes // So that tuple deserializer works later as expected int res = fseek(log_file, -sizeof(buffer), SEEK_CUR); if (res == -1) { LOG_ERROR("Error occured in fseek "); } // Check if the frame is broken if (IsFileTruncated(log_file, frame_size, log_file_size)) { return 0; } return frame_size; }
// Function that's called at the beginning of every frame. bool Character::frameStarted(const Ogre::FrameEvent &event) { frameAttack(); frameCheck(); frameMovement(); frameAnimation(event); return true; }