Player12
An open source football management simulator
Loading...
Searching...
No Matches
world_state_repository.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <cstdint>
12#include <memory>
13
15#include "global/types.h"
16#include "model/board.h"
17
25{
26 public:
27 explicit WorldStateRepository(std::shared_ptr<DatabaseConnection> db_conn);
28
30 bool loadWorldState(std::uint64_t& seed, PlayerID& next_player_id) const;
31
33 void saveWorldState(std::uint64_t seed, PlayerID next_player_id,
34 std::uint32_t next_staff_id) const;
35
37 std::uint32_t loadNextStaffId() const;
38
40 bool loadBoard(BoardState& board) const;
41
43 void saveBoard(const BoardState& board) const;
44
45 private:
46 std::shared_ptr<DatabaseConnection> db_conn;
47};
Persists the world seed, the player and staff id counters (table WorldState) and the managed club's b...
Definition world_state_repository.h:25
std::uint32_t loadNextStaffId() const
Definition world_state_repository.cpp:54
bool loadWorldState(std::uint64_t &seed, PlayerID &next_player_id) const
Definition world_state_repository.cpp:24
void saveBoard(const BoardState &board) const
Definition world_state_repository.cpp:117
std::shared_ptr< DatabaseConnection > db_conn
Definition world_state_repository.h:46
bool loadBoard(BoardState &board) const
Definition world_state_repository.cpp:65
void saveWorldState(std::uint64_t seed, PlayerID next_player_id, std::uint32_t next_staff_id) const
Definition world_state_repository.cpp:40
The board's view of the manager of the managed club.
Definition board.h:69
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21