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

Medical centre: injured players with their expected return and recurrence risk, the injury risk of the available squad from workload and freshness, and what the physios and doctors contribute. More...

#include <medical_scene.h>

Inheritance diagram for MedicalScene:
ManagementScene GUIScene

Classes

struct  InjuryLine
 One injured player, pre-formatted. More...
 
struct  RiskLine
 One available player's fitness and risk, pre-formatted. More...
 
struct  StaffLine
 A physio or doctor. More...
 

Public Member Functions

 MedicalScene (GUIView *parent)
 
void update (float deltaTime) override
 Updates scene logic.
 
SceneID getID () const override
 Gets the ID of the scene.
 
- Public Member Functions inherited from ManagementScene
 ManagementScene (GUIView *guiViewPtr)
 
void render () final
 Renders the scene.
 
void onEnter () override
 Called when the scene is entered/becomes active.
 
void onResume () override
 Called when an overlay above this scene closes and it becomes the active scene again. Screens use it to refresh cached view models after a match, a transfer or any other state change made elsewhere.
 
void handleEvent (const SDL_Event &event) override
 
std::optional< NavEntry > historyEntry () const override
 
- Public Member Functions inherited from GUIScene
 GUIScene (GUIView *guiView_ptr)
 Constructs a new GUIScene.
 
virtual ~GUIScene ()=default
 Destroys the GUIScene.
 
virtual void onExit ()
 Called when the scene is exited/becomes inactive.
 
virtual void onResize (int width, int height)
 Called when the window is resized.
 

Protected Member Functions

void renderContent () override
 Draws the page body inside the content region.
 
NavSection navSection () const override
 Sidebar entry highlighted for this screen.
 
void refresh () override
 Rebuilds cached view models from the game state.
 
- Protected Member Functions inherited from ManagementScene
virtual std::optional< EditorContext > editorContext () const
 
void showToast (std::string message, bool isError=false)
 Shows a short confirmation message in the top bar.
 
HolidayDialog & holidayDialog ()
 Holiday planner and return report of this screen.
 
- Protected Member Functions inherited from GUIScene
SDL_Renderer * getRenderer () const
 Gets the SDL renderer.
 
SDL_Window * getWindow () const
 Gets the SDL window.
 
GUIView * getGuiView () const
 Gets the associated GUIView.
 
void changeScene (std::unique_ptr< GUIScene > newScene)
 Requests a scene change.
 
void quit ()
 Requests the application to quit.
 

Private Member Functions

void renderInjured (float width)
 
void renderRisk (float width)
 
void renderStaff (float width)
 
void renderPlayerLoad (float width)
 
void renderLoadChart (float height)
 
void select (PlayerID id)
 
void nameCell (PlayerID id, const std::string &name, const std::string &role, bool returning)
 
void setFlag (std::byte flag, bool enabled)
 

Private Attributes

std::vector< InjuryLine > injured
 
std::vector< RiskLine > risks
 
std::vector< StaffLine > staff
 
std::string recovery_effect
 
std::string prevention_effect
 
bool recovery_good = false
 
bool prevention_good = false
 
float average_condition = 0.0f
 
float average_sharpness = 0.0f
 
int high_risk = 0
 
int days_lost = 0
 
bool show_all = false
 
PlayerID selected = 0
 
std::string selected_name
 
std::byte selected_flags {}
 
std::int32_t chart_today = 0
 
std::array< LoadChartDay, MedicalCentre::LOAD_CHART_DAYS > chart {}
 
bool chart_empty = true
 

Friends

class GameFlowTest_GUIFlowLifecycle_Test
 

Additional Inherited Members

- Protected Attributes inherited from GUIScene
GUIView * guiView
 

Detailed Description

Medical centre: injured players with their expected return and recurrence risk, the injury risk of the available squad from workload and freshness, and what the physios and doctors contribute.

Constructor & Destructor Documentation

◆ MedicalScene()

MedicalScene::MedicalScene ( GUIView *  parent)
explicit

Member Function Documentation

◆ getID()

SceneID MedicalScene::getID ( ) const
inlineoverridevirtual

Gets the ID of the scene.

Returns
The SceneID of this scene.

GUIView uses this identifier to apply match-specific event and scene behavior.

Implements GUIScene.

◆ nameCell()

void MedicalScene::nameCell ( PlayerID  id,
const std::string &  name,
const std::string &  role,
bool  returning 
)
private

Name cell of both tables: selects the player for the load card.

◆ navSection()

NavSection MedicalScene::navSection ( ) const
inlineoverrideprotectedvirtual

Sidebar entry highlighted for this screen.

Implements ManagementScene.

◆ refresh()

void MedicalScene::refresh ( )
overrideprotectedvirtual

Rebuilds cached view models from the game state.

Reimplemented from ManagementScene.

◆ renderContent()

void MedicalScene::renderContent ( )
overrideprotectedvirtual

Draws the page body inside the content region.

Implements ManagementScene.

◆ renderInjured()

void MedicalScene::renderInjured ( float  width)
private

◆ renderLoadChart()

void MedicalScene::renderLoadChart ( float  height)
private

◆ renderPlayerLoad()

void MedicalScene::renderPlayerLoad ( float  width)
private

Load chart and medical instructions of the selected player.

◆ renderRisk()

void MedicalScene::renderRisk ( float  width)
private

◆ renderStaff()

void MedicalScene::renderStaff ( float  width)
private

◆ select()

void MedicalScene::select ( PlayerID  id)
private

Selects id for the load card and reads his chart and flags.

◆ setFlag()

void MedicalScene::setFlag ( std::byte  flag,
bool  enabled 
)
private

◆ update()

void MedicalScene::update ( float  deltaTime)
overridevirtual

Updates scene logic.

Parameters
deltaTimeThe time elapsed since the last update.

Implements GUIScene.

Friends And Related Symbol Documentation

◆ GameFlowTest_GUIFlowLifecycle_Test

friend class GameFlowTest_GUIFlowLifecycle_Test
friend

Member Data Documentation

◆ average_condition

float MedicalScene::average_condition = 0.0f
private

◆ average_sharpness

float MedicalScene::average_sharpness = 0.0f
private

◆ chart

std::array<LoadChartDay, MedicalCentre::LOAD_CHART_DAYS> MedicalScene::chart {}
private

◆ chart_empty

bool MedicalScene::chart_empty = true
private

◆ chart_today

std::int32_t MedicalScene::chart_today = 0
private

◆ days_lost

int MedicalScene::days_lost = 0
private

◆ high_risk

int MedicalScene::high_risk = 0
private

◆ injured

std::vector<InjuryLine> MedicalScene::injured
private

◆ prevention_effect

std::string MedicalScene::prevention_effect
private

e.g. "-5% injury risk".

◆ prevention_good

bool MedicalScene::prevention_good = false
private

◆ recovery_effect

std::string MedicalScene::recovery_effect
private

e.g. "-8% layoff length".

◆ recovery_good

bool MedicalScene::recovery_good = false
private

◆ risks

std::vector<RiskLine> MedicalScene::risks
private

◆ selected

PlayerID MedicalScene::selected = 0
private

Player shown in the load card (0: none) and his cached data.

◆ selected_flags

std::byte MedicalScene::selected_flags {}
private

◆ selected_name

std::string MedicalScene::selected_name
private

◆ show_all

bool MedicalScene::show_all = false
private

Risk table: everyone or only raised risk.

◆ staff

std::vector<StaffLine> MedicalScene::staff
private

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