This commit is contained in:
2026-05-19 22:35:10 +02:00
parent d93e71e716
commit 0b45643ef2
21 changed files with 806 additions and 235 deletions

View File

@@ -36,17 +36,23 @@ namespace {
file << "Točke: " << score << "\n";
file << "Datum: " << std::put_time(&localTime, "%Y-%m-%d %H:%M:%S") << "\n";
// Replay system
// Replay system with form state
std::vector<Game::Object::Transform> playerHistory;
std::vector<bool> formHistory;
Game::GameManager::getPlayerPositionHistory(playerHistory);
Game::GameManager::getPlayerFormHistory(formHistory);
std::ofstream replayFile("replay.txt", std::ios::trunc);
if (!replayFile.is_open()) {
WARN("Neuspešno odpiranje replay.txt za pisanje");
return;
}
for (const auto& transform : playerHistory) {
replayFile << transform.x << " " << transform.y << " " << transform.rotation << " " << transform.scaleX << " " << transform.scaleY << "\n";
for (size_t i = 0; i < playerHistory.size(); ++i) {
const auto& transform = playerHistory[i];
bool isShipMode = (i < formHistory.size()) ? formHistory[i] : true;
int shipFlag = isShipMode ? 1 : 0;
replayFile << transform.x << " " << transform.y << " " << transform.rotation << " " << transform.scaleX << " " << transform.scaleY << " " << shipFlag << "\n";
}
LOG("Zapis končne statistike in replaya igre dokončan");