mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-23 17:38:44 +00:00
Changed: Replaced atof by fromString
This commit is contained in:
parent
01c6b43899
commit
79b60462a9
7 changed files with 34 additions and 21 deletions
|
@ -350,7 +350,7 @@ public:
|
|||
{
|
||||
i++;
|
||||
// Set the result
|
||||
result = atof (filename.c_str () + i);
|
||||
NLMISC::fromString(filename.substr(i), result);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -139,7 +139,7 @@ bool ReadFloat (const char *propName, float &result, const char *filename, xmlNo
|
|||
string value;
|
||||
if (GetPropertyString (value, filename, xmlNode, propName))
|
||||
{
|
||||
result = (float)atof (value.c_str ());
|
||||
NLMISC::fromString(value, result);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -38,7 +38,7 @@ bool ReadFloat (const char *propName, float &result, xmlNodePtr xmlNode)
|
|||
string value;
|
||||
if (CIXml::getPropertyString (value, xmlNode, propName))
|
||||
{
|
||||
result = (float)atof (value.c_str ());
|
||||
NLMISC::fromString(value, result);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -991,7 +991,7 @@ int main(sint argc, char **argv)
|
|||
|
||||
if(argc == 4)
|
||||
{
|
||||
weldRadius = (float) atof(argv[3]);
|
||||
NLMISC::fromString(argv[3], weldRadius);
|
||||
}
|
||||
|
||||
std::string center=getName(argv[1]).c_str();
|
||||
|
|
|
@ -477,9 +477,12 @@ void CStaticFames::loadStaticFame( const string& filename )
|
|||
if (sep == string::npos)
|
||||
sep = s.size();
|
||||
else
|
||||
factor = (float) atof( s.substr(sep+1, s.size()-sep-1).c_str());
|
||||
NLMISC::fromString(s.substr(sep+1, s.size()-sep-1), factor);
|
||||
// Fames in file are in [-600;600] so don't forget 1000 factor
|
||||
sint32 fame = (sint32)(atof(s.substr(0,sep).c_str())*1000.f);
|
||||
sint32 fame;
|
||||
float fameFloat;
|
||||
NLMISC::fromString(s.substr(0, sep), fameFloat);
|
||||
fame = (sint32)(fameFloat * 1000.f);
|
||||
|
||||
_FameTable[iFaction*_FameTableSize + jFaction] = fame;
|
||||
_PropagationFactorTable[iFaction*_FameTableSize + jFaction] = factor;
|
||||
|
|
|
@ -2401,9 +2401,17 @@ NLMISC_COMMAND(setStartPoint,"Set the start point for a continent","<continent>
|
|||
|
||||
CVectorD startPoint;
|
||||
|
||||
startPoint.x = atof(args[1].c_str());
|
||||
startPoint.y = atof(args[2].c_str());
|
||||
startPoint.z = (args.size() < 4 ? 0.0 : atof(args[3].c_str()));
|
||||
NLMISC::fromString(args[1], startPoint.x);
|
||||
NLMISC::fromString(args[2], startPoint.y);
|
||||
|
||||
if (args.size() < 4)
|
||||
{
|
||||
startPoint.z = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
NLMISC::fromString(args[3], startPoint.z);
|
||||
}
|
||||
|
||||
StartPoints.insert(multimap<string, CVectorD>::value_type(args[0], startPoint));
|
||||
|
||||
|
@ -2417,10 +2425,10 @@ NLMISC_COMMAND(setBoundingBox, "Set the working bounding box", "<minx> <miny> <m
|
|||
if (args.size() < 4)
|
||||
return false;
|
||||
|
||||
BoxMin.x = atof(args[0].c_str());
|
||||
BoxMin.y = atof(args[1].c_str());
|
||||
BoxMax.x = atof(args[2].c_str());
|
||||
BoxMax.y = atof(args[3].c_str());
|
||||
NLMISC::fromString(args[0], BoxMin.x);
|
||||
NLMISC::fromString(args[1], BoxMin.y);
|
||||
NLMISC::fromString(args[2], BoxMax.x);
|
||||
NLMISC::fromString(args[3], BoxMax.y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2332,7 +2332,7 @@ static void parsePrimDynFaunaZone(const CAIAliasDescriptionNode *aliasNode, cons
|
|||
y = prim->getPrimVector()->y;
|
||||
string s;
|
||||
prim->getPropertyByName("radius", s);
|
||||
r = float(atof(s.c_str()));
|
||||
NLMISC::fromString(s, r);
|
||||
|
||||
vector<string> *params = &EmptyStringVector;
|
||||
prim->getPropertyByName("properties", params);
|
||||
|
@ -2361,7 +2361,7 @@ static void parsePrimDynNpcZonePlace(const CAIAliasDescriptionNode *aliasNode, c
|
|||
y = prim->getPrimVector()->y;
|
||||
string s;
|
||||
prim->getPropertyByName("radius", s);
|
||||
r = float(atof(s.c_str()));
|
||||
NLMISC::fromString(s, r);
|
||||
|
||||
vector<string> *params=&EmptyStringVector;
|
||||
prim->getPropertyByName("properties", params);
|
||||
|
@ -2425,19 +2425,19 @@ static void parsePrimRoadTrigger(const CAIAliasDescriptionNode *aliasNode, const
|
|||
{
|
||||
t1 = *child->getPrimVector();
|
||||
child->getPropertyByName("radius", s);
|
||||
t1r = float(atof(s.c_str()));
|
||||
NLMISC::fromString(s, t1r);
|
||||
}
|
||||
else if (nodeName(child) == "trigger 2")
|
||||
{
|
||||
t2 = *child->getPrimVector();
|
||||
child->getPropertyByName("radius", s);
|
||||
t2r = float(atof(s.c_str()));
|
||||
NLMISC::fromString(s, t2r);
|
||||
}
|
||||
else if (nodeName(child) == "spawn")
|
||||
{
|
||||
sp = *child->getPrimVector();
|
||||
child->getPropertyByName("radius", s);
|
||||
spr = float(atof(s.c_str()));
|
||||
NLMISC::fromString(s, spr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2468,7 +2468,8 @@ static void parsePrimDynRoad(const CAIAliasDescriptionNode *aliasNode, const IPr
|
|||
// road dificulty
|
||||
string s;
|
||||
prim->getPropertyByName("difficulty", s);
|
||||
float difficulty = float(atof(s.c_str()));
|
||||
float difficulty;
|
||||
NLMISC::fromString(s, difficulty);
|
||||
|
||||
uint32 verticalPos;
|
||||
parseVerticalPos(prim, verticalPos);
|
||||
|
@ -3169,7 +3170,7 @@ static void parsePrimOutpostSpawnZone(const CAIAliasDescriptionNode *aliasNode,
|
|||
y = prim->getPrimVector()->y;
|
||||
string s;
|
||||
prim->getPropertyByName("radius", s);
|
||||
r = float(atof(s.c_str()));
|
||||
NLMISC::fromString(s, r);
|
||||
|
||||
uint32 verticalPos;
|
||||
parseVerticalPos(prim, verticalPos);
|
||||
|
@ -3428,7 +3429,8 @@ static void parsePrimSafeZone(const IPrimitive *prim, const std::string &mapName
|
|||
float y=(float)(prim->getPrimVector()->y);
|
||||
string radiusString;
|
||||
prim->getPropertyByName("radius",radiusString);
|
||||
float radius=(float)atof(radiusString.c_str());
|
||||
float radius;
|
||||
NLMISC::fromString(radiusString, radius);
|
||||
|
||||
CAIActions::exec("SAFEZONE", x, y, radius);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue