Changed: Replace atof by fromString
This commit is contained in:
parent
95e07ec249
commit
29d3c23f61
8 changed files with 20 additions and 14 deletions
|
@ -137,8 +137,8 @@ NLMISC_COMMAND(fightDefaultRange, "Generic default fight range","")
|
|||
{
|
||||
if (args.size()==2)
|
||||
{
|
||||
CBotProfileFightHeal::fightDefaultMinRange = (float)atof(args[0].c_str());
|
||||
CBotProfileFightHeal::fightDefaultMaxRange = (float)atof(args[1].c_str());
|
||||
NLMISC::fromString(args[0], CBotProfileFightHeal::fightDefaultMinRange);
|
||||
NLMISC::fromString(args[1], CBotProfileFightHeal::fightDefaultMaxRange);
|
||||
}
|
||||
log.displayNL("Generic default fight range is [%f;%f]", CBotProfileFightHeal::fightDefaultMinRange, CBotProfileFightHeal::fightDefaultMaxRange);
|
||||
return true;
|
||||
|
|
|
@ -219,7 +219,7 @@ DEFINE_ACTION(ContextRegion,CELLZNE)
|
|||
// if (args[i+1].get(str))
|
||||
// {
|
||||
// if (!str.empty())
|
||||
// value=atof(str.c_str());
|
||||
// NLMISC::fromString(str, value);
|
||||
// }
|
||||
// levelEnergy.setLevelEnergyValue(value, i);
|
||||
// }
|
||||
|
@ -241,7 +241,7 @@ DEFINE_ACTION(ContextGroupFamily,CZ_NRJ)
|
|||
if (args[i].get(str))
|
||||
{
|
||||
if (!str.empty())
|
||||
value=atof(str.c_str());
|
||||
NLMISC::fromString(str, value);
|
||||
}
|
||||
groupFamily->setLevelEnergyValue(value, i);
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ DEFINE_ACTION(ContextGroupFamily,CZ_NRJ)
|
|||
// if (args[i+1].get(str))
|
||||
// {
|
||||
// if (!str.empty())
|
||||
// value=atof(str.c_str());
|
||||
// NLMISC::fromString(str, value);
|
||||
// }
|
||||
// levelEnergy.setLevelEnergyValue(value, i);
|
||||
// }
|
||||
|
|
|
@ -1438,7 +1438,8 @@ public:
|
|||
|
||||
// try to parse a constant value
|
||||
// var.Type = constant;
|
||||
// double val = atof(str.c_str());
|
||||
// double val;
|
||||
// NLMISC::fromString(str, val);
|
||||
// var.Value = float(val);
|
||||
// return true;
|
||||
}
|
||||
|
|
|
@ -1488,7 +1488,8 @@ CCaseTracer::CCaseTracer(const CSmartPtr<CSubRuleTracer> &tracer, const string &
|
|||
if (valChldTracer=chldTracer->getChildForName(s_kw_NUMBER))
|
||||
{
|
||||
const string &strRef=valChldTracer->_TextValue;
|
||||
const float f=(float)atof(strRef.c_str());
|
||||
float f;
|
||||
NLMISC::fromString(strRef, f);
|
||||
_sortValue=*((size_t*)&f);
|
||||
break;
|
||||
}
|
||||
|
@ -1954,7 +1955,8 @@ void CSubRuleTracer::generateCode(CSmartPtr<AIVM::CByteCode> &cByteCode) const
|
|||
NLMISC::fromString(param, index);
|
||||
--index;
|
||||
string &strRef=_childTracers[index]->_TextValue;
|
||||
const float f=(float)atof(strRef.c_str());
|
||||
float f;
|
||||
NLMISC::fromString(strRef, f);
|
||||
byteCode.push_back(*((size_t*)&f));
|
||||
jumpTable.newCodeBlock();
|
||||
break;
|
||||
|
|
|
@ -118,7 +118,8 @@ onchildren { return TOKEN_ONCHILDREN; }
|
|||
|
||||
|
||||
{double} {
|
||||
const float f=(float)atof(yytext);
|
||||
float f;
|
||||
NLMISC::fromString(yytext, f);
|
||||
INIT(*((size_t*)&f));
|
||||
return TOKEN_NUMBER;
|
||||
}
|
||||
|
|
|
@ -4473,7 +4473,8 @@ case 23:
|
|||
YY_RULE_SETUP
|
||||
#line 120 "ai_service/script_parser.lex"
|
||||
{
|
||||
const float f=(float)atof(yytext);
|
||||
float f;
|
||||
NLMISC::fromString(yytext, f);
|
||||
INIT(*((size_t*)&f));
|
||||
return TOKEN_NUMBER;
|
||||
}
|
||||
|
|
|
@ -304,7 +304,7 @@ void CScriptVM::interpretCode(
|
|||
case CScriptStack::EString:
|
||||
{
|
||||
string &str=stack.top();
|
||||
f=(float)atof(str.c_str());
|
||||
NLMISC::fromString(str, f);
|
||||
}
|
||||
break;
|
||||
case CScriptStack::EFloat:
|
||||
|
@ -406,7 +406,7 @@ void CScriptVM::interpretCode(
|
|||
case CScriptStack::EString:
|
||||
{
|
||||
string& str = stack.top();
|
||||
f = (float)atof(str.c_str());
|
||||
NLMISC::fromString(str, f);
|
||||
}
|
||||
break;
|
||||
case CScriptStack::EFloat:
|
||||
|
@ -601,7 +601,7 @@ void CScriptVM::interpretCode(
|
|||
case CScriptStack::EString:
|
||||
{
|
||||
string& str = stack.top();
|
||||
f = (float)atof(str.c_str());
|
||||
NLMISC::fromString(str, f);
|
||||
}
|
||||
break;
|
||||
case CScriptStack::EFloat:
|
||||
|
|
|
@ -1122,7 +1122,8 @@ NLMISC_COMMAND(setSheetProperty,"change a value read from a sheet","<sheet> leve
|
|||
}
|
||||
|
||||
// get the value
|
||||
float val = (float)atof(args[2].c_str());
|
||||
float val;
|
||||
NLMISC::fromString(args[2], val);
|
||||
if (val==0 && args[2]!="0" && args[2]!="0.0")
|
||||
{
|
||||
log.displayNL("'%s' is not a valid value",args[2].c_str());
|
||||
|
|
Loading…
Reference in a new issue