Skip to content

Commit

Permalink
Revert "Replace shared_str operator* by c_str() for xrEngine, xrNetSe…
Browse files Browse the repository at this point in the history
…rver and xrSound"

This reverts commit 9fa48aa.
  • Loading branch information
Xottab-DUTY committed Nov 15, 2017
1 parent bfed79c commit 2520d2d
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 51 deletions.
4 changes: 2 additions & 2 deletions src/xrEngine/Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void CEnvironment::SetWeather(shared_str name, bool forced)
Msg("! Invalid weather name: %s", name.c_str());
return;
}
R_ASSERT3(it != WeatherCycles.end(), "Invalid weather name.", name.c_str());
R_ASSERT3(it != WeatherCycles.end(), "Invalid weather name.", *name);
CurrentCycleName = it->first;
if (forced)
{
Expand Down Expand Up @@ -261,7 +261,7 @@ bool CEnvironment::SetWeatherFX(shared_str name)
if (name.size())
{
auto it = WeatherFXs.find(name);
R_ASSERT3(it != WeatherFXs.end(), "Invalid weather effect name.", name.c_str());
R_ASSERT3(it != WeatherFXs.end(), "Invalid weather effect name.", *name);
EnvVec* PrevWeather = CurrentWeather;
VERIFY(PrevWeather);
CurrentWeather = &it->second;
Expand Down
4 changes: 2 additions & 2 deletions src/xrEngine/Environment_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ void CEnvironment::load_weathers()
auto _E = WeatherCycles.end();
for (; _I != _E; _I++)
{
R_ASSERT3(_I->second.size() > 1, "Environment in weather must >=2", _I->first.c_str());
R_ASSERT3(_I->second.size() > 1, "Environment in weather must >=2", *_I->first);
std::sort(_I->second.begin(), _I->second.end(), sort_env_etl_pred);
}
R_ASSERT2(!WeatherCycles.empty(), "Empty weathers.");
Expand Down Expand Up @@ -704,7 +704,7 @@ void CEnvironment::load_weather_effects()
auto _E = WeatherFXs.end();
for (; _I != _E; _I++)
{
R_ASSERT3(_I->second.size() > 1, "Environment in weather must >=2", _I->first.c_str());
R_ASSERT3(_I->second.size() > 1, "Environment in weather must >=2", *_I->first);
std::sort(_I->second.begin(), _I->second.end(), sort_env_etl_pred);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/xrEngine/FDemoRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ void CDemoRecord::MakeLevelMapProcess()

string_path tmp;
if (m_iLMScreenshotFragment == -1)
xr_sprintf(tmp, sizeof(tmp), "map_%s", g_pGameLevel->name().c_str());
xr_sprintf(tmp, sizeof(tmp), "map_%s", *g_pGameLevel->name());
else
xr_sprintf(tmp, sizeof(tmp), "map_%s#%d", g_pGameLevel->name().c_str(), m_iLMScreenshotFragment);
xr_sprintf(tmp, sizeof(tmp), "map_%s#%d", *g_pGameLevel->name(), m_iLMScreenshotFragment);

if (m_iLMScreenshotFragment != -1)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/GameMtlLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const char* SGameMtlPair::dbg_Name()
static string256 nm;
SGameMtl* M0 = GMLib.GetMaterialByID(GetMtl0());
SGameMtl* M1 = GMLib.GetMaterialByID(GetMtl1());
xr_sprintf(nm, sizeof(nm), "Pair: %s - %s", M0->m_Name.c_str(), M1->m_Name.c_str());
xr_sprintf(nm, sizeof(nm), "Pair: %s - %s", *M0->m_Name, *M1->m_Name);
return nm;
}
#endif
Expand Down
20 changes: 10 additions & 10 deletions src/xrEngine/GameMtlLib_Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,34 @@ void SGameMtlPair::Load(IReader& fs)
R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_BREAKING));
fs.r_stringZ(buf);
#ifdef GM_NON_GAME
BreakingSounds = buf.c_str() ? buf.c_str() : "";
BreakingSounds = *buf ? *buf : "";
#else
CreateSounds(BreakingSounds, buf.c_str());
CreateSounds(BreakingSounds, *buf);
#endif
R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_STEP));
fs.r_stringZ(buf);
#ifdef GM_NON_GAME
StepSounds = buf.c_str() ? buf.c_str() : "";
StepSounds = *buf ? *buf : "";
#else
CreateSounds(StepSounds, buf.c_str());
CreateSounds(StepSounds, *buf);
#endif
R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_COLLIDE));
fs.r_stringZ(buf);
#ifdef GM_NON_GAME
CollideSounds = buf.c_str() ? buf.c_str() : "";
CollideSounds = *buf ? *buf : "";
#else
CreateSounds(CollideSounds, buf.c_str());
CreateSounds(CollideSounds, *buf);
#endif
fs.r_stringZ(buf);
#ifdef GM_NON_GAME
CollideParticles = buf.c_str() ? buf.c_str() : "";
CollideParticles = *buf ? *buf : "";
#else
CreatePSs(CollideParticles, buf.c_str());
CreatePSs(CollideParticles, *buf);
#endif
fs.r_stringZ(buf);
#ifdef GM_NON_GAME
CollideMarks = buf.c_str() ? buf.c_str() : "";
CollideMarks = *buf ? *buf : "";
#else
CreateMarks(&*CollideMarks, buf.c_str());
CreateMarks(&*CollideMarks, *buf);
#endif
}
4 changes: 2 additions & 2 deletions src/xrEngine/ISheduled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ScheduledBase::ScheduledBase()
extern BOOL g_bSheduleInProgress;
ScheduledBase::~ScheduledBase()
{
VERIFY2(!Engine.Sheduler.Registered(this), make_string("0x%08x : %s", this, shedule_Name().c_str()));
VERIFY2(!Engine.Sheduler.Registered(this), make_string("0x%08x : %s", this, *shedule_Name()));

// sad, but true
// we need this to become MASTER_GOLD
Expand All @@ -35,7 +35,7 @@ void ScheduledBase::shedule_Update(u32 dt)
LPCSTR name = "unknown";
IGameObject* O = dynamic_cast<IGameObject*>(this);
if (O)
name = O->cName().c_str();
name = *O->cName();
xrDebug::Fatal(DEBUG_INFO, "'shedule_Update' called twice per frame for %s", name);
}
shedule.dbg_update_shedule = shedule.dbg_startframe;
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/ObjectAnimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ENGINE_API CObjectAnimator

