Changed: Don't need to use CSString

This commit is contained in:
kervala 2016-12-04 17:14:47 +01:00
parent bd58acdf86
commit 8f7ab70efe

View file

@ -1002,30 +1002,38 @@ IPrimitive* CServerAnimationModule::getAction(CObject* action, const std::string
if(param.splitLines(result) ) if(param.splitLines(result) )
{ {
if (result.size() == 0) std::vector<std::string> res;
if (result.empty())
{ {
nlwarning("ERROR: npc_say but no parameters !!! %d in session ", scenarioId.asInt()); nlwarning("ERROR: npc_say but no parameters !!! %u in session ", scenarioId.asInt());
}
else
{
res.resize(result.size());
if (result.size() >= 1)
{
std::string name(result[0]);
if (name.find(":", 0) != string::npos)
{
res[0] = prefix + name;
} }
if(result.size()>=1) if (result.size() >= 2)
{ {
NLMISC::CSString name(result[0]); res[1] = toString("DSS_%u %s", scenarioId.asInt(), result[1].c_str());
if(name.find(":",0)!=string::npos)
for (uint32 i = 2, len = result.size(); i<len; ++i)
{ {
result[0] = prefix+result[0]; res[i] = prefix + result[i];
}
}
} }
} }
if(result.size()>=2) pAction->addPropertyByName("parameters", new CPropertyStringArray(res));
result[1] = "DSS_"+toString(scenarioId)+" "+result[1].c_str();
if(result.size()>=3)
{
for(uint32 i=2;i<result.size();++i)
{
result[i] = prefix + result[i];
}
}
pAction->addPropertyByName("parameters", new CPropertyStringArray( (std::vector<std::string> &)result ));
} }
} }