Browse Source

Fix conversion to bases biggeer or equal 14 to integer

mingodad 9 years ago
parent
commit
dbf7801d72
1 changed files with 2 additions and 1 deletions
  1. 2 1
      SquiLu/squirrel/sqbaselib.cpp

+ 2 - 1
SquiLu/squirrel/sqbaselib.cpp

@@ -20,10 +20,11 @@ bool str2num(const SQChar *s,SQObjectPtr &res, SQInteger base=10)
 	SQChar *end;
 	SQChar *end;
 	const SQChar *e = s;
 	const SQChar *e = s;
 	SQBool isfloat = SQFalse;
 	SQBool isfloat = SQFalse;
+	SQBool isEIntBase = base > 13; //to fix error converting hexadecimals with e like 56f0791e
 	SQChar c;
 	SQChar c;
 	while((c = *e) != _SC('\0'))
 	while((c = *e) != _SC('\0'))
 	{
 	{
-		if(c == _SC('.') || c == _SC('E')|| c == _SC('e')) { //e and E is for scientific notation
+		if(c == _SC('.') || (!isEIntBase && (c == _SC('E')|| c == _SC('e')))) { //e and E is for scientific notation
 			isfloat = SQTrue;
 			isfloat = SQTrue;
 			break;
 			break;
 		}
 		}