void Clear();
void Load(LPCSTR name);
IC LPCSTR Name() const { return m_Name.c_str(); }
IC LPCSTR Name() const { return *m_Name; }
float& Speed() { return m_Speed; }
COMotion* Play(bool bLoop, LPCSTR name = 0);
void Pause(bool val) { return m_MParam.Pause(val); }
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/editor_environment_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void manager::load_weathers()
auto _E = WeatherCycles.end();
for (; _I != _E; _I++)
{
R_ASSERT3(_I->second.size() > 1, "Environment in weather must >=2", _I->first.c_str());
R_ASSERT3(_I->second.size() > 1, "Environment in weather must >=2", *_I->first);
std::sort(_I->second.begin(), _I->second.end(), sort_env_etl_pred);
}
R_ASSERT2(!WeatherCycles.empty(), "Empty weathers.");
Expand Down
6 changes: 3 additions & 3 deletions src/xrEngine/editor_environment_thunderbolts_gradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void gradient::load(CInifile& config, shared_str const& section_id, LPCSTR prefi
texture = config.r_string(section_id, strconcat(sizeof(temp), temp, prefix, "_texture"));
fOpacity = config.r_float(section_id, strconcat(sizeof(temp), temp, prefix, "_opacity"));
fRadius = config.r_fvector2(section_id, strconcat(sizeof(temp), temp, prefix, "_radius"));
m_pFlare->CreateShader(shader.c_str(), texture.c_str());
m_pFlare->CreateShader(*shader, *texture);
}

void gradient::save(CInifile& config, shared_str const& section_id, LPCSTR prefix)
Expand All @@ -48,14 +48,14 @@ LPCSTR gradient::shader_getter() const { return (shader.c_str()); }
void gradient::shader_setter(LPCSTR value)
{
shader = value;
m_pFlare->CreateShader(shader.c_str(), texture.c_str());
m_pFlare->CreateShader(*shader, *texture);
}

LPCSTR gradient::texture_getter() const { return (texture.c_str()); }
void gradient::texture_setter(LPCSTR value)
{
texture = value;
m_pFlare->CreateShader(shader.c_str(), texture.c_str());
m_pFlare->CreateShader(*shader, *texture);
}

