use long long rather then int for storing game logic properties.
There were also some problems with int to python conversion - assigning a PyLong to a KX_GameObject from python would raise an error - PyLong were coerced into floats when used with internal CValue arithmetic Changes... - PyLong is converted into CIntValue for coercing and assigning from python - CValue's generic GetNumber() function returns a double rather then a float. - Print an error when a PyType cant be coerced into a CValue Tested with python, expressions and property sensor.
This commit is contained in:
@@ -319,12 +319,14 @@ void CParser::NextSym()
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int CParser::MakeInt() {
|
||||
// returns the integer representation of the value in the global
|
||||
// variable const_as_string
|
||||
// pre: const_as_string contains only numercal chars
|
||||
return atoi(const_as_string);
|
||||
}
|
||||
#endif
|
||||
|
||||
STR_String CParser::Symbol2Str(int s) {
|
||||
// returns a string representation of of symbol s,
|
||||
@@ -436,8 +438,8 @@ CExpression *CParser::Ex(int i) {
|
||||
break;
|
||||
case inttype:
|
||||
{
|
||||
int temp;
|
||||
temp = atoi(const_as_string);
|
||||
cInt temp;
|
||||
temp = strtoll(const_as_string, NULL, 10); /* atoi is for int only */
|
||||
e1 = new CConstExpr(new CIntValue(temp));
|
||||
break;
|
||||
}
|
||||
@@ -580,7 +582,7 @@ float CParser::GetFloat(STR_String txt)
|
||||
CExpression* expr = ProcessText(txt);
|
||||
if (expr) {
|
||||
val = expr->Calculate();
|
||||
result=val->GetNumber();
|
||||
result=(float)val->GetNumber();
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user