MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Update

Method Update

ogsr_engine/xrGame/ui/UIOutfitInfo.cpp:95–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93#include "script_game_object.h"
94
95void CUIOutfitInfo::Update(CCustomOutfit* outfit)
96{
97 string128 _buff;
98
99 auto artefactEffects = Actor()->ActiveArtefactsOnBelt();
100
101 m_listWnd->Clear(false); // clear existing items and do not scroll to top
102
103 for (u32 i = _item_start; i < _max_item_index; ++i)
104 {
105 CUIStatic* _s = m_items[i];
106
107 if (!_s)
108 continue;
109
110 float _val_outfit = 0.0f;
111 float _val_af = 0.0f;
112
113 if (i < _max_item_index1)
114 {
115 _val_outfit = GetArtefactParam(artefactEffects, i);
116
117 float _actor_val = pSettings->r_float("actor_condition", _actor_param_names[i]);
118 _val_outfit = (_val_outfit / _actor_val);
119 }
120 else
121 {
122 _val_outfit = outfit ? outfit->GetDefHitTypeProtection(ALife::EHitType(i - _max_item_index1)) : 1.0f;
123 _val_outfit = 1.0f - _val_outfit;
124
125 _val_af = Actor()->HitArtefactsOnBelt(1.0f, ALife::EHitType(i - _max_item_index1));
126 _val_af = 1.0f - _val_af;
127 }
128
129 if (fsimilar(_val_outfit, 0.0f) && fsimilar(_val_af, 0.0f))
130 {
131 continue;
132 }
133
134 LPCSTR _sn = "";
135 if (i != _item_radiation_restore_speed && i != _item_power_restore_speed)
136 {
137 _val_outfit *= 100.0f;
138 _val_af *= 100.0f;
139 _sn = "%";
140 }
141
142 if (i == _item_bleeding_restore_speed)
143 _val_outfit *= -1.0f;
144
145 LPCSTR _color = (_val_outfit > 0) ? "%c[green]" : "%c[red]";
146
147 if (i == _item_bleeding_restore_speed || i == _item_radiation_restore_speed)
148 _color = (_val_outfit > 0) ? "%c[red]" : "%c[green]";
149
150 LPCSTR _imm_name = *CStringTable().translate(_imm_st_names[i]);
151
152 int _sz = sprintf_s(_buff, sizeof(_buff), "%s ", _imm_name);

Callers

nothing calls this directly

Calls 15

ActorFunction · 0.85
fsimilarFunction · 0.85
CStringTableClass · 0.85
lua_functionFunction · 0.85
ActiveArtefactsOnBeltMethod · 0.80
HitArtefactsOnBeltMethod · 0.80
AddWindowMethod · 0.80
line_existMethod · 0.80
functorMethod · 0.80
lua_game_objectMethod · 0.80
EHitTypeEnum · 0.50

Tested by

no test coverage detected