mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-26 16:56:19 +00:00
Changed: Replace sscanf by fromString
This commit is contained in:
parent
9ab62c5606
commit
fd61399877
4 changed files with 8 additions and 7 deletions
|
@ -1082,7 +1082,7 @@ NLMISC_CATEGORISED_COMMAND(nel,displayMeasures, "display hierarchical timer", "[
|
|||
}
|
||||
|
||||
sint depth = 0;
|
||||
bool hasDepth = (sscanf(args[0].c_str(), "%d", &depth) == 1 || (args.size() > 1 && sscanf(args[1].c_str(), "%d", &depth) == 1));
|
||||
bool hasDepth = (fromString(args[0], depth) || (args.size() > 1 && fromString(args[1], depth)));
|
||||
|
||||
CASE_DISPLAYMEASURES(NoSort, -3)
|
||||
CASE_DISPLAYMEASURES(TotalTime, -2)
|
||||
|
|
|
@ -3122,8 +3122,8 @@ static void setRyzomDebugDate(CRyzomDate &rd)
|
|||
NLMISC_COMMAND(setDebugHour, "set the current debug hour", "<hour>")
|
||||
{
|
||||
if (args.size() != 1) return false;
|
||||
int hour;
|
||||
if (sscanf(args[0].c_str(), "%d", &hour) != 1) return false;
|
||||
sint hour;
|
||||
if (!fromString(args[0], hour)) return false;
|
||||
CRyzomDate rd;
|
||||
getRyzomDebugDate(rd);
|
||||
rd.Time = fmodf(rd.Time, 1.f) + (float) hour;
|
||||
|
@ -3134,8 +3134,8 @@ NLMISC_COMMAND(setDebugHour, "set the current debug hour", "<hour>")
|
|||
NLMISC_COMMAND(setDebugDayOfYear, "set the current debug day of year (first day has index 1)", "<day>")
|
||||
{
|
||||
if (args.size() != 1) return false;
|
||||
int day;
|
||||
if (sscanf(args[0].c_str(), "%d", &day) != 1) return false;
|
||||
sint day;
|
||||
if (!fromString(args[0], day)) return false;
|
||||
CRyzomDate rd;
|
||||
getRyzomDebugDate(rd);
|
||||
rd.Day = day - 1; // for the user, days start at '1'
|
||||
|
|
|
@ -3916,7 +3916,8 @@ NLMISC_COMMAND( db, "Display or set the value of a property in the database", "<
|
|||
{
|
||||
// Set
|
||||
sint64 value;
|
||||
sscanf( args[2].c_str(), "%"NL_I64"d", &value );
|
||||
fromString(args[2], value);
|
||||
|
||||
if ( (args.size() > 3) && (args[3]!="0") )
|
||||
{
|
||||
res = e->_PropertyDatabase.x_setPropButDontSend( entry, value );
|
||||
|
|
|
@ -1217,7 +1217,7 @@ NLMISC_COMMAND(dumpToXml, "dump the content of an object into an xml file", "<da
|
|||
|
||||
if (id == NLMISC::CEntityId::Unknown)
|
||||
{
|
||||
if (sscanf(args[1].c_str(), "%"NL_I64"u", &key) != 1)
|
||||
if (!fromString(args[1], key))
|
||||
{
|
||||
log.displayNL("id '%s' is not recognized as an EntityId, an ObjectIndex nor a 64 bits raw key", args[1].c_str());
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue