Skip to content

Commit 11c7ae1

Browse files
committed
Revert "Replace shared_str operator* by c_str() for renderers"
This reverts commit 39b283b.
1 parent 2520d2d commit 11c7ae1

30 files changed

+103
-103
lines changed

src/Layers/xrRender/Blender_BmmD.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void CBlender_BmmD::Compile(CBlender_Compile& C)
9191
else
9292
{
9393
if (C.L_textures.size() < 2)
94-
xrDebug::Fatal(DEBUG_INFO, "Not enought textures for shader, base tex: %s", C.L_textures[0].c_str());
94+
xrDebug::Fatal(DEBUG_INFO, "Not enought textures for shader, base tex: %s", *C.L_textures[0]);
9595
switch (C.iElement)
9696
{
9797
case SE_R1_NORMAL_HQ:

src/Layers/xrRender/Blender_Lm(EbB).cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
8787
else
8888
{
8989
if (C.L_textures.size() < 2)
90-
xrDebug::Fatal(DEBUG_INFO, "Not enough textures for shader, base tex: %s", C.L_textures[0].c_str());
90+
xrDebug::Fatal(DEBUG_INFO, "Not enought textures for shader, base tex: %s", *C.L_textures[0]);
9191
switch (C.iElement)
9292
{
9393
case SE_R1_NORMAL_HQ:
@@ -113,7 +113,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
113113
C.r_Pass("lmapE", "lmapE", TRUE);
114114
C.r_Sampler("s_base", C.L_textures[0]);
115115
C.r_Sampler("s_lmap", C.L_textures[1]);
116-
C.r_Sampler_clf("s_hemi", C.L_textures[2].c_str());
116+
C.r_Sampler_clf("s_hemi", *C.L_textures[2]);
117117
C.r_Sampler("s_env", oT2_Name, false, D3DTADDRESS_CLAMP);
118118
C.r_End();
119119
// }
@@ -137,7 +137,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
137137
C.r_Pass("lmap_l", "lmap_l", FALSE);
138138
C.r_Sampler("s_base", C.L_textures[0]);
139139
C.r_Sampler("s_lmap", C.L_textures[1]);
140-
C.r_Sampler_clf("s_hemi", C.L_textures[2].c_str());
140+
C.r_Sampler_clf("s_hemi", *C.L_textures[2]);
141141
C.r_End();
142142
break;
143143
}
@@ -155,7 +155,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
155155
C.r_Pass("lmapE", "lmapE", TRUE);
156156
C.r_Sampler("s_base", C.L_textures[0]);
157157
C.r_Sampler("s_lmap", C.L_textures[1]);
158-
C.r_Sampler_clf("s_hemi", C.L_textures[2].c_str());
158+
C.r_Sampler_clf("s_hemi", *C.L_textures[2]);
159159
C.r_Sampler("s_env", oT2_Name, false, D3DTADDRESS_CLAMP);
160160
C.r_End();
161161
}
@@ -176,7 +176,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
176176
C.r_dx10Texture("s_lmap", C.L_textures[1]);
177177
C.r_dx10Sampler("smp_linear");
178178
// C.r_Sampler_clf ("s_hemi", *C.L_textures[2]);
179-
C.r_dx10Texture("s_hemi", C.L_textures[2].c_str());
179+
C.r_dx10Texture("s_hemi", *C.L_textures[2]);
180180
C.r_dx10Sampler("smp_rtlinear");
181181
// C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP);
182182
C.r_dx10Texture("s_env", oT2_Name);

src/Layers/xrRender/Blender_Recorder_StandartBinding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,6 @@ void CBlender_Compile::SetMapping()
385385
for (u32 it = 0; it < RImplementation.Resources->v_constant_setup.size(); it++)
386386
{
387387
std::pair<shared_str, R_constant_setup*> cs = RImplementation.Resources->v_constant_setup[it];
388-
r_Constant(cs.first.c_str(), cs.second);
388+
r_Constant(*cs.first, cs.second);
389389
}
390390
}

src/Layers/xrRender/ModelPool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ dxRender_Visual* CModelPool::Instance_Find(LPCSTR N)
202202
xr_vector<ModelDef>::iterator I;
203203
for (I = Models.begin(); I != Models.end(); I++)
204204
{
205-
if (I->name[0] && (0 == xr_strcmp(I->name.c_str(), N)))
205+
if (I->name[0] && (0 == xr_strcmp(*I->name, N)))
206206
{
207207
Model = I->model;
208208
break;
@@ -354,7 +354,7 @@ void CModelPool::Discard(dxRender_Visual*& V, BOOL b_complete)
354354
{
355355
if (I->name == name)
356356
{
357-
if (b_complete || strchr(name.c_str(), '#'))
357+
if (b_complete || strchr(*name, '#'))
358358
{
359359
VERIFY(I->refs > 0);
360360
I->refs--;

src/Layers/xrRender/ParticleEffectDef.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ CPEDef::~CPEDef()
4444
}
4545
void CPEDef::CreateShader()
4646
{
47-
if (m_ShaderName.c_str() && m_TextureName.c_str())
48-
m_CachedShader.create(m_ShaderName.c_str(), m_TextureName.c_str());
47+
if (*m_ShaderName && *m_TextureName)
48+
m_CachedShader.create(*m_ShaderName, *m_TextureName);
4949
}
5050
void CPEDef::DestroyShader() { m_CachedShader.destroy(); }
5151
void CPEDef::SetName(LPCSTR name) { m_Name = name; }

src/Layers/xrRender/ParticleEffectDef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ECORE_API CPEDef
9999
~CPEDef();
100100

101101
void SetName(LPCSTR name);
102-
LPCSTR Name() const { return m_Name.c_str(); }
102+
LPCSTR Name() const { return *m_Name; }
103103
void CreateShader();
104104
void DestroyShader();
105105

src/Layers/xrRender/ParticleGroup.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ void OnGroupParticleBirth(void* owner, u32 param, PAPI::Particle& m, u32 idx)
326326
VERIFY(PGD);
327327
const CPGDef::SEffect* eff = PGD->m_Effects[param];
328328
if (eff->m_Flags.is(CPGDef::SEffect::flOnBirthChild))
329-
PG->items[param].StartFreeChild(PE, eff->m_OnBirthChildName.c_str(), m);
329+
PG->items[param].StartFreeChild(PE, *eff->m_OnBirthChildName, m);
330330
if (eff->m_Flags.is(CPGDef::SEffect::flOnPlayChild))
331-
PG->items[param].StartRelatedChild(PE, eff->m_OnPlayChildName.c_str(), m);
331+
PG->items[param].StartRelatedChild(PE, *eff->m_OnPlayChildName, m);
332332
}
333333
void OnGroupParticleDead(void* owner, u32 param, PAPI::Particle& m, u32 idx)
334334
{
@@ -343,7 +343,7 @@ void OnGroupParticleDead(void* owner, u32 param, PAPI::Particle& m, u32 idx)
343343
if (eff->m_Flags.is(CPGDef::SEffect::flOnPlayChild))
344344
PG->items[param].StopRelatedChild(idx);
345345
if (eff->m_Flags.is(CPGDef::SEffect::flOnDeadChild))
346-
PG->items[param].StartFreeChild(PE, eff->m_OnDeadChildName.c_str(), m);
346+
PG->items[param].StartFreeChild(PE, *eff->m_OnDeadChildName, m);
347347
}
348348
//------------------------------------------------------------------------------
349349
struct zero_vis_pred : public std::unary_function<dxRender_Visual*, bool>
@@ -558,7 +558,7 @@ BOOL CParticleGroup::Compile(CPGDef* def)
558558
items.resize(m_Def->m_Effects.size());
559559
for (CPGDef::EffectVec::const_iterator e_it = m_Def->m_Effects.begin(); e_it != m_Def->m_Effects.end(); e_it++)
560560
{
561-
CParticleEffect* eff = (CParticleEffect*)RImplementation.model_CreatePE((*e_it)->m_EffectName.c_str());
561+
CParticleEffect* eff = (CParticleEffect*)RImplementation.model_CreatePE(*(*e_it)->m_EffectName);
562562
eff->SetBirthDeadCB(OnGroupParticleBirth, OnGroupParticleDead, this, u32(e_it - m_Def->m_Effects.begin()));
563563
items[e_it - def->m_Effects.begin()].Set(eff);
564564
}

src/Layers/xrRender/ResourceManager_Resources.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ void CResourceManager::_DeleteVS(const SVS* vs)
243243
{
244244
if (0 == (vs->dwFlags & xr_resource_flagged::RF_REGISTERED))
245245
return;
246-
LPSTR N = LPSTR(vs->cName.c_str());
246+
LPSTR N = LPSTR(*vs->cName);
247247
map_VS::iterator I = m_vs.find(N);
248248
if (I != m_vs.end())
249249
{
250250
m_vs.erase(I);
251251
return;
252252
}
253-
Msg("! ERROR: Failed to find compiled vertex-shader '%s'", vs->cName.c_str());
253+
Msg("! ERROR: Failed to find compiled vertex-shader '%s'", *vs->cName);
254254
}
255255

256256
#ifndef _EDITOR
@@ -337,14 +337,14 @@ void CResourceManager::_DeletePS(const SPS* ps)
337337
{
338338
if (0 == (ps->dwFlags & xr_resource_flagged::RF_REGISTERED))
339339
return;
340-
LPSTR N = LPSTR(ps->cName.c_str());
340+
LPSTR N = LPSTR(*ps->cName);
341341
map_PS::iterator I = m_ps.find(N);
342342
if (I != m_ps.end())
343343
{
344344
m_ps.erase(I);
345345
return;
346346
}
347-
Msg("! ERROR: Failed to find compiled pixel-shader '%s'", ps->cName.c_str());
347+
Msg("! ERROR: Failed to find compiled pixel-shader '%s'", *ps->cName);
348348
}
349349

350350
R_constant_table* CResourceManager::_CreateConstantTable(R_constant_table& C)
@@ -391,14 +391,14 @@ void CResourceManager::_DeleteRT(const CRT* RT)
391391
{
392392
if (0 == (RT->dwFlags & xr_resource_flagged::RF_REGISTERED))
393393
return;
394-
LPSTR N = LPSTR(RT->cName.c_str());
394+
LPSTR N = LPSTR(*RT->cName);
395395
map_RT::iterator I = m_rtargets.find(N);
396396
if (I != m_rtargets.end())
397397
{
398398
m_rtargets.erase(I);
399399
return;
400400
}
401-
Msg("! ERROR: Failed to find render-target '%s'", RT->cName.c_str());
401+
Msg("! ERROR: Failed to find render-target '%s'", *RT->cName);
402402
}
403403

404404
// DX10 cut
@@ -529,14 +529,14 @@ void CResourceManager::_DeleteTexture(const CTexture* T)
529529

530530
if (0 == (T->dwFlags & xr_resource_flagged::RF_REGISTERED))
531531
return;
532-
LPSTR N = LPSTR(T->cName.c_str());
532+
LPSTR N = LPSTR(*T->cName);
533533
map_Texture::iterator I = m_textures.find(N);
534534
if (I != m_textures.end())
535535
{
536536
m_textures.erase(I);
537537
return;
538538
}
539-
Msg("! ERROR: Failed to find texture surface '%s'", T->cName.c_str());
539+
Msg("! ERROR: Failed to find texture surface '%s'", *T->cName);
540540
}
541541

542542
#ifdef DEBUG
@@ -549,7 +549,7 @@ void CResourceManager::DBG_VerifyTextures()
549549
R_ASSERT(I->first);
550550
R_ASSERT(I->second);
551551
R_ASSERT(I->second->cName);
552-
R_ASSERT(0 == xr_strcmp(I->first, I->second->cName.c_str()));
552+
R_ASSERT(0 == xr_strcmp(I->first, *I->second->cName));
553553
}
554554
}
555555
#endif
@@ -578,14 +578,14 @@ void CResourceManager::_DeleteMatrix(const CMatrix* M)
578578
{
579579
if (0 == (M->dwFlags & xr_resource_flagged::RF_REGISTERED))
580580
return;
581-
LPSTR N = LPSTR(M->cName.c_str());
581+
LPSTR N = LPSTR(*M->cName);
582582
map_Matrix::iterator I = m_matrices.find(N);
583583
if (I != m_matrices.end())
584584
{
585585
m_matrices.erase(I);
586586
return;
587587
}
588-
Msg("! ERROR: Failed to find xform-def '%s'", M->cName.c_str());
588+
Msg("! ERROR: Failed to find xform-def '%s'", *M->cName);
589589
}
590590
void CResourceManager::ED_UpdateMatrix(LPCSTR Name, CMatrix* data)
591591
{
@@ -616,14 +616,14 @@ void CResourceManager::_DeleteConstant(const CConstant* C)
616616
{
617617
if (0 == (C->dwFlags & xr_resource_flagged::RF_REGISTERED))
618618
return;
619-
LPSTR N = LPSTR(C->cName.c_str());
619+
LPSTR N = LPSTR(*C->cName);
620620
map_Constant::iterator I = m_constants.find(N);
621621
if (I != m_constants.end())
622622
{
623623
m_constants.erase(I);
624624
return;
625625
}
626-
Msg("! ERROR: Failed to find R1-constant-def '%s'", C->cName.c_str());
626+
Msg("! ERROR: Failed to find R1-constant-def '%s'", *C->cName);
627627
}
628628

629629
void CResourceManager::ED_UpdateConstant(LPCSTR Name, CConstant* data)

src/Layers/xrRender/ResourceManager_Scripting.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ ShaderElement* CBlender_Compile::_lua_Compile(LPCSTR namesp, LPCSTR name)
413413
RS.Invalidate();
414414

415415
// Compile
416-
LPCSTR t_0 = L_textures[0].c_str() ? L_textures[0].c_str() : "null";
417-
LPCSTR t_1 = (L_textures.size() > 1) ? L_textures[1].c_str() : "null";
416+
LPCSTR t_0 = *L_textures[0] ? *L_textures[0] : "null";
417+
LPCSTR t_1 = (L_textures.size() > 1) ? *L_textures[1] : "null";
418418
LPCSTR t_d = detail_texture ? detail_texture : "null";
419419
object shader = RImplementation.Resources->ScriptEngine.name_space(namesp);
420420
functor<void> element = shader[name];

src/Layers/xrRender/SH_RT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void CRT::destroy()
103103
_RELEASE(pSurface);
104104
}
105105
void CRT::reset_begin() { destroy(); }
106-
void CRT::reset_end() { create(cName.c_str(), dwWidth, dwHeight, fmt); }
106+
void CRT::reset_end() { create(*cName, dwWidth, dwHeight, fmt); }
107107
void resptrcode_crt::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 SampleCount)
108108
{
109109
_set(RImplementation.Resources->_CreateRT(Name, w, h, f));

0 commit comments

Comments
 (0)