Player12
An open source football management simulator
Loading...
Searching...
No Matches
WorldStateRepository Class Reference

Persists the world seed, the player and staff id counters (table WorldState) and the managed club's board state (table BoardState). More...

#include <world_state_repository.h>

Public Member Functions

 WorldStateRepository (std::shared_ptr< DatabaseConnection > db_conn)
 
bool loadWorldState (std::uint64_t &seed, PlayerID &next_player_id) const
 
void saveWorldState (std::uint64_t seed, PlayerID next_player_id, std::uint32_t next_staff_id) const
 
std::uint32_t loadNextStaffId () const
 
bool loadBoard (BoardState &board) const
 
void saveBoard (const BoardState &board) const
 

Private Attributes

std::shared_ptr< DatabaseConnection > db_conn
 

Detailed Description

Persists the world seed, the player and staff id counters (table WorldState) and the managed club's board state (table BoardState).

Constructor & Destructor Documentation

◆ WorldStateRepository()

WorldStateRepository::WorldStateRepository ( std::shared_ptr< DatabaseConnection >  db_conn)
explicit

Member Function Documentation

◆ loadBoard()

bool WorldStateRepository::loadBoard ( BoardState &  board) const

Loads the board state; false when none is stored.

◆ loadNextStaffId()

std::uint32_t WorldStateRepository::loadNextStaffId ( ) const

Stored staff id counter; 0 when unknown (older saves).

◆ loadWorldState()

bool WorldStateRepository::loadWorldState ( std::uint64_t &  seed,
PlayerID &  next_player_id 
) const

Loads the world state; false when the save predates it.

◆ saveBoard()

void WorldStateRepository::saveBoard ( const BoardState &  board) const

Writes the board state (a single row).

◆ saveWorldState()

void WorldStateRepository::saveWorldState ( std::uint64_t  seed,
PlayerID  next_player_id,
std::uint32_t  next_staff_id 
) const

Writes the world state with the staff id counter (StaffID).

Member Data Documentation

◆ db_conn

std::shared_ptr<DatabaseConnection> WorldStateRepository::db_conn
private

The documentation for this class was generated from the following files: