Skip to content

Commit

Permalink
Revert "Replace shared_str operator* by c_str() for xrAICore and xrSc…
Browse files Browse the repository at this point in the history
…riptEngine"

This reverts commit 54d1508.
  • Loading branch information
Xottab-DUTY committed Nov 15, 2017
1 parent ab8cca2 commit bfed79c
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/xrAICore/Navigation/PatrolPath/patrol_path_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Fvector& CPatrolPathParams::point(u32 index) const
if (!m_path->vertex(index))
{
GEnv.ScriptEngine->script_log(LuaMessageType::Error,
"Can't get information about patrol point number %d in the patrol way %s", index, m_path_name.c_str());
"Can't get information about patrol point number %d in the patrol way %s", index, *m_path_name);
index = (*m_path->vertices().begin()).second->vertex_id();
}
VERIFY(m_path->vertex(index));
Expand Down Expand Up @@ -83,7 +83,7 @@ Flags32 CPatrolPathParams::flags(u32 index) const
LPCSTR CPatrolPathParams::name(u32 index) const
{
VERIFY(m_path->vertex(index));
return (m_path->vertex(index)->data().name().c_str());
return (*m_path->vertex(index)->data().name());
}

bool CPatrolPathParams::terminal(u32 index) const
Expand Down
4 changes: 2 additions & 2 deletions src/xrAICore/Navigation/PatrolPath/patrol_path_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void CPatrolPathStorage::load_raw(
shared_str patrol_name;
sub_chunk->r_stringZ(patrol_name);
const_iterator I = m_registry.find(patrol_name);
VERIFY3(I == m_registry.end(), "Duplicated patrol path found", patrol_name.c_str());
VERIFY3(I == m_registry.end(), "Duplicated patrol path found", *patrol_name);
m_registry.insert(std::make_pair(
patrol_name, &(new CPatrolPath(patrol_name))->load_raw(level_graph, cross, game_graph, *sub_chunk)));
}
Expand Down Expand Up @@ -70,7 +70,7 @@ void CPatrolPathStorage::load(IReader& stream)
chunk1->close();

const_iterator I = m_registry.find(pair.first);
VERIFY3(I == m_registry.end(), "Duplicated patrol path found ", pair.first.c_str());
VERIFY3(I == m_registry.end(), "Duplicated patrol path found ", *pair.first);

#ifdef DEBUG
pair.second->name(pair.first);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ IC const CPatrolPath* CPatrolPathStorage::path(shared_str patrol_name, bool no_a
const_iterator I = patrol_paths().find(patrol_name);
if (I == patrol_paths().end())
{
THROW3(no_assert, "There is no patrol path", patrol_name.c_str());
THROW3(no_assert, "There is no patrol path", *patrol_name);
return (0);
}
return ((*I).second);
Expand Down
2 changes: 1 addition & 1 deletion src/xrAICore/Navigation/PatrolPath/patrol_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void CPatrolPoint::verify_vertex_id(

VERIFY(m_path);
string1024 temp;
xr_sprintf(temp, "\n! Patrol point %s in path %s is not on the level graph vertex!", m_name.c_str(), m_path->m_name.c_str());
xr_sprintf(temp, "\n! Patrol point %s in path %s is not on the level graph vertex!", *m_name, *m_path->m_name);
THROW2(level_graph->valid_vertex_id(m_level_vertex_id), temp);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/xrScriptEngine/script_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ bool CScriptDebugger::HasBreakPoint(const char* fileName, s32 lineNum)
for (u32 i = 0; i < m_breakPoints.size(); i++)
{
SBreakPoint bp(m_breakPoints[i]);
if (bp.nLine == lineNum && xr_strlen(bp.fileName) == xr_strlen(sFileName) && !_stricmp(bp.fileName.c_str(), sFileName))
if (bp.nLine == lineNum && xr_strlen(bp.fileName) == xr_strlen(sFileName) && !_stricmp(*bp.fileName, sFileName))
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/xrScriptEngine/script_debugger_threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ u32 CDbgScriptThreads::FillFrom(CScriptProcess* sp)
th.lua = scriptThread->lua();
th.scriptID = scriptThread->thread_reference();
th.active = scriptThread->active();
xr_strcat(th.name, scriptThread->script_name().c_str());
xr_strcat(th.process, sp->name().c_str());
xr_strcat(th.name, *scriptThread->script_name());
xr_strcat(th.process, *sp->name());
m_threads.push_back(th);
}
return m_threads.size();
Expand Down
2 changes: 1 addition & 1 deletion src/xrScriptEngine/script_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ CScriptThread* CScriptEngine::CreateScriptThread(LPCSTR caNamespaceName, bool do
void CScriptEngine::DestroyScriptThread(const CScriptThread* thread)
{
#ifdef DEBUG
Msg("* Destroying script thread %s", thread->script_name().c_str());
Msg("* Destroying script thread %s", *thread->script_name());
#endif
try
{
Expand Down
6 changes: 3 additions & 3 deletions src/xrScriptEngine/script_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ CScriptProcess::CScriptProcess(CScriptEngine* scriptEngine, shared_str name, sha
this->scriptEngine = scriptEngine;
m_name = name;
#ifdef DEBUG
Msg("* Initializing %s script process", m_name.c_str());
Msg("* Initializing %s script process", *m_name);
#endif
string256 I;
for (u32 i = 0, n = _GetItemCount(scripts.c_str()); i < n; i++)
add_script(_GetItem(scripts.c_str(), i, I), false, false);
for (u32 i = 0, n = _GetItemCount(*scripts); i < n; i++)
add_script(_GetItem(*scripts, i, I), false, false);
m_iterator = 0;
}

Expand Down
10 changes: 5 additions & 5 deletions src/xrScriptEngine/script_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ CScriptThread::CScriptThread(CScriptEngine* scriptEngine, LPCSTR caNamespaceName
l_iErrorCode = lua_pcall(engineLua, 0, 0, 0);
if (l_iErrorCode)
{
CScriptEngine::print_output(engineLua, m_script_name.c_str(), l_iErrorCode);
CScriptEngine::print_output(engineLua, *m_script_name, l_iErrorCode);
CScriptEngine::on_error(engineLua);
return;
}
}
else
{
CScriptEngine::print_output(engineLua, m_script_name.c_str(), l_iErrorCode);
CScriptEngine::print_output(engineLua, *m_script_name, l_iErrorCode);
CScriptEngine::on_error(engineLua);
return;
}
Expand Down Expand Up @@ -107,7 +107,7 @@ bool CScriptThread::update()
int l_iErrorCode = lua_resume(lua(), 0);
if (l_iErrorCode && l_iErrorCode != LUA_YIELD)
{
CScriptEngine::print_output(lua(), script_name().c_str(), l_iErrorCode);
CScriptEngine::print_output(lua(), *script_name(), l_iErrorCode);
CScriptEngine::on_error(scriptEngine->lua());
#ifdef DEBUG
print_stack(lua());
Expand All @@ -121,14 +121,14 @@ bool CScriptThread::update()
#ifdef DEBUG
if (m_current_stack_level)
{
CScriptEngine::print_output(lua(), script_name().c_str(), l_iErrorCode);
CScriptEngine::print_output(lua(), *script_name(), l_iErrorCode);
CScriptEngine::on_error(scriptEngine->lua());
// print_stack(lua());
}
#endif
m_active = false;
#ifdef DEBUG
scriptEngine->script_log(LuaMessageType::Info, "Script %s is finished!", m_script_name.c_str());
scriptEngine->script_log(LuaMessageType::Info, "Script %s is finished!", *m_script_name);
#endif
}
else
Expand Down

0 comments on commit bfed79c

Please sign in to comment.