Skip to content

Commit e86bd60

Browse files
author
Pavel Kovalenko
committed
Rename SDrawStaticStruct -> StaticDrawableWrapper.
1 parent 0d00ac8 commit e86bd60

File tree

11 files changed

+32
-31
lines changed

11 files changed

+32
-31
lines changed

res/gamedata/scripts/lua_help.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ C++ class color {
838838

839839
};
840840

841-
C++ class SDrawStaticStruct {
841+
C++ class StaticDrawableWrapper {
842842
property m_endTime;
843843

844844
function wnd();

src/xrGame/ActorInput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void CActor::IR_OnKeyboardPress(int cmd)
179179
inventory().ClientEat (itm);
180180
}
181181

182-
SDrawStaticStruct* _s = CurrentGameUI()->AddCustomStatic("item_used", true);
182+
StaticDrawableWrapper* _s = CurrentGameUI()->AddCustomStatic("item_used", true);
183183
string1024 str;
184184
strconcat (sizeof(str),str,*CStringTable().translate("st_item_used"),": ", itm->NameItem());
185185
_s->wnd()->TextItemControl()->SetText(str);

src/xrGame/UIGameCustom.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct predicate_find_stat
2424
{
2525
const char* id;
2626
predicate_find_stat(const char* id) { this->id = id; }
27-
bool operator()(SDrawStaticStruct* s)
27+
bool operator()(StaticDrawableWrapper* s)
2828
{
2929
return s->m_name == id;
3030
}
@@ -55,7 +55,7 @@ void CUIGameCustom::OnFrame()
5555
CDialogHolder::OnFrame();
5656
for (auto item : CustomStatics)
5757
item->Update();
58-
auto comparer = [](const SDrawStaticStruct* s1, const SDrawStaticStruct* s2)
58+
auto comparer = [](const StaticDrawableWrapper* s1, const StaticDrawableWrapper* s2)
5959
{
6060
return s1->IsActual() > s2->IsActual();
6161
};
@@ -79,7 +79,7 @@ void CUIGameCustom::OnFrame()
7979

8080
void CUIGameCustom::Render()
8181
{
82-
for (SDrawStaticStruct* item : CustomStatics)
82+
for (StaticDrawableWrapper* item : CustomStatics)
8383
item->Draw();
8484
Window->Draw();
8585
CEntity* pEntity = smart_cast<CEntity*>(Level().CurrentEntity());
@@ -105,7 +105,7 @@ void CUIGameCustom::Render()
105105
DoRenderDialogs();
106106
}
107107

108-
SDrawStaticStruct* CUIGameCustom::AddCustomStatic(const char* id, bool singleInstance)
108+
StaticDrawableWrapper* CUIGameCustom::AddCustomStatic(const char* id, bool singleInstance)
109109
{
110110
if (singleInstance)
111111
{
@@ -114,8 +114,8 @@ SDrawStaticStruct* CUIGameCustom::AddCustomStatic(const char* id, bool singleIns
114114
return *it;
115115
}
116116
CUIXmlInit xmlInit;
117-
CustomStatics.push_back(xr_new<SDrawStaticStruct>());
118-
SDrawStaticStruct* sss = CustomStatics.back();
117+
CustomStatics.push_back(xr_new<StaticDrawableWrapper>());
118+
StaticDrawableWrapper* sss = CustomStatics.back();
119119
sss->m_static = xr_new<CUIStatic>();
120120
sss->m_name = id;
121121
xmlInit.InitStatic(*MsgConfig, id, 0, sss->m_static);
@@ -125,7 +125,7 @@ SDrawStaticStruct* CUIGameCustom::AddCustomStatic(const char* id, bool singleIns
125125
return sss;
126126
}
127127

128-
SDrawStaticStruct* CUIGameCustom::GetCustomStatic(const char* id)
128+
StaticDrawableWrapper* CUIGameCustom::GetCustomStatic(const char* id)
129129
{
130130
auto it = std::find_if(CustomStatics.begin(), CustomStatics.end(), predicate_find_stat(id));
131131
if (it != CustomStatics.end())
@@ -270,25 +270,25 @@ void CUIGameCustom::enable_fake_indicators(bool enable)
270270
UIMainIngameWnd->get_hud_states()->EnableFakeIndicators(enable);
271271
}
272272

273-
SDrawStaticStruct::SDrawStaticStruct()
273+
StaticDrawableWrapper::StaticDrawableWrapper()
274274
{
275275
m_static = nullptr;
276276
m_endTime = -1.0f;
277277
}
278278

279-
void SDrawStaticStruct::destroy()
279+
void StaticDrawableWrapper::destroy()
280280
{
281281
delete_data(m_static);
282282
}
283283

284-
bool SDrawStaticStruct::IsActual() const
284+
bool StaticDrawableWrapper::IsActual() const
285285
{
286286
if (m_endTime < 0)
287287
return true;
288288
return Device.fTimeGlobal < m_endTime;
289289
}
290290

291-
void SDrawStaticStruct::SetText(const char* text)
291+
void StaticDrawableWrapper::SetText(const char* text)
292292
{
293293
m_static->Show(text != nullptr);
294294
if (text)
@@ -298,13 +298,13 @@ void SDrawStaticStruct::SetText(const char* text)
298298
}
299299
}
300300

301-
void SDrawStaticStruct::Draw()
301+
void StaticDrawableWrapper::Draw()
302302
{
303303
if (m_static->IsShown())
304304
m_static->Draw();
305305
}
306306

307-
void SDrawStaticStruct::Update()
307+
void StaticDrawableWrapper::Update()
308308
{
309309
if (IsActual() && m_static->IsShown())
310310
m_static->Update();

src/xrGame/UIGameCustom.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ struct KillMessageStruct;
2121
class CUIMainIngameWnd;
2222
class CUIMessagesWindow;
2323

24-
struct SDrawStaticStruct : public IPureDestroyableObject
24+
struct StaticDrawableWrapper : public IPureDestroyableObject
2525
{
26-
SDrawStaticStruct();
27-
virtual void destroy();
2826
CUIStatic* m_static;
2927
float m_endTime;
3028
shared_str m_name;
29+
30+
StaticDrawableWrapper();
31+
virtual void destroy();
3132
void Draw();
3233
void Update();
3334
CUIStatic* wnd() { return m_static; }
@@ -81,7 +82,7 @@ class CUIGameCustom :
8182
protected:
8283
CUIWindow* Window;
8384
CUIXml* MsgConfig;
84-
xr_vector<SDrawStaticStruct*> CustomStatics;
85+
xr_vector<StaticDrawableWrapper*> CustomStatics;
8586
CUIActorMenu* ActorMenu;
8687
CUIPdaWnd* PdaMenu;
8788
bool showGameIndicators;
@@ -111,8 +112,8 @@ class CUIGameCustom :
111112
void ShowCrosshair(bool show) { psHUD_Flags.set(HUD_CROSSHAIR_RT, show); }
112113
bool CrosshairShown() { return !!psHUD_Flags.test(HUD_CROSSHAIR_RT); }
113114
virtual void HideShownDialogs() {}
114-
SDrawStaticStruct* AddCustomStatic(const char* id, bool singleInstance);
115-
SDrawStaticStruct* GetCustomStatic(const char* id);
115+
StaticDrawableWrapper* AddCustomStatic(const char* id, bool singleInstance);
116+
StaticDrawableWrapper* GetCustomStatic(const char* id);
116117
void RemoveCustomStatic(const char* id);
117118
void CommonMessageOut(const char* text);
118119
virtual void ChangeTotalMoneyIndicator(const char* newMoneyString) {}

src/xrGame/UIGameCustom_script.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ void CUIGameCustom::script_register(lua_State *L)
1414
{
1515
module(L)
1616
[
17-
class_< SDrawStaticStruct >("SDrawStaticStruct")
18-
.def_readwrite("m_endTime", &SDrawStaticStruct::m_endTime)
19-
.def("wnd", &SDrawStaticStruct::wnd),
17+
class_< StaticDrawableWrapper >("StaticDrawableWrapper")
18+
.def_readwrite("m_endTime", &StaticDrawableWrapper::m_endTime)
19+
.def("wnd", &StaticDrawableWrapper::wnd),
2020

2121
class_< CUIGameCustom >("CUIGameCustom")
2222
.def("AddDialogToRender", &CUIGameCustom::AddDialogToRender)

src/xrGame/UIGameSP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bool CUIGameSP::IR_UIOnKeyboardPress(int dik)
133133

134134
if ( t1 && t1->m_Description.c_str() )
135135
{
136-
SDrawStaticStruct* sm2 = AddCustomStatic("secondary_task", true);
136+
StaticDrawableWrapper* sm2 = AddCustomStatic("secondary_task", true);
137137
sm2->m_static->TextItemControl()->SetTextST (t1->m_Description.c_str());
138138
}
139139
}break;

src/xrGame/UIGameSP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CUIGameSP : public CUIGameCustom
4040
CUITalkWnd* TalkMenu;
4141
CChangeLevelWnd* UIChangeLevelWnd;
4242

43-
SDrawStaticStruct* m_game_objective;
43+
StaticDrawableWrapper* m_game_objective;
4444
};
4545

4646

src/xrGame/ai/monsters/basemonster/base_monster_feel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void CBaseMonster::HitEntity(const CEntity *pEntity, float fDamage, float impuls
107107
if (pEntityNC == Actor() && draw_hit_marks) {
108108
START_PROFILE("BaseMonster/Animation/HitEntity");
109109

110-
SDrawStaticStruct* s = CurrentGameUI()->AddCustomStatic("monster_claws", false);
110+
StaticDrawableWrapper* s = CurrentGameUI()->AddCustomStatic("monster_claws", false);
111111

112112
float h1,p1;
113113
Device.vCameraDirection.getHP (h1,p1);

src/xrGame/ai/monsters/controller/controller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ void CController::UpdateCL()
437437

438438
if (percent < TEXTURE_SIZE_PERCENT ) {
439439
CurrentGameUI()->RemoveCustomStatic("controller_fx2");
440-
SDrawStaticStruct* s = CurrentGameUI()->AddCustomStatic("controller_fx", true);
440+
StaticDrawableWrapper* s = CurrentGameUI()->AddCustomStatic("controller_fx", true);
441441

442442
float x1 = Device.dwWidth / 2 - ((Device.dwWidth / 2) * percent);
443443
float y1 = Device.dwHeight / 2 - ((Device.dwHeight / 2) * percent);
@@ -447,7 +447,7 @@ void CController::UpdateCL()
447447
s->wnd()->SetWndRect (Frect().set(x1,y1,x2-x1,y2-y1));
448448
} else if (percent2 > 0){
449449
CurrentGameUI()->RemoveCustomStatic("controller_fx");
450-
SDrawStaticStruct* s = CurrentGameUI()->AddCustomStatic("controller_fx2", true);
450+
StaticDrawableWrapper* s = CurrentGameUI()->AddCustomStatic("controller_fx2", true);
451451

452452
float x1 = Device.dwWidth / 2 - ((Device.dwWidth / 2) * percent2);
453453
float y1 = Device.dwHeight / 2 - ((Device.dwHeight / 2) * percent2);

src/xrGame/console_commands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ class CCC_ALifeSave : public IConsole_Command {
570570
#ifdef DEBUG
571571
Msg ("Game save overhead : %f milliseconds",timer.GetElapsed_sec()*1000.f);
572572
#endif
573-
SDrawStaticStruct* _s = CurrentGameUI()->AddCustomStatic("game_saved", true);
573+
StaticDrawableWrapper* _s = CurrentGameUI()->AddCustomStatic("game_saved", true);
574574
LPSTR save_name;
575575
STRCONCAT (save_name, CStringTable().translate("st_game_saved").c_str(), ": ", S);
576576
_s->wnd()->TextItemControl()->SetText(save_name);

0 commit comments

Comments
 (0)