Skip to content

Commit

Permalink
Revert "Replace shared_str operator* by c_str() for renderers"
Browse files Browse the repository at this point in the history
This reverts commit 39b283b.
  • Loading branch information
Xottab-DUTY committed Nov 15, 2017
1 parent 2520d2d commit 11c7ae1
Show file tree
Hide file tree
Showing 30 changed files with 103 additions and 103 deletions.
2 changes: 1 addition & 1 deletion src/Layers/xrRender/Blender_BmmD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void CBlender_BmmD::Compile(CBlender_Compile& C)
else
{
if (C.L_textures.size() < 2)
xrDebug::Fatal(DEBUG_INFO, "Not enought textures for shader, base tex: %s", C.L_textures[0].c_str());
xrDebug::Fatal(DEBUG_INFO, "Not enought textures for shader, base tex: %s", *C.L_textures[0]);
switch (C.iElement)
{
case SE_R1_NORMAL_HQ:
Expand Down
10 changes: 5 additions & 5 deletions src/Layers/xrRender/Blender_Lm(EbB).cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
else
{
if (C.L_textures.size() < 2)
xrDebug::Fatal(DEBUG_INFO, "Not enough textures for shader, base tex: %s", C.L_textures[0].c_str());
xrDebug::Fatal(DEBUG_INFO, "Not enought textures for shader, base tex: %s", *C.L_textures[0]);
switch (C.iElement)
{
case SE_R1_NORMAL_HQ:
Expand All @@ -113,7 +113,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
C.r_Pass("lmapE", "lmapE", TRUE);
C.r_Sampler("s_base", C.L_textures[0]);
C.r_Sampler("s_lmap", C.L_textures[1]);
C.r_Sampler_clf("s_hemi", C.L_textures[2].c_str());
C.r_Sampler_clf("s_hemi", *C.L_textures[2]);
C.r_Sampler("s_env", oT2_Name, false, D3DTADDRESS_CLAMP);
C.r_End();
// }
Expand All @@ -137,7 +137,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
C.r_Pass("lmap_l", "lmap_l", FALSE);
C.r_Sampler("s_base", C.L_textures[0]);
C.r_Sampler("s_lmap", C.L_textures[1]);
C.r_Sampler_clf("s_hemi", C.L_textures[2].c_str());
C.r_Sampler_clf("s_hemi", *C.L_textures[2]);
C.r_End();
break;
}
Expand All @@ -155,7 +155,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
C.r_Pass("lmapE", "lmapE", TRUE);
C.r_Sampler("s_base", C.L_textures[0]);
C.r_Sampler("s_lmap", C.L_textures[1]);
C.r_Sampler_clf("s_hemi", C.L_textures[2].c_str());
C.r_Sampler_clf("s_hemi", *C.L_textures[2]);
C.r_Sampler("s_env", oT2_Name, false, D3DTADDRESS_CLAMP);
C.r_End();
}
Expand All @@ -176,7 +176,7 @@ void CBlender_LmEbB::Compile(CBlender_Compile& C)
C.r_dx10Texture("s_lmap", C.L_textures[1]);
C.r_dx10Sampler("smp_linear");
// C.r_Sampler_clf ("s_hemi", *C.L_textures[2]);
C.r_dx10Texture("s_hemi", C.L_textures[2].c_str());
C.r_dx10Texture("s_hemi", *C.L_textures[2]);
C.r_dx10Sampler("smp_rtlinear");
// C.r_Sampler ("s_env", oT2_Name,false,D3DTADDRESS_CLAMP);
C.r_dx10Texture("s_env", oT2_Name);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/Blender_Recorder_StandartBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,6 @@ void CBlender_Compile::SetMapping()
for (u32 it = 0; it < RImplementation.Resources->v_constant_setup.size(); it++)
{
std::pair<shared_str, R_constant_setup*> cs = RImplementation.Resources->v_constant_setup[it];
r_Constant(cs.first.c_str(), cs.second);
r_Constant(*cs.first, cs.second);
}
}
4 changes: 2 additions & 2 deletions src/Layers/xrRender/ModelPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ dxRender_Visual* CModelPool::Instance_Find(LPCSTR N)
xr_vector<ModelDef>::iterator I;
for (I = Models.begin(); I != Models.end(); I++)
{
if (I->name[0] && (0 == xr_strcmp(I->name.c_str(), N)))
if (I->name[0] && (0 == xr_strcmp(*I->name, N)))
{
Model = I->model;
break;
Expand Down Expand Up @@ -354,7 +354,7 @@ void CModelPool::Discard(dxRender_Visual*& V, BOOL b_complete)
{
if (I->name == name)
{
if (b_complete || strchr(name.c_str(), '#'))
if (b_complete || strchr(*name, '#'))
{
VERIFY(I->refs > 0);
I->refs--;
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/ParticleEffectDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ CPEDef::~CPEDef()
}
void CPEDef::CreateShader()
{
if (m_ShaderName.c_str() && m_TextureName.c_str())
m_CachedShader.create(m_ShaderName.c_str(), m_TextureName.c_str());
if (*m_ShaderName && *m_TextureName)
m_CachedShader.create(*m_ShaderName, *m_TextureName);
}
void CPEDef::DestroyShader() { m_CachedShader.destroy(); }
void CPEDef::SetName(LPCSTR name) { m_Name = name; }
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ParticleEffectDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class ECORE_API CPEDef
~CPEDef();

void SetName(LPCSTR name);
LPCSTR Name() const { return m_Name.c_str(); }
LPCSTR Name() const { return *m_Name; }
void CreateShader();
void DestroyShader();

Expand Down
8 changes: 4 additions & 4 deletions src/Layers/xrRender/ParticleGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ void OnGroupParticleBirth(void* owner, u32 param, PAPI::Particle& m, u32 idx)
VERIFY(PGD);
const CPGDef::SEffect* eff = PGD->m_Effects[param];
if (eff->m_Flags.is(CPGDef::SEffect::flOnBirthChild))
PG->items[param].StartFreeChild(PE, eff->m_OnBirthChildName.c_str(), m);
PG->items[param].StartFreeChild(PE, *eff->m_OnBirthChildName, m);
if (eff->m_Flags.is(CPGDef::SEffect::flOnPlayChild))
PG->items[param].StartRelatedChild(PE, eff->m_OnPlayChildName.c_str(), m);
PG->items[param].StartRelatedChild(PE, *eff->m_OnPlayChildName, m);
}
void OnGroupParticleDead(void* owner, u32 param, PAPI::Particle& m, u32 idx)
{
Expand All @@ -343,7 +343,7 @@ void OnGroupParticleDead(void* owner, u32 param, PAPI::Particle& m, u32 idx)
if (eff->m_Flags.is(CPGDef::SEffect::flOnPlayChild))
PG->items[param].StopRelatedChild(idx);
if (eff->m_Flags.is(CPGDef::SEffect::flOnDeadChild))
PG->items[param].StartFreeChild(PE, eff->m_OnDeadChildName.c_str(), m);
PG->items[param].StartFreeChild(PE, *eff->m_OnDeadChildName, m);
}
//------------------------------------------------------------------------------
struct zero_vis_pred : public std::unary_function<dxRender_Visual*, bool>
Expand Down Expand Up @@ -558,7 +558,7 @@ BOOL CParticleGroup::Compile(CPGDef* def)
items.resize(m_Def->m_Effects.size());
for (CPGDef::EffectVec::const_iterator e_it = m_Def->m_Effects.begin(); e_it != m_Def->m_Effects.end(); e_it++)
{
CParticleEffect* eff = (CParticleEffect*)RImplementation.model_CreatePE((*e_it)->m_EffectName.c_str());
CParticleEffect* eff = (CParticleEffect*)RImplementation.model_CreatePE(*(*e_it)->m_EffectName);
eff->SetBirthDeadCB(OnGroupParticleBirth, OnGroupParticleDead, this, u32(e_it - m_Def->m_Effects.begin()));
items[e_it - def->m_Effects.begin()].Set(eff);
}
Expand Down
26 changes: 13 additions & 13 deletions src/Layers/xrRender/ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ void CResourceManager::_DeleteVS(const SVS* vs)
{
if (0 == (vs->dwFlags & xr_resource_flagged::RF_REGISTERED))
return;
LPSTR N = LPSTR(vs->cName.c_str());
LPSTR N = LPSTR(*vs->cName);
map_VS::iterator I = m_vs.find(N);
if (I != m_vs.end())
{
m_vs.erase(I);
return;
}
Msg("! ERROR: Failed to find compiled vertex-shader '%s'", vs->cName.c_str());
Msg("! ERROR: Failed to find compiled vertex-shader '%s'", *vs->cName);
}

#ifndef _EDITOR
Expand Down Expand Up @@ -337,14 +337,14 @@ void CResourceManager::_DeletePS(const SPS* ps)
{
if (0 == (ps->dwFlags & xr_resource_flagged::RF_REGISTERED))
return;
LPSTR N = LPSTR(ps->cName.c_str());
LPSTR N = LPSTR(*ps->cName);
map_PS::iterator I = m_ps.find(N);
if (I != m_ps.end())
{
m_ps.erase(I);
return;
}
Msg("! ERROR: Failed to find compiled pixel-shader '%s'", ps->cName.c_str());
Msg("! ERROR: Failed to find compiled pixel-shader '%s'", *ps->cName);
}

R_constant_table* CResourceManager::_CreateConstantTable(R_constant_table& C)
Expand Down Expand Up @@ -391,14 +391,14 @@ void CResourceManager::_DeleteRT(const CRT* RT)
{
if (0 == (RT->dwFlags & xr_resource_flagged::RF_REGISTERED))
return;
LPSTR N = LPSTR(RT->cName.c_str());
LPSTR N = LPSTR(*RT->cName);
map_RT::iterator I = m_rtargets.find(N);
if (I != m_rtargets.end())
{
m_rtargets.erase(I);
return;
}
Msg("! ERROR: Failed to find render-target '%s'", RT->cName.c_str());
Msg("! ERROR: Failed to find render-target '%s'", *RT->cName);
}

// DX10 cut
Expand Down Expand Up @@ -529,14 +529,14 @@ void CResourceManager::_DeleteTexture(const CTexture* T)

if (0 == (T->dwFlags & xr_resource_flagged::RF_REGISTERED))
return;
LPSTR N = LPSTR(T->cName.c_str());
LPSTR N = LPSTR(*T->cName);
map_Texture::iterator I = m_textures.find(N);
if (I != m_textures.end())
{
m_textures.erase(I);
return;
}
Msg("! ERROR: Failed to find texture surface '%s'", T->cName.c_str());
Msg("! ERROR: Failed to find texture surface '%s'", *T->cName);
}

#ifdef DEBUG
Expand All @@ -549,7 +549,7 @@ void CResourceManager::DBG_VerifyTextures()
R_ASSERT(I->first);
R_ASSERT(I->second);
R_ASSERT(I->second->cName);
R_ASSERT(0 == xr_strcmp(I->first, I->second->cName.c_str()));
R_ASSERT(0 == xr_strcmp(I->first, *I->second->cName));
}
}
#endif
Expand Down Expand Up @@ -578,14 +578,14 @@ void CResourceManager::_DeleteMatrix(const CMatrix* M)
{
if (0 == (M->dwFlags & xr_resource_flagged::RF_REGISTERED))
return;
LPSTR N = LPSTR(M->cName.c_str());
LPSTR N = LPSTR(*M->cName);
map_Matrix::iterator I = m_matrices.find(N);
if (I != m_matrices.end())
{
m_matrices.erase(I);
return;
}
Msg("! ERROR: Failed to find xform-def '%s'", M->cName.c_str());
Msg("! ERROR: Failed to find xform-def '%s'", *M->cName);
}
void CResourceManager::ED_UpdateMatrix(LPCSTR Name, CMatrix* data)
{
Expand Down Expand Up @@ -616,14 +616,14 @@ void CResourceManager::_DeleteConstant(const CConstant* C)
{
if (0 == (C->dwFlags & xr_resource_flagged::RF_REGISTERED))
return;
LPSTR N = LPSTR(C->cName.c_str());
LPSTR N = LPSTR(*C->cName);
map_Constant::iterator I = m_constants.find(N);
if (I != m_constants.end())
{
m_constants.erase(I);
return;
}
Msg("! ERROR: Failed to find R1-constant-def '%s'", C->cName.c_str());
Msg("! ERROR: Failed to find R1-constant-def '%s'", *C->cName);
}

void CResourceManager::ED_UpdateConstant(LPCSTR Name, CConstant* data)
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/ResourceManager_Scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ ShaderElement* CBlender_Compile::_lua_Compile(LPCSTR namesp, LPCSTR name)
RS.Invalidate();

// Compile
LPCSTR t_0 = L_textures[0].c_str() ? L_textures[0].c_str() : "null";
LPCSTR t_1 = (L_textures.size() > 1) ? L_textures[1].c_str() : "null";
LPCSTR t_0 = *L_textures[0] ? *L_textures[0] : "null";
LPCSTR t_1 = (L_textures.size() > 1) ? *L_textures[1] : "null";
LPCSTR t_d = detail_texture ? detail_texture : "null";
object shader = RImplementation.Resources->ScriptEngine.name_space(namesp);
functor<void> element = shader[name];
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/SH_RT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void CRT::destroy()
_RELEASE(pSurface);
}
void CRT::reset_begin() { destroy(); }
void CRT::reset_end() { create(cName.c_str(), dwWidth, dwHeight, fmt); }
void CRT::reset_end() { create(*cName, dwWidth, dwHeight, fmt); }
void resptrcode_crt::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 SampleCount)
{
_set(RImplementation.Resources->_CreateRT(Name, w, h, f));
Expand Down
12 changes: 6 additions & 6 deletions src/Layers/xrRender/SH_Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ void CTexture::Load()

flags.bUser = false;
flags.MemoryUsage = 0;
if (0 == _stricmp(cName.c_str(), "$null"))
if (0 == _stricmp(*cName, "$null"))
return;
if (nullptr != strstr(cName.c_str(), "$user$"))
if (nullptr != strstr(*cName, "$user$"))
{
flags.bUser = true;
return;
Expand All @@ -174,7 +174,7 @@ void CTexture::Load()
{
// Check for OGM
string_path fn;
if (FS.exist(fn, "$game_textures$", cName.c_str(), ".ogm"))
if (FS.exist(fn, "$game_textures$", *cName, ".ogm"))
{
// AVI
pTheora = new CTheoraSurface();
Expand Down Expand Up @@ -209,7 +209,7 @@ void CTexture::Load()
}
}
}
else if (FS.exist(fn, "$game_textures$", cName.c_str(), ".avi"))
else if (FS.exist(fn, "$game_textures$", *cName, ".avi"))
{
// AVI
pAVI = new CAviPlayerCustom();
Expand Down Expand Up @@ -237,7 +237,7 @@ void CTexture::Load()
}
}
}
else if (FS.exist(fn, "$game_textures$", cName.c_str(), ".seq"))
else if (FS.exist(fn, "$game_textures$", *cName, ".seq"))
{
// Sequence
string256 buffer;
Expand Down Expand Up @@ -277,7 +277,7 @@ void CTexture::Load()
{
// Normal texture
u32 mem = 0;
pSurface = ::RImplementation.texture_load(cName.c_str(), mem);
pSurface = ::RImplementation.texture_load(*cName, mem);

// Calc memory usage and preload into vid-mem
if (pSurface)
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/ShaderResourceTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ inline void CResourceManager::DestroyShader(const T* sh)
if (0 == (sh->dwFlags & xr_resource_flagged::RF_REGISTERED))
return;

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

if (I != sh_map.end())
{
sh_map.erase(I);
return;
}
Msg("! ERROR: Failed to find compiled geometry shader '%s'", sh->cName.c_str());
Msg("! ERROR: Failed to find compiled geometry shader '%s'", *sh->cName);
}

#endif
4 changes: 2 additions & 2 deletions src/Layers/xrRender/SkeletonAnimated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ std::pair<LPCSTR, LPCSTR> CKinematicsAnimated::LL_MotionDefName_dbg(MotionID ID)
accel_map::iterator _I, _E = s_mots.motion_map()->end();
for (_I = s_mots.motion_map()->begin(); _I != _E; ++_I)
if (_I->second == ID.idx)
return std::make_pair(_I->first.c_str(), s_mots.id().c_str());
return std::make_pair(*_I->first, *s_mots.id());
return std::make_pair((LPCSTR)nullptr, (LPCSTR)nullptr);
}

