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));

src/Layers/xrRender/SH_Texture.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ void CTexture::Load()
158158

159159
flags.bUser = false;
160160
flags.MemoryUsage = 0;
161-
if (0 == _stricmp(cName.c_str(), "$null"))
161+
if (0 == _stricmp(*cName, "$null"))
162162
return;
163-
if (nullptr != strstr(cName.c_str(), "$user$"))
163+
if (nullptr != strstr(*cName, "$user$"))
164164
{
165165
flags.bUser = true;
166166
return;
@@ -174,7 +174,7 @@ void CTexture::Load()
174174
{
175175
// Check for OGM
176176
string_path fn;
177-
if (FS.exist(fn, "$game_textures$", cName.c_str(), ".ogm"))
177+
if (FS.exist(fn, "$game_textures$", *cName, ".ogm"))
178178
{
179179
// AVI
180180
pTheora = new CTheoraSurface();
@@ -209,7 +209,7 @@ void CTexture::Load()
209209
}
210210
}
211211
}
212-
else if (FS.exist(fn, "$game_textures$", cName.c_str(), ".avi"))
212+
else if (FS.exist(fn, "$game_textures$", *cName, ".avi"))
213213
{
214214
// AVI
215215
pAVI = new CAviPlayerCustom();
@@ -237,7 +237,7 @@ void CTexture::Load()
237237
}
238238
}
239239
}
240-
else if (FS.exist(fn, "$game_textures$", cName.c_str(), ".seq"))
240+
else if (FS.exist(fn, "$game_textures$", *cName, ".seq"))
241241
{
242242
// Sequence
243243
string256 buffer;
@@ -277,7 +277,7 @@ void CTexture::Load()
277277
{
278278
// Normal texture
279279
u32 mem = 0;
280-
pSurface = ::RImplementation.texture_load(cName.c_str(), mem);
280+
pSurface = ::RImplementation.texture_load(*cName, mem);
281281

282282
// Calc memory usage and preload into vid-mem
283283
if (pSurface)

src/Layers/xrRender/ShaderResourceTraits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ inline void CResourceManager::DestroyShader(const T* sh)
143143
if (0 == (sh->dwFlags & xr_resource_flagged::RF_REGISTERED))
144144
return;
145145

146-
LPSTR N = LPSTR(sh->cName.c_str());
146+
LPSTR N = LPSTR(*sh->cName);
147147
typename ShaderTypeTraits<T>::MapType::iterator I = sh_map.find(N);
148148

149149
if (I != sh_map.end())
150150
{
151151
sh_map.erase(I);
152152
return;
153153
}
154-
Msg("! ERROR: Failed to find compiled geometry shader '%s'", sh->cName.c_str());
154+
Msg("! ERROR: Failed to find compiled geometry shader '%s'", *sh->cName);
155155
}
156156

157157
#endif

src/Layers/xrRender/SkeletonAnimated.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ std::pair<LPCSTR, LPCSTR> CKinematicsAnimated::LL_MotionDefName_dbg(MotionID ID)
6767
accel_map::iterator _I, _E = s_mots.motion_map()->end();
6868
for (_I = s_mots.motion_map()->begin(); _I != _E; ++_I)
6969
if (_I->second == ID.idx)
70-
return std::make_pair(_I->first.c_str(), s_mots.id().c_str());
70+
return std::make_pair(*_I->first, *s_mots.id());
7171
return std::make_pair((LPCSTR)nullptr, (LPCSTR)nullptr);
7272
}
7373

@@ -175,7 +175,7 @@ u16 CKinematicsAnimated::LL_PartID(LPCSTR B)
175175
CPartDef& P = (*m_Partition)[id];
176176
if (nullptr == P.Name)
177177
continue;
178-
if (0 == _stricmp(B, P.Name.c_str()))
178+
if (0 == _stricmp(B, *P.Name))
179179
return id;
180180
}
181181
return BI_NONE;

src/Layers/xrRender/SkeletonCustom.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ Lock UCalc_Mutex
2424
//////////////////////////////////////////////////////////////////////
2525
// Construction/Destruction
2626
//////////////////////////////////////////////////////////////////////
27-
bool pred_N(const std::pair<shared_str, u32>& N, LPCSTR B) { return xr_strcmp(N.first.c_str(), B) < 0; }
27+
bool pred_N(const std::pair<shared_str, u32>& N, LPCSTR B) { return xr_strcmp(*N.first, B) < 0; }
2828
u16 CKinematics::LL_BoneID(LPCSTR B)
2929
{
3030
accel::iterator I = std::lower_bound(bone_map_N->begin(), bone_map_N->end(), B, pred_N);
3131
if (I == bone_map_N->end())
3232
return BI_NONE;
33-
if (0 != xr_strcmp(I->first.c_str(), B))
33+
if (0 != xr_strcmp(*(I->first), B))
3434
return BI_NONE;
3535
return u16(I->second);
3636
}
@@ -51,7 +51,7 @@ LPCSTR CKinematics::LL_BoneName_dbg(u16 ID)
5151
CKinematics::accel::iterator _I, _E = bone_map_N->end();
5252
for (_I = bone_map_N->begin(); _I != _E; ++_I)
5353
if (_I->second == ID)
54-
return _I->first.c_str();
54+
return *_I->first;
5555
return nullptr;
5656
}
5757

@@ -395,7 +395,7 @@ void CKinematics::LL_Validate()
395395
BD.IK_data.ik_flags.set(SJointIKData::flBreakable, FALSE);
396396
}
397397
#ifdef DEBUG
398-
Msg("! ERROR: Invalid breakable object: '%s'", dbg_name.c_str());
398+
Msg("! ERROR: Invalid breakable object: '%s'", *dbg_name);
399399
#endif
400400
}
401401
}

0 commit comments

Comments
 (0)