Skip to content

Commit e4f78f7

Browse files
committed
Релиз версии 1.4.3
1 parent 212fe5d commit e4f78f7

4 files changed

+21
-4
lines changed

game/GameController.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void GameController::clearGrid() {
7878
gpuAutomaton.ClearGrid();
7979
}
8080

81-
void GameController::update(float deltaTime) {
81+
void GameController::update(ULONGLONG deltaTime) {
8282
static auto lastUpdate = std::chrono::steady_clock::now();
8383
if (isRunning) {
8484
auto now = std::chrono::steady_clock::now();

game/GameController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class GameController {
117117

118118

119119
void clearGrid();
120-
void update(float deltaTime);
120+
void update(ULONGLONG deltaTime);
121121
void startSimulation();
122122
void stopSimulation();
123123
void stepSimulation();

game/GameStateManager.cpp

+18-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,31 @@
44
bool GameStateManager::SavePatternToCellsFile(const std::string& filename, const std::vector<std::vector<bool>>& pattern, const std::string& patternName) {
55
if (pattern.empty() || pattern[0].empty()) return false;
66

7-
std::ofstream file("./patterns/"+filename);
7+
// Задаём путь к папке patterns
8+
const std::string folderPath = "./patterns";
9+
10+
// Проверяем существование папки и создаём её, если отсутствует
11+
if (!std::filesystem::exists(folderPath)) {
12+
try {
13+
std::filesystem::create_directory(folderPath);
14+
}
15+
catch (const std::filesystem::filesystem_error& e) {
16+
std::cerr << "Failed to create directory 'patterns': " << e.what() << std::endl;
17+
return false; // Возвращаем false, если не удалось создать папку
18+
}
19+
}
20+
21+
// Открываем файл для записи
22+
std::ofstream file(folderPath + "/" + filename);
823
if (!file.is_open()) {
24+
std::cerr << "Failed to open file: " << folderPath << "/" << filename << std::endl;
925
return false; // Ошибка открытия файла
1026
}
1127

1228
// Записываем метаданные
1329
file << "!Name: " << patternName << "\n";
1430
file << "!Created by Game of Life 3D\n";
15-
file << "!Welcom to https://github.com/AsuRaHan/GameOfLife3D\n";
31+
file << "!Welcome to https://github.com/AsuRaHan/GameOfLife3D\n";
1632

1733
// Записываем паттерн
1834
for (size_t y = 0; y < pattern.size(); ++y) {

game/GameStateManager.h

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <sstream>
1212
#include <iostream>
1313
#include <cstring> // для memcmp
14+
#include <filesystem>
1415

1516
#pragma comment(lib, "Cabinet.lib")
1617

0 commit comments

Comments
 (0)