Expand Down Expand Up @@ -175,7 +175,7 @@ u16 CKinematicsAnimated::LL_PartID(LPCSTR B)
CPartDef& P = (*m_Partition)[id];
if (nullptr == P.Name)
continue;
if (0 == _stricmp(B, P.Name.c_str()))
if (0 == _stricmp(B, *P.Name))
return id;
}
return BI_NONE;
Expand Down
8 changes: 4 additions & 4 deletions src/Layers/xrRender/SkeletonCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ Lock UCalc_Mutex
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
bool pred_N(const std::pair<shared_str, u32>& N, LPCSTR B) { return xr_strcmp(N.first.c_str(), B) < 0; }
bool pred_N(const std::pair<shared_str, u32>& N, LPCSTR B) { return xr_strcmp(*N.first, B) < 0; }
u16 CKinematics::LL_BoneID(LPCSTR B)
{
accel::iterator I = std::lower_bound(bone_map_N->begin(), bone_map_N->end(), B, pred_N);
if (I == bone_map_N->end())
return BI_NONE;
if (0 != xr_strcmp(I->first.c_str(), B))
if (0 != xr_strcmp(*(I->first), B))
return BI_NONE;
return u16(I->second);
}
Expand All @@ -51,7 +51,7 @@ LPCSTR CKinematics::LL_BoneName_dbg(u16 ID)
CKinematics::accel::iterator _I, _E = bone_map_N->end();
for (_I = bone_map_N->begin(); _I != _E; ++_I)
if (_I->second == ID)
return _I->first.c_str();
return *_I->first;
return nullptr;
}

Expand Down Expand Up @@ -395,7 +395,7 @@ void CKinematics::LL_Validate()
BD.IK_data.ik_flags.set(SJointIKData::flBreakable, FALSE);
}
#ifdef DEBUG
Msg("! ERROR: Invalid breakable object: '%s'", dbg_name.c_str());
Msg("! ERROR: Invalid breakable object: '%s'", *dbg_name);
#endif
}
}
Expand Down
Loading

0 comments on commit 11c7ae1

Please sign in to comment.