2class SCR_EditableEntityCoreBudgetSetting
5 protected ref SCR_UIInfo
m_Info;
11 protected int m_iMinBudgetCost;
13 protected int m_iCurrentBudget;
15 protected SCR_BudgetEditorComponent m_BudgetEditor;
17 protected int m_iReservedBudget;
23 int GetMinBudgetCost()
25 return m_iMinBudgetCost;
27 int GetCurrentBudget()
29 return m_iCurrentBudget;
38 int GetReservedBudget()
40 return m_iReservedBudget;
45 void ReserveBudget(
int reserveValue)
47 m_iReservedBudget += reserveValue;
52 void UnreserveBudget(
int reserveValue)
54 m_iReservedBudget -= reserveValue;
55 if (m_iReservedBudget < 0)
56 m_iReservedBudget = 0;
59 int SetCurrentBudget(
int budgetValue)
61 int oldBudget = m_iCurrentBudget;
62 m_iCurrentBudget = budgetValue;
64 return m_iCurrentBudget - oldBudget;
67 int AddToBudget(SCR_EntityBudgetValue budgetCost = null)
69 int budgetCostValue = GetMinBudgetCost();
70 if (budgetCost) budgetCostValue = budgetCost.GetBudgetValue();
72 int budgetChange = Math.Max(budgetCostValue, GetMinBudgetCost());
73 m_iCurrentBudget += budgetChange;
78 int AddToBudget(
int budgetValue)
80 int budgetChange = Math.Max(budgetValue, GetMinBudgetCost());
81 m_iCurrentBudget += budgetChange;
86 int SubtractFromBudget(SCR_EntityBudgetValue budgetCost = null)
88 int budgetCostValue = GetMinBudgetCost();
89 if (budgetCost) budgetCostValue = Math.Max(budgetCost.GetBudgetValue(), budgetCostValue);
91 const int previousBudget = m_iCurrentBudget;
92 m_iCurrentBudget = Math.Max(m_iCurrentBudget - budgetCostValue, 0);
94 return previousBudget - m_iCurrentBudget;
97 int SubtractFromBudget(
int budgetValue)
99 const int prevBudget = m_iCurrentBudget;
100 m_iCurrentBudget = Math.Max(m_iCurrentBudget - budgetValue, 0);
102 const int budgetChange = prevBudget - m_iCurrentBudget;
104 #ifdef BUDGET_OPTIMIZATION_CHECKS
105 if(budgetChange != budgetValue)
107 Print(
"GM Budget got clamped at some point!",
LogLevel.WARNING);
110 return -budgetChange;
113 void SetBudgetComponent(notnull SCR_BudgetEditorComponent budgetEditor)
115 m_BudgetEditor = budgetEditor;
120 if (budgetValue == -1)
124 m_iMinBudgetCost = minBudgetCost;
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
ref SCR_HintUIInfo m_Info
EEditableEntityBudget m_BudgetType
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
override SCR_UIInfo GetInfo()
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute