|
|
|
@ -12,15 +12,14 @@ void RecordTracker::OnWallCrashed(WallCrashEvent *event) { |
|
|
|
|
|
|
|
|
|
void RecordTracker::checkJumpRecord() const { |
|
|
|
|
const uint64_t newRecord = jumped; |
|
|
|
|
FileManager::instance->readFile("record_jump.txt", [newRecord](const std::string& content){ |
|
|
|
|
if (content.empty()){ |
|
|
|
|
FileManager::instance->writeFile("record_jump.txt", std::to_string(newRecord)); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
FileManager::instance->readFile("record_jump.txt", [newRecord](std::string content){ |
|
|
|
|
if (content.empty()) |
|
|
|
|
content = "0"; |
|
|
|
|
uint64_t oldRecord = std::stoull(content); |
|
|
|
|
if (newRecord > oldRecord){ |
|
|
|
|
std::cout << "New jump record!" << std::endl; |
|
|
|
|
std::cout << "New jump record: " << newRecord << std::endl; |
|
|
|
|
FileManager::instance->writeFile("record_jump.txt", std::to_string(newRecord)); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|