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

Pieces shared by the transfer dialogs: the structured offer editor (fee, upfront share, instalments, add-ons, sell-on), captions, panels and right-aligned action rows. More...

Functions

void formLabel (const char *text)
 
void alignActions (std::initializer_list< const char * > labels)
 
bool beginPanel (const char *id, const char *title)
 
void endPanel ()
 
bool snapToOptions (TransferNegotiation::OfferTerms &terms)
 
bool edit (TransferNegotiation::OfferTerms &terms, std::span< const UI::MoneyChip > fee_chips)
 
bool snapLoanToOptions (TransferNegotiation::LoanTerms &terms)
 
bool editLoan (TransferNegotiation::LoanTerms &terms, std::uint32_t market_value)
 
std::string loanTermsLine (const TransferNegotiation::LoanTerms &terms)
 
std::string structureText (const TransferNegotiation::OfferTerms &terms)
 
template<typename T , typename V >
int optionIndex (std::span< const T > options, V value)
 
template<typename T , std::size_t N, typename V >
int optionIndex (const std::array< T, N > &options, V value)
 

Variables

constexpr std::array< std::uint8_t, 7 > UPFRONT_OPTIONS
 
constexpr std::array< const char *, 7 > UPFRONT_LABELS
 
constexpr std::array< const char *, 5 > YEAR_LABELS
 
constexpr std::array< std::uint16_t, 4 > APPEARANCE_TARGETS
 
constexpr std::array< std::uint16_t, 4 > GOAL_TARGETS = {5, 10, 15, 20}
 
constexpr std::array< std::uint8_t, 7 > SELL_ON_OPTIONS
 
constexpr std::array< const char *, 7 > SELL_ON_LABELS
 
constexpr std::uint8_t DEFAULT_INSTALMENT_YEARS = 2
 
constexpr std::int64_t FEE_STEP = 10'000
 
constexpr int LOAN_WAGE_SHARE_STEP = 5
 
constexpr std::array< std::uint8_t, 7 > MIN_APPEARANCE_OPTIONS
 

Detailed Description

Pieces shared by the transfer dialogs: the structured offer editor (fee, upfront share, instalments, add-ons, sell-on), captions, panels and right-aligned action rows.

Function Documentation

◆ alignActions()

void TransferTermsEditor::alignActions ( std::initializer_list< const char * >  labels)

Moves the cursor so the buttons labelled labels end at the right edge (null labels are skipped).

◆ beginPanel()

bool TransferTermsEditor::beginPanel ( const char *  id,
const char *  title 
)

Card-looking panel for dialogs, built on a one-cell table instead of a child window so an auto-sized dialog fits its content on the first frame. Pair with endPanel() when it returns true.

◆ edit()

bool TransferTermsEditor::edit ( TransferNegotiation::OfferTerms &  terms,
std::span< const UI::MoneyChip >  fee_chips 
)

Editor of a structured club-to-club offer: the fee (with fee_chips), the upfront share and instalment years, appearance and goal add-ons with their targets and the sell-on share. Returns true when a value changed.

◆ editLoan()

bool TransferTermsEditor::editLoan ( TransferNegotiation::LoanTerms &  terms,
std::uint32_t  market_value 
)

Editor of loan terms: length, the borrower's share of the wage, loan fee, a purchase option or obligation with its fee (chips from market_value), a recall clause and guaranteed appearances with the fee owed if he plays fewer. Returns true when a value changed.

◆ endPanel()

void TransferTermsEditor::endPanel ( )

◆ formLabel()

void TransferTermsEditor::formLabel ( const char *  text)

Small muted caption above a dialog field.

◆ loanTermsLine()

std::string TransferTermsEditor::loanTermsLine ( const TransferNegotiation::LoanTerms &  terms)

Loan terms in one line: "60% of wage, to the season's end · fee €100K · option €2.0M · recall · 10 apps or €200K".

◆ optionIndex() [1/2]

template<typename T , std::size_t N, typename V >
int TransferTermsEditor::optionIndex ( const std::array< T, N > &  options,
V  value 
)

◆ optionIndex() [2/2]

template<typename T , typename V >
int TransferTermsEditor::optionIndex ( std::span< const T >  options,
V  value 
)

Index of value among options (the nearest one if absent).

◆ snapLoanToOptions()

bool TransferTermsEditor::snapLoanToOptions ( TransferNegotiation::LoanTerms &  terms)

Snaps loan terms onto the editor's steps; true when something moved.

◆ snapToOptions()

bool TransferTermsEditor::snapToOptions ( TransferNegotiation::OfferTerms &  terms)

Snaps a structure onto the editor's segments (upfront share, instalment years, add-on targets, sell-on), so what is highlighted is what is sent. Every value the buyer AI proposes is already a segment; this only moves values of older saves. Returns true when something changed.

◆ structureText()

std::string TransferTermsEditor::structureText ( const TransferNegotiation::OfferTerms &  terms)

Payment structure in words: "Cash" or "60% upfront, 3 yrs".

Variable Documentation

◆ APPEARANCE_TARGETS

constexpr std::array<std::uint16_t, 4> TransferTermsEditor::APPEARANCE_TARGETS
inlineconstexpr
Initial value:
= {10, 20, 30,
50}

◆ DEFAULT_INSTALMENT_YEARS

constexpr std::uint8_t TransferTermsEditor::DEFAULT_INSTALMENT_YEARS = 2
inlineconstexpr

◆ FEE_STEP

constexpr std::int64_t TransferTermsEditor::FEE_STEP = 10'000
inlineconstexpr

◆ GOAL_TARGETS

constexpr std::array<std::uint16_t, 4> TransferTermsEditor::GOAL_TARGETS = {5, 10, 15, 20}
inlineconstexpr

◆ LOAN_WAGE_SHARE_STEP

constexpr int TransferTermsEditor::LOAN_WAGE_SHARE_STEP = 5
inlineconstexpr

◆ MIN_APPEARANCE_OPTIONS

constexpr std::array<std::uint8_t, 7> TransferTermsEditor::MIN_APPEARANCE_OPTIONS
inlineconstexpr
Initial value:
= {
0, 5, 10, 15, 20, 25, 30}

◆ SELL_ON_LABELS

constexpr std::array<const char*, 7> TransferTermsEditor::SELL_ON_LABELS
inlineconstexpr
Initial value:
= {
"0%", "5%", "10%", "15%", "20%", "25%", "30%"}

◆ SELL_ON_OPTIONS

constexpr std::array<std::uint8_t, 7> TransferTermsEditor::SELL_ON_OPTIONS
inlineconstexpr
Initial value:
= {0, 5, 10, 15,
20, 25, 30}

◆ UPFRONT_LABELS

constexpr std::array<const char*, 7> TransferTermsEditor::UPFRONT_LABELS
inlineconstexpr
Initial value:
= {
"100%", "80%", "60%", "50%", "40%", "30%", "20%"}

◆ UPFRONT_OPTIONS

constexpr std::array<std::uint8_t, 7> TransferTermsEditor::UPFRONT_OPTIONS
inlineconstexpr
Initial value:
= {100, 80, 60, 50,
40, 30, 20}

◆ YEAR_LABELS

constexpr std::array<const char*, 5> TransferTermsEditor::YEAR_LABELS
inlineconstexpr
Initial value:
= {"1", "2", "3", "4",
"5"}