void gradient::fill(
Expand Down
4 changes: 2 additions & 2 deletions src/xrEngine/thunderbolt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void SThunderboltDesc::create_top_gradient(CInifile& pIni, shared_str const& sec
m_GradientTop->texture = pIni.r_string(sect, "gradient_top_texture");
m_GradientTop->fRadius = pIni.r_fvector2(sect, "gradient_top_radius");
m_GradientTop->fOpacity = pIni.r_float(sect, "gradient_top_opacity");
m_GradientTop->m_pFlare->CreateShader(m_GradientTop->shader.c_str(), m_GradientTop->texture.c_str());
m_GradientTop->m_pFlare->CreateShader(*m_GradientTop->shader, *m_GradientTop->texture);
}

void SThunderboltDesc::create_center_gradient(CInifile& pIni, shared_str const& sect)
Expand All @@ -48,7 +48,7 @@ void SThunderboltDesc::create_center_gradient(CInifile& pIni, shared_str const&
m_GradientCenter->texture = pIni.r_string(sect, "gradient_center_texture");
m_GradientCenter->fRadius = pIni.r_fvector2(sect, "gradient_center_radius");
m_GradientCenter->fOpacity = pIni.r_float(sect, "gradient_center_opacity");
m_GradientCenter->m_pFlare->CreateShader(m_GradientCenter->shader.c_str(), m_GradientCenter->texture.c_str());
m_GradientCenter->m_pFlare->CreateShader(*m_GradientCenter->shader, *m_GradientCenter->texture);
}

void SThunderboltDesc::load(CInifile& pIni, shared_str const& sect)
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xrSheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ bool CSheduler::internal_Unregister(ISheduled* O, BOOL RT, bool warn_on_not_foun

#ifdef DEBUG
if (warn_on_not_found)
Msg("! scheduled object %s tries to unregister but is not registered", O->shedule_Name().c_str());
Msg("! scheduled object %s tries to unregister but is not registered", *O->shedule_Name());
#endif // DEBUG

return (false);
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xr_collide_form.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CCF_Skeleton::CCF_Skeleton(IGameObject* O) : ICollisionForm(O, cftObject)
IRenderVisual* pVisual = O->Visual();
// IKinematics* K = PKinematics(pVisual); VERIFY3(K,"Can't create skeleton without Kinematics.",*O->cNameVisual());
IKinematics* K = PKinematics(pVisual);
VERIFY3(K, "Can't create skeleton without Kinematics.", O->cNameVisual().c_str());
VERIFY3(K, "Can't create skeleton without Kinematics.", *O->cNameVisual());
// bv_box.set (K->vis.box);
bv_box.set(pVisual->getVisData().box);
bv_box.getsphere(bv_sphere.P, bv_sphere.R);
Expand Down
8 changes: 4 additions & 4 deletions src/xrEngine/xr_efflensflare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ void CLensFlareDescriptor::load(CInifile* pIni, LPCSTR sect)
void CLensFlareDescriptor::OnDeviceCreate()
{
// shaders
m_Gradient.m_pRender->CreateShader(m_Gradient.shader.c_str(), m_Gradient.texture.c_str());
m_Source.m_pRender->CreateShader(m_Source.shader.c_str(), m_Source.texture.c_str());
m_Gradient.m_pRender->CreateShader(*m_Gradient.shader, *m_Gradient.texture);
m_Source.m_pRender->CreateShader(*m_Source.shader, *m_Source.texture);
for (auto it = m_Flares.begin(); it != m_Flares.end(); it++)
it->m_pRender->CreateShader(it->shader.c_str(), it->texture.c_str());
it->m_pRender->CreateShader(*it->shader, *it->texture);
/*
m_Gradient.hShader = CreateShader (*m_Gradient.texture,*m_Gradient.shader);
m_Source.hShader = CreateShader (*m_Source.texture,*m_Source.shader);
Expand Down Expand Up @@ -609,7 +609,7 @@ shared_str CLensFlare::AppendDef(CEnvironment& environment, CInifile* pIni, LPCS
if (!sect || (0 == sect[0]))
return "";
for (auto it = m_Palette.begin(); it != m_Palette.end(); it++)
if (0 == xr_strcmp((*it)->section.c_str(), sect))
if (0 == xr_strcmp(*(*it)->section, sect))
return sect;

environment.add_flare(m_Palette, sect);
Expand Down
24 changes: 12 additions & 12 deletions src/xrEngine/xr_object_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,24 @@ void CObjectList::SingleUpdate(IGameObject* O)

O->UpdateCL();

VERIFY3(O->GetDbgUpdateFrame() == Device.dwFrame, "Broken sequence of calls to 'UpdateCL'", O->cName().c_str());
VERIFY3(O->GetDbgUpdateFrame() == Device.dwFrame, "Broken sequence of calls to 'UpdateCL'", *O->cName());
#if 0 // ndef DEBUG
__try
{
#endif
if (O->H_Parent() && (O->H_Parent()->getDestroy() || O->H_Root()->getDestroy()))
{
// Push to destroy-queue if it isn't here already
Msg("! ERROR: incorrect destroy sequence for object[%d:%s], section[%s], parent[%d:%s]", O->ID(), O->cName().c_str(),
O->cNameSect().c_str(), O->H_Parent()->ID(), O->H_Parent()->cName().c_str());
Msg("! ERROR: incorrect destroy sequence for object[%d:%s], section[%s], parent[%d:%s]", O->ID(), *O->cName(),
*O->cNameSect(), O->H_Parent()->ID(), *O->H_Parent()->cName());
}
#if 0 // ndef DEBUG
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
IGameObject* parent_obj = O->H_Parent();
IGameObject* root_obj = O->H_Root();
Msg ("! ERROR: going to crush: [%d:%s], section[%s], parent_obj_addr[0x%08x], root_obj_addr[0x%08x]",O->ID(),O->cName().c_str(), O->cNameSect().c_str(), *((u32*)&parent_obj), *((u32*)&root_obj));
Msg ("! ERROR: going to crush: [%d:%s], section[%s], parent_obj_addr[0x%08x], root_obj_addr[0x%08x]",O->ID(),*O->cName(),*O->cNameSect(), *((u32*)&parent_obj), *((u32*)&root_obj));
if (parent_obj)
{
__try
Expand Down Expand Up @@ -318,7 +318,7 @@ void CObjectList::Update(bool bForce)
// Msg ("Object [%x]", O);
#ifdef DEBUG
if (debug_destroy)
Msg("Destroying object[%x][%x] [%d][%s] frame[%d]", dynamic_cast<void*>(O), O, O->ID(), O->cName().c_str(),
Msg("Destroying object[%x][%x] [%d][%s] frame[%d]", dynamic_cast<void*>(O), O, O->ID(), *O->cName(),
Device.dwFrame);
#endif // DEBUG
O->net_Destroy();
Expand Down Expand Up @@ -378,14 +378,14 @@ u32 CObjectList::net_Export(NET_Packet* _Packet, u32 start, u32 max_object_size)
if (size >= 256)
{
xrDebug::Fatal(DEBUG_INFO, "Object [%s][%d] exceed network-data limit\n size=%d, Pend=%d, Pstart=%d",
P->cName().c_str(), P->ID(), size, Packet.w_tell(), position);
*P->cName(), P->ID(), size, Packet.w_tell(), position);
}
}
#endif
if (g_Dump_Export_Obj)
{
u32 size = u32(Packet.w_tell() - position) - sizeof(u8);
Msg("* %s : %d", P->cNameSect().c_str(), size);
Msg("* %s : %d", *(P->cNameSect()), size);
}
Packet.w_chunk_close8(position);
// if (0==(--count))
Expand Down Expand Up @@ -420,7 +420,7 @@ void CObjectList::net_Import(NET_Packet* Packet)
P->net_Import(*Packet);

if (g_Dump_Import_Obj)
Msg("* %s : %d - %d", P->cNameSect().c_str(), size, Packet->r_tell() - rsize);
Msg("* %s : %d - %d", *(P->cNameSect()), size, Packet->r_tell() - rsize);
}
else
Packet->r_advance(size);
Expand Down Expand Up @@ -452,25 +452,25 @@ void CObjectList::Unload()
while (objects_sleeping.size())
{
IGameObject* O = objects_sleeping.back();
Msg("! [%x] s[%4d]-[%s]-[%s]", O, O->ID(), O->cNameSect().c_str(), O->cName().c_str());
Msg("! [%x] s[%4d]-[%s]-[%s]", O, O->ID(), *O->cNameSect(), *O->cName());
O->setDestroy(true);

#ifdef DEBUG
if (debug_destroy)
Msg("Destroying object [%d][%s]", O->ID(), O->cName().c_str());
Msg("Destroying object [%d][%s]", O->ID(), *O->cName());
#endif
O->net_Destroy();
Destroy(O);
}
while (objects_active.size())
{
IGameObject* O = objects_active.back();
Msg("! [%x] a[%4d]-[%s]-[%s]", O, O->ID(), O->cNameSect().c_str(), O->cName().c_str());
Msg("! [%x] a[%4d]-[%s]-[%s]", O, O->ID(), *O->cNameSect(), *O->cName());
O->setDestroy(true);

#ifdef DEBUG
if (debug_destroy)
Msg("Destroying object [%d][%s]", O->ID(), O->cName().c_str());
Msg("Destroying object [%d][%s]", O->ID(), *O->cName());
#endif
O->net_Destroy();
Destroy(O);
Expand Down
2 changes: 1 addition & 1 deletion src/xrNetServer/NET_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ bool IPureClient::Connect(pcstr options)
net_csEnumeration.Enter();
// real connect
for (u32 I = 0; I < net_Hosts.size(); I++)
Msg("* HOST #%d: %s\n", I + 1, net_Hosts[I].dpSessionName.c_str());
Msg("* HOST #%d: %s\n", I + 1, *net_Hosts[I].dpSessionName);

R_CHK(net_Hosts.front().pHostAddress->Duplicate(&pHostAddress));
// dump_URL ("! c2s ", pHostAddress);
Expand Down
2 changes: 1 addition & 1 deletion src/xrNetServer/NET_Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class XRNETSERVER_API IPureClient : private MultipacketReciever, private Multipa
bool net_isCompleted_Sync() const { return net_Syncronised; }
bool net_isDisconnected() const;
GameDescriptionData const& get_net_DescriptionData() const { return m_game_description; }
pcstr net_SessionName() { return net_Hosts.front().dpSessionName.c_str(); }
pcstr net_SessionName() { return *net_Hosts.front().dpSessionName; }
// receive
void StartProcessQueue() { net_Queue.Lock(); } // WARNING ! after Start must be End !!! <-
virtual NET_Packet* net_msg_Retreive() { return net_Queue.Retreive(); } // |
Expand Down
2 changes: 1 addition & 1 deletion src/xrSound/SoundRender_Core_SourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CSoundRender_Source* CSoundRender_Core::i_create_source(pcstr name)
*strext(id) = 0;
for (u32 it = 0; it < s_sources.size(); it++)
{
if (0 == xr_strcmp(s_sources[it]->fname.c_str(), id))
if (0 == xr_strcmp(*s_sources[it]->fname, id))
return s_sources[it];
}

Expand Down
6 changes: 3 additions & 3 deletions src/xrSound/SoundRender_Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ void SoundEnvironment_LIB::Unload()
int SoundEnvironment_LIB::GetID(pcstr name)
{
for (auto it = library.begin(); it != library.end(); ++it)
if (0 == _stricmp(name, (*it)->name.c_str()))
if (0 == _stricmp(name, *(*it)->name))
return int(it - library.begin());
return -1;
}
CSoundRender_Environment* SoundEnvironment_LIB::Get(pcstr name)
{
for (const auto& it : library)
if (0 == _stricmp(name, it->name.c_str()))
if (0 == _stricmp(name, *it->name))
return it;
return nullptr;
}
Expand All @@ -204,7 +204,7 @@ CSoundRender_Environment* SoundEnvironment_LIB::Append(CSoundRender_Environment*
void SoundEnvironment_LIB::Remove(pcstr name)
{
for (auto it = library.begin(); it != library.end(); ++it)
if (0 == _stricmp(name, (*it)->name.c_str()))
if (0 == _stricmp(name, *(*it)->name))
{
xr_delete(*it);
library.erase(it);
Expand Down
2 changes: 1 addition & 1 deletion src/xrSound/SoundRender_Source.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class XRSOUND_EDITOR_API CSoundRender_Source : public CSound_source

float length_sec() const override { return fTimeTotal; }
u32 game_type() const override { return m_uGameType; }
pcstr file_name() const override { return fname.c_str(); }
pcstr file_name() const override { return *fname; }
virtual float base_volume() const { return m_fBaseVolume; }
u16 channels_num() const override { return m_wformat.nChannels; }
u32 bytes_total() const override { return dwBytesTotal; }
Expand Down

0 comments on commit 2520d2d

Please sign in to comment.