Player12
An open source football management simulator
Loading...
Searching...
No Matches
NewsFeed Namespace Reference

The world news feed: dated stories derived from saved data. More...

Functions

std::vector< NewsItem > build (const NewsSources &sources, const GameDateValue &from, const GameDateValue &to)
 
std::vector< NewsItem > forGame (const Game &game, const GameData &gamedata)
 
std::vector< std::size_t > filter (std::span< const NewsItem > items, const NewsFilter &filter)
 
std::size_t variant (NewsKind kind, std::uint32_t first, std::uint32_t second, const GameDateValue &date, std::size_t count)
 

Variables

constexpr std::uint32_t MAJOR_FEE = 12'000'000
 
constexpr int UPSET_REPUTATION_GAP = 18
 
constexpr std::uint16_t LEADER_MIN_PLAYED = 6
 
constexpr int RACE_GAMES_LEFT = 8
 
constexpr int RACE_POINTS_GAP = 3
 

Detailed Description

The world news feed: dated stories derived from saved data.

Pure and deterministic: the same saved facts give the same stories in the same order (newest first), so the feed is identical after a reload. It never writes anything (no inbox messages, no saved state).

Function Documentation

◆ build()

std::vector< NewsItem > NewsFeed::build ( const NewsSources &  sources,
const GameDateValue &  from,
const GameDateValue &  to 
)

Stories dated from from to to (inclusive), newest first.

◆ filter()

std::vector< std::size_t > NewsFeed::filter ( std::span< const NewsItem >  items,
const NewsFilter &  filter 
)

Indices of the stories filter keeps, in feed order.

◆ forGame()

std::vector< NewsItem > NewsFeed::forGame ( const Game &  game,
const GameData &  gamedata 
)

The feed of a running game: this season and the last one up to today, from every saved source (transfers, managers, inbox dismissal reports, awards, league records and the managed club's, season history and this season's fixtures).

◆ variant()

std::size_t NewsFeed::variant ( NewsKind  kind,
std::uint32_t  first,
std::uint32_t  second,
const GameDateValue &  date,
std::size_t  count 
)

Headline variant for a story: a hash of its facts, never a random draw.

Variable Documentation

◆ LEADER_MIN_PLAYED

constexpr std::uint16_t NewsFeed::LEADER_MIN_PLAYED = 6
inlineconstexpr

Matches a new league leader must have played to be news.

◆ MAJOR_FEE

constexpr std::uint32_t NewsFeed::MAJOR_FEE = 12'000'000
inlineconstexpr

Fees from this amount make the world news (euros).

◆ RACE_GAMES_LEFT

constexpr int NewsFeed::RACE_GAMES_LEFT = 8
inlineconstexpr

Title race: at most this many games left and points between the top two.

◆ RACE_POINTS_GAP

constexpr int NewsFeed::RACE_POINTS_GAP = 3
inlineconstexpr

◆ UPSET_REPUTATION_GAP

constexpr int NewsFeed::UPSET_REPUTATION_GAP = 18
inlineconstexpr

Reputation gap between loser and winner that makes a result an upset.