jump record tracker

main
Benjamin Kraft 2 years ago
parent f03e03101b
commit 75af403e27
  1. 15
      src/FileManager.cpp
  2. 2
      src/Game.cpp

@ -26,13 +26,20 @@ void FileManager::writeFile(const std::string &path, const std::string &content,
FileManager * FileManager::instance = new FileManager;
void FileReadCommand::execute() {
std::ifstream in(path);
if (in.is_open()){
std::string line, content;
while (std::getline(in, line))
content += line;
in.close();
readCallback(content);
} else
readCallback("");
}
void FileWriteCommand::execute() {
std::ofstream out;
auto mode = append ? std::ios_base::app : std::ios_base::out;
out.open(path, mode);
const auto mode = append ? std::ios_base::app : std::ios_base::out;
std::ofstream out(path, mode);
out << content;
out.close();
}

@ -3,6 +3,7 @@
#include "InputWindow.h"
#include "Window.h"
#include "Logger.h"
#include "RecordTracker.h"
#include <random>
void Game::draw(QPixmap &output) {
@ -66,6 +67,7 @@ Game::Game() {
Game::eventQueue->registerListener(&spec);
InputWindow::inputQueue->registerListener(&player);
Game::eventQueue->registerListener(new Logger);
Game::eventQueue->registerListener(new RecordTracker);
instance = this;
}

Loading…
Cancel
Save