mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-29 20:30:54 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
7f62faa794
77 changed files with 833 additions and 467 deletions
|
@ -239,6 +239,7 @@ namespace NLGUI
|
||||||
bool isNil(int index = -1);
|
bool isNil(int index = -1);
|
||||||
bool isBoolean(int index = -1);
|
bool isBoolean(int index = -1);
|
||||||
bool isNumber(int index = -1);
|
bool isNumber(int index = -1);
|
||||||
|
bool isInteger(int index = -1);
|
||||||
bool isString(int index = -1);
|
bool isString(int index = -1);
|
||||||
bool isTable(int index = -1);
|
bool isTable(int index = -1);
|
||||||
bool isFunction(int index = -1);
|
bool isFunction(int index = -1);
|
||||||
|
@ -248,6 +249,7 @@ namespace NLGUI
|
||||||
// converting then getting a value from the stack
|
// converting then getting a value from the stack
|
||||||
bool toBoolean(int index = -1);
|
bool toBoolean(int index = -1);
|
||||||
lua_Number toNumber(int index = -1);
|
lua_Number toNumber(int index = -1);
|
||||||
|
lua_Integer toInteger(int index = -1);
|
||||||
const char *toString(int index = -1);
|
const char *toString(int index = -1);
|
||||||
void toString(int index, std::string &str); // convert to a std::string, with a NULL check.
|
void toString(int index, std::string &str); // convert to a std::string, with a NULL check.
|
||||||
size_t strlen(int index = -1);
|
size_t strlen(int index = -1);
|
||||||
|
@ -259,11 +261,13 @@ namespace NLGUI
|
||||||
* If conversion fails then an exception is thrown (with optional msg)
|
* If conversion fails then an exception is thrown (with optional msg)
|
||||||
*/
|
*/
|
||||||
bool getTableBooleanValue(const char *name, bool defaultValue= false);
|
bool getTableBooleanValue(const char *name, bool defaultValue= false);
|
||||||
double getTableNumberValue(const char *name, double defaultValue= 0);
|
double getTableNumberValue(const char *name, double defaultValue= 0.0);
|
||||||
|
sint64 getTableIntegerValue(const char *name, sint64 defaultValue= 0);
|
||||||
const char *getTableStringValue(const char *name, const char *defaultValue= NULL);
|
const char *getTableStringValue(const char *name, const char *defaultValue= NULL);
|
||||||
// pushing value onto the stack
|
// pushing value onto the stack
|
||||||
void push(bool value);
|
void push(bool value);
|
||||||
void push(lua_Number value);
|
void push(lua_Number value);
|
||||||
|
void push(lua_Integer value);
|
||||||
void push(const char *str);
|
void push(const char *str);
|
||||||
void push(const char *str, int length);
|
void push(const char *str, int length);
|
||||||
void push(const std::string &str);
|
void push(const std::string &str);
|
||||||
|
|
|
@ -172,6 +172,18 @@ inline bool CLuaState::isNumber(int index)
|
||||||
return lua_isnumber(_State, index) != 0;
|
return lua_isnumber(_State, index) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline bool CLuaState::isInteger(int index)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_isInteger)
|
||||||
|
checkIndex(index);
|
||||||
|
#if LUA_VERSION_NUM >= 503
|
||||||
|
return lua_isinteger(_State, index) != 0;
|
||||||
|
#else
|
||||||
|
return lua_isnumber(_State, index) != 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
inline bool CLuaState::isString(int index)
|
inline bool CLuaState::isString(int index)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +248,14 @@ inline lua_Number CLuaState::toNumber(int index)
|
||||||
return lua_tonumber(_State, index);
|
return lua_tonumber(_State, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline lua_Integer CLuaState::toInteger(int index)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_toInteger)
|
||||||
|
checkIndex(index);
|
||||||
|
return lua_tointeger(_State, index);
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
inline const char *CLuaState::toString(int index)
|
inline const char *CLuaState::toString(int index)
|
||||||
{
|
{
|
||||||
|
@ -309,6 +329,14 @@ inline void CLuaState::push(lua_Number value)
|
||||||
lua_pushnumber(_State, value);
|
lua_pushnumber(_State, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(lua_Integer value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, value);
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
inline void CLuaState::push(const char *str)
|
inline void CLuaState::push(const char *str)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,8 +31,8 @@ namespace NLGUI
|
||||||
class CLuaManager
|
class CLuaManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~CLuaManager();
|
|
||||||
|
|
||||||
|
/// Get or create singleton
|
||||||
static CLuaManager& getInstance()
|
static CLuaManager& getInstance()
|
||||||
{
|
{
|
||||||
if( instance == NULL )
|
if( instance == NULL )
|
||||||
|
@ -42,6 +42,9 @@ namespace NLGUI
|
||||||
return *instance;
|
return *instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Release singleton
|
||||||
|
static void releaseInstance();
|
||||||
|
|
||||||
/// Enables attaching the Lua debugger in the CLuaState instance, only matters on startup.
|
/// Enables attaching the Lua debugger in the CLuaState instance, only matters on startup.
|
||||||
static void enableLuaDebugging(){ debugLua = true; }
|
static void enableLuaDebugging(){ debugLua = true; }
|
||||||
|
|
||||||
|
@ -65,6 +68,7 @@ namespace NLGUI
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CLuaManager();
|
CLuaManager();
|
||||||
|
~CLuaManager();
|
||||||
|
|
||||||
static CLuaManager *instance;
|
static CLuaManager *instance;
|
||||||
static bool debugLua;
|
static bool debugLua;
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace NLGUI
|
||||||
const char *getTypename() const;
|
const char *getTypename() const;
|
||||||
bool isNil() const;
|
bool isNil() const;
|
||||||
bool isNumber() const;
|
bool isNumber() const;
|
||||||
|
bool isInteger() const;
|
||||||
bool isBoolean() const;
|
bool isBoolean() const;
|
||||||
bool isString() const;
|
bool isString() const;
|
||||||
bool isFunction() const;
|
bool isFunction() const;
|
||||||
|
@ -94,6 +95,7 @@ namespace NLGUI
|
||||||
NLMISC::CRGBA toRGBA() const; // default to black if not a crgba
|
NLMISC::CRGBA toRGBA() const; // default to black if not a crgba
|
||||||
bool toBoolean() const;
|
bool toBoolean() const;
|
||||||
lua_Number toNumber() const;
|
lua_Number toNumber() const;
|
||||||
|
lua_Integer toInteger() const;
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
lua_CFunction toCFunction() const;
|
lua_CFunction toCFunction() const;
|
||||||
void *toUserData() const;
|
void *toUserData() const;
|
||||||
|
@ -102,6 +104,8 @@ namespace NLGUI
|
||||||
operator bool() const;
|
operator bool() const;
|
||||||
operator float() const;
|
operator float() const;
|
||||||
operator double() const;
|
operator double() const;
|
||||||
|
operator sint32() const;
|
||||||
|
operator sint64() const;
|
||||||
operator std::string() const;
|
operator std::string() const;
|
||||||
/** create a sub table for this object, with a string as a key
|
/** create a sub table for this object, with a string as a key
|
||||||
* This object must be a table or an exception if thrown
|
* This object must be a table or an exception if thrown
|
||||||
|
|
|
@ -169,25 +169,25 @@ namespace NLGUI
|
||||||
if( _ColSelR.getNodePtr() != NULL )
|
if( _ColSelR.getNodePtr() != NULL )
|
||||||
s = _ColSelR.getNodePtr()->getFullName();
|
s = _ColSelR.getNodePtr()->getFullName();
|
||||||
else
|
else
|
||||||
s = "";
|
s.clear();
|
||||||
xmlSetProp( node, BAD_CAST "dbcolr", BAD_CAST s.c_str() );
|
xmlSetProp( node, BAD_CAST "dbcolr", BAD_CAST s.c_str() );
|
||||||
|
|
||||||
if( _ColSelG.getNodePtr() != NULL )
|
if( _ColSelG.getNodePtr() != NULL )
|
||||||
s = _ColSelG.getNodePtr()->getFullName();
|
s = _ColSelG.getNodePtr()->getFullName();
|
||||||
else
|
else
|
||||||
s = "";
|
s.clear();
|
||||||
xmlSetProp( node, BAD_CAST "dbcolg", BAD_CAST s.c_str() );
|
xmlSetProp( node, BAD_CAST "dbcolg", BAD_CAST s.c_str() );
|
||||||
|
|
||||||
if( _ColSelB.getNodePtr() != NULL )
|
if( _ColSelB.getNodePtr() != NULL )
|
||||||
s = _ColSelB.getNodePtr()->getFullName();
|
s = _ColSelB.getNodePtr()->getFullName();
|
||||||
else
|
else
|
||||||
s = "";
|
s.clear();
|
||||||
xmlSetProp( node, BAD_CAST "dbcolb", BAD_CAST s.c_str() );
|
xmlSetProp( node, BAD_CAST "dbcolb", BAD_CAST s.c_str() );
|
||||||
|
|
||||||
if( _ColSelA.getNodePtr() != NULL )
|
if( _ColSelA.getNodePtr() != NULL )
|
||||||
s = _ColSelA.getNodePtr()->getFullName();
|
s = _ColSelA.getNodePtr()->getFullName();
|
||||||
else
|
else
|
||||||
s = "";
|
s.clear();
|
||||||
xmlSetProp( node, BAD_CAST "dbcola", BAD_CAST s.c_str() );
|
xmlSetProp( node, BAD_CAST "dbcola", BAD_CAST s.c_str() );
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -519,17 +519,17 @@ namespace NLGUI
|
||||||
|
|
||||||
// Read Action handlers
|
// Read Action handlers
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"onscroll" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"onscroll" );
|
||||||
if (prop) _AHOnScroll = NLMISC::strlwr(prop.str());
|
if (prop) _AHOnScroll = NLMISC::toLower(prop.str());
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"params" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"params" );
|
||||||
if (prop) _AHOnScrollParams = string((const char*)prop);
|
if (prop) _AHOnScrollParams = string((const char*)prop);
|
||||||
//
|
//
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollend" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollend" );
|
||||||
if (prop) _AHOnScrollEnd = NLMISC::strlwr(prop.str());
|
if (prop) _AHOnScrollEnd = NLMISC::toLower(prop.str());
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"end_params" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"end_params" );
|
||||||
if (prop) _AHOnScrollEndParams = string((const char*)prop);
|
if (prop) _AHOnScrollEndParams = string((const char*)prop);
|
||||||
//
|
//
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollcancel" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollcancel" );
|
||||||
if (prop) _AHOnScrollCancel = NLMISC::strlwr(prop.str());
|
if (prop) _AHOnScrollCancel = NLMISC::toLower(prop.str());
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"cancel_params" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"cancel_params" );
|
||||||
if (prop) _AHOnScrollCancelParams = string((const char*)prop);
|
if (prop) _AHOnScrollCancelParams = string((const char*)prop);
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
||||||
ucstring text;
|
ucstring text;
|
||||||
nlverify(CLuaIHM::pop(ls, text));
|
nlverify(CLuaIHM::pop(ls, text));
|
||||||
setText((uint) ls.toNumber(1), text);
|
setText((uint) ls.toInteger(1), text);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
||||||
ucstring text;
|
ucstring text;
|
||||||
nlverify(CLuaIHM::pop(ls, text));
|
nlverify(CLuaIHM::pop(ls, text));
|
||||||
insertText((uint) ls.toNumber(1), text);
|
insertText((uint) ls.toInteger(1), text);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
||||||
ucstring texture;
|
ucstring texture;
|
||||||
nlverify(CLuaIHM::pop(ls, texture));
|
nlverify(CLuaIHM::pop(ls, texture));
|
||||||
setTexture((uint) ls.toNumber(1), texture);
|
setTexture((uint) ls.toInteger(1), texture);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ namespace NLGUI
|
||||||
const char *funcName = "setText";
|
const char *funcName = "setText";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CLuaIHM::push(ls, getText((uint) ls.toNumber(1)));
|
CLuaIHM::push(ls, getText((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,7 +589,7 @@ namespace NLGUI
|
||||||
const char *funcName = "removeText";
|
const char *funcName = "removeText";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
removeText((uint) ls.toNumber(1));
|
removeText((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4820,7 +4820,7 @@ namespace NLGUI
|
||||||
const char *funcName = "blink";
|
const char *funcName = "blink";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
enableBlink((uint) ls.toNumber(1));
|
enableBlink((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,11 +606,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" );
|
||||||
if (prop)
|
if (prop) _ListMenuRight = toLower((const char *) prop);
|
||||||
{
|
|
||||||
string tmp = (const char *) prop;
|
|
||||||
_ListMenuRight = strlwr(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"max_historic" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"max_historic" );
|
||||||
if (prop) fromString((const char*)prop, _MaxHistoric);
|
if (prop) fromString((const char*)prop, _MaxHistoric);
|
||||||
|
|
|
@ -202,7 +202,7 @@ namespace NLGUI
|
||||||
const char *funcName = "enlargeColumns";
|
const char *funcName = "enlargeColumns";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
enlargeColumns((sint32) ls.toNumber(1));
|
enlargeColumns((sint32) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ namespace NLGUI
|
||||||
const char *funcName = "resizeColumnsAndContainer";
|
const char *funcName = "resizeColumnsAndContainer";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
resizeColumnsAndContainer((sint32) ls.toNumber(1));
|
resizeColumnsAndContainer((sint32) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -772,8 +772,7 @@ namespace NLGUI
|
||||||
cellParams.NoWrap = true; \
|
cellParams.NoWrap = true; \
|
||||||
if (present[prefix##_ALIGN] && value[prefix##_ALIGN]) \
|
if (present[prefix##_ALIGN] && value[prefix##_ALIGN]) \
|
||||||
{ \
|
{ \
|
||||||
string align = value[prefix##_ALIGN]; \
|
string align = toLower(value[prefix##_ALIGN]); \
|
||||||
align = strlwr(align); \
|
|
||||||
if (align == "left") \
|
if (align == "left") \
|
||||||
cellParams.Align = CGroupCell::Left; \
|
cellParams.Align = CGroupCell::Left; \
|
||||||
if (align == "center") \
|
if (align == "center") \
|
||||||
|
@ -783,8 +782,7 @@ namespace NLGUI
|
||||||
} \
|
} \
|
||||||
if (present[prefix##_VALIGN] && value[prefix##_VALIGN]) \
|
if (present[prefix##_VALIGN] && value[prefix##_VALIGN]) \
|
||||||
{ \
|
{ \
|
||||||
string align = value[prefix##_VALIGN]; \
|
string align = toLower(value[prefix##_VALIGN]); \
|
||||||
align = strlwr(align); \
|
|
||||||
if (align == "top") \
|
if (align == "top") \
|
||||||
cellParams.VAlign = CGroupCell::Top; \
|
cellParams.VAlign = CGroupCell::Top; \
|
||||||
if (align == "middle") \
|
if (align == "middle") \
|
||||||
|
@ -1182,7 +1180,7 @@ namespace NLGUI
|
||||||
if (it != styles.end())
|
if (it != styles.end())
|
||||||
{
|
{
|
||||||
string image = it->second;
|
string image = it->second;
|
||||||
string::size_type texExt = strlwr(image).find("url(");
|
string::size_type texExt = toLower(image).find("url(");
|
||||||
// Url image
|
// Url image
|
||||||
if (texExt != string::npos)
|
if (texExt != string::npos)
|
||||||
// Remove url()
|
// Remove url()
|
||||||
|
@ -1321,8 +1319,7 @@ namespace NLGUI
|
||||||
if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT])
|
if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT])
|
||||||
tooltip = value[MY_HTML_INPUT_ALT];
|
tooltip = value[MY_HTML_INPUT_ALT];
|
||||||
|
|
||||||
string type = value[MY_HTML_INPUT_TYPE];
|
string type = toLower(value[MY_HTML_INPUT_TYPE]);
|
||||||
type = strlwr (type);
|
|
||||||
if (type == "image")
|
if (type == "image")
|
||||||
{
|
{
|
||||||
// The submit button
|
// The submit button
|
||||||
|
@ -1668,7 +1665,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
nlinfo("found background-image %s", it->second.c_str());
|
nlinfo("found background-image %s", it->second.c_str());
|
||||||
string image = (*it).second;
|
string image = (*it).second;
|
||||||
string::size_type texExt = strlwr(image).find("url(");
|
string::size_type texExt = toLower(image).find("url(");
|
||||||
// Url image
|
// Url image
|
||||||
if (texExt != string::npos)
|
if (texExt != string::npos)
|
||||||
{
|
{
|
||||||
|
@ -3826,7 +3823,7 @@ namespace NLGUI
|
||||||
// folder used for images cache
|
// folder used for images cache
|
||||||
static const string cacheDir = "cache";
|
static const string cacheDir = "cache";
|
||||||
|
|
||||||
string::size_type protocolPos = strlwr(result).find("://");
|
string::size_type protocolPos = toLower(result).find("://");
|
||||||
|
|
||||||
if (protocolPos != string::npos)
|
if (protocolPos != string::npos)
|
||||||
{
|
{
|
||||||
|
@ -3840,7 +3837,7 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Url is a file ?
|
// Url is a file ?
|
||||||
if (strlwr(result).find("file:") == 0)
|
if (toLower(result).find("file:") == 0)
|
||||||
{
|
{
|
||||||
result = result.substr(5, result.size()-5);
|
result = result.substr(5, result.size()-5);
|
||||||
}
|
}
|
||||||
|
@ -3857,7 +3854,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
// Normalize the path
|
// Normalize the path
|
||||||
if (isUrl)
|
if (isUrl)
|
||||||
//result = "file:"+strlwr(CPath::standardizePath (CPath::getFullPath (CFile::getPath(result)))+CFile::getFilename(result));*/
|
//result = "file:"+toLower(CPath::standardizePath (CPath::getFullPath (CFile::getPath(result)))+CFile::getFilename(result));*/
|
||||||
result = "file:/"+tmp;
|
result = "file:/"+tmp;
|
||||||
else
|
else
|
||||||
result = tmp;
|
result = tmp;
|
||||||
|
@ -4114,7 +4111,7 @@ namespace NLGUI
|
||||||
void CGroupHTML::doBrowseLocalFile(const std::string &uri)
|
void CGroupHTML::doBrowseLocalFile(const std::string &uri)
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
if (strlwr(uri).find("file:/") == 0)
|
if (toLower(uri).find("file:/") == 0)
|
||||||
{
|
{
|
||||||
filename = uri.substr(6, uri.size() - 6);
|
filename = uri.substr(6, uri.size() - 6);
|
||||||
}
|
}
|
||||||
|
@ -4728,7 +4725,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE);
|
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE);
|
||||||
|
|
||||||
uint element_number = (uint)ls.toNumber(1);
|
uint element_number = (uint)ls.toInteger(1);
|
||||||
std::vector<bool> present;
|
std::vector<bool> present;
|
||||||
std::vector<const char *> value;
|
std::vector<const char *> value;
|
||||||
present.resize(30, false);
|
present.resize(30, false);
|
||||||
|
@ -4741,7 +4738,7 @@ namespace NLGUI
|
||||||
|
|
||||||
ENUM_LUA_TABLE(params, it)
|
ENUM_LUA_TABLE(params, it)
|
||||||
{
|
{
|
||||||
if (!it.nextKey().isNumber())
|
if (!it.nextKey().isInteger())
|
||||||
{
|
{
|
||||||
nlwarning("%s : bad key encountered with type %s, number expected.", funcName, it.nextKey().getTypename());
|
nlwarning("%s : bad key encountered with type %s, number expected.", funcName, it.nextKey().getTypename());
|
||||||
continue;
|
continue;
|
||||||
|
@ -4751,16 +4748,16 @@ namespace NLGUI
|
||||||
nlwarning("%s : bad value encountered with type %s for key %s, string expected.", funcName, it.nextValue().getTypename(), it.nextKey().toString().c_str());
|
nlwarning("%s : bad value encountered with type %s for key %s, string expected.", funcName, it.nextValue().getTypename(), it.nextKey().toString().c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
uint idx = (uint)it.nextKey().toNumber();
|
uint idx = (uint)it.nextKey().toInteger();
|
||||||
|
|
||||||
present.insert(present.begin() + (uint)it.nextKey().toNumber(), true);
|
present.insert(present.begin() + (uint)it.nextKey().toInteger(), true);
|
||||||
|
|
||||||
string str = it.nextValue().toString();
|
string str = it.nextValue().toString();
|
||||||
size_t size = str.size() + 1;
|
size_t size = str.size() + 1;
|
||||||
char * buffer = new char[ size ];
|
char * buffer = new char[ size ];
|
||||||
strncpy(buffer, str.c_str(), size );
|
strncpy(buffer, str.c_str(), size );
|
||||||
|
|
||||||
value.insert(value.begin() + (uint)it.nextKey().toNumber(), buffer);
|
value.insert(value.begin() + (uint)it.nextKey().toInteger(), buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
beginElement(element_number, present, value);
|
beginElement(element_number, present, value);
|
||||||
|
@ -4778,7 +4775,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
|
|
||||||
uint element_number = (uint)ls.toNumber(1);
|
uint element_number = (uint)ls.toInteger(1);
|
||||||
endElement(element_number);
|
endElement(element_number);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4978,7 +4975,7 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
if (it->first == "text-decoration" || it->first == "text-decoration-line")
|
if (it->first == "text-decoration" || it->first == "text-decoration-line")
|
||||||
{
|
{
|
||||||
std::string prop(strlwr(it->second));
|
std::string prop(toLower(it->second));
|
||||||
style.Underlined = (prop.find("underline") != std::string::npos);
|
style.Underlined = (prop.find("underline") != std::string::npos);
|
||||||
style.StrikeThrough = (prop.find("line-through") != std::string::npos);
|
style.StrikeThrough = (prop.find("line-through") != std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1224,7 +1224,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getChild";
|
const char *funcName = "getChild";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
sint index = (sint) ls.toNumber(1);
|
sint index = (sint) ls.toInteger(1);
|
||||||
if(index < 0 || index >= (sint) _Elements.size())
|
if(index < 0 || index >= (sint) _Elements.size())
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "getChild : trying to access element %d in list '%s', which has %d elements",
|
CLuaIHM::fails(ls, "getChild : trying to access element %d in list '%s', which has %d elements",
|
||||||
|
@ -1304,10 +1304,10 @@ namespace NLGUI
|
||||||
ucstring ucText;
|
ucstring ucText;
|
||||||
ucText.fromUtf8(text);
|
ucText.fromUtf8(text);
|
||||||
|
|
||||||
uint r = (uint) ls.toNumber(2);
|
uint r = (uint) ls.toInteger(2);
|
||||||
uint g = (uint) ls.toNumber(3);
|
uint g = (uint) ls.toInteger(3);
|
||||||
uint b = (uint) ls.toNumber(4);
|
uint b = (uint) ls.toInteger(4);
|
||||||
uint a = (uint) ls.toNumber(5);
|
uint a = (uint) ls.toInteger(5);
|
||||||
|
|
||||||
addTextChild(ucText, CRGBA(r, g, b, a));
|
addTextChild(ucText, CRGBA(r, g, b, a));
|
||||||
|
|
||||||
|
@ -1344,7 +1344,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addChildAtIndex(vb, (uint) ls.toNumber(2));
|
addChildAtIndex(vb, (uint) ls.toInteger(2));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1712,7 +1712,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getSubMenu";
|
const char *funcName = "getSubMenu";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toNumber(1)));
|
CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1722,8 +1722,8 @@ namespace NLGUI
|
||||||
const char *funcName = "addSubMenu";
|
const char *funcName = "addSubMenu";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
setSubMenu((uint) ls.toNumber(1), new CGroupSubMenu(CViewText::TCtorParam()));
|
setSubMenu((uint) ls.toInteger(1), new CGroupSubMenu(CViewText::TCtorParam()));
|
||||||
CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toNumber(1)));
|
CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1733,7 +1733,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getLineId";
|
const char *funcName = "getLineId";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
std::string id = getLineId((uint) ls.toNumber(1));
|
std::string id = getLineId((uint) ls.toInteger(1));
|
||||||
CLuaIHM::push(ls, id);
|
CLuaIHM::push(ls, id);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1754,7 +1754,7 @@ namespace NLGUI
|
||||||
const char *funcName = "isSeparator";
|
const char *funcName = "isSeparator";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
ls.push(isSeparator((uint) ls.toNumber(1)));
|
ls.push(isSeparator((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1785,7 +1785,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING);
|
CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING);
|
||||||
ucstring arg2;
|
ucstring arg2;
|
||||||
nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2));
|
nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2));
|
||||||
addLineAtIndex((uint) ls.toNumber(1), arg2, ls.toString(3), ls.toString(4), ls.toString(5));
|
addLineAtIndex((uint) ls.toInteger(1), arg2, ls.toString(3), ls.toString(4), ls.toString(5));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1803,7 +1803,7 @@ namespace NLGUI
|
||||||
const char *funcName = "addSeparatorAtIndex";
|
const char *funcName = "addSeparatorAtIndex";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
addSeparatorAtIndex((uint) ls.toNumber(1));
|
addSeparatorAtIndex((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1813,7 +1813,7 @@ namespace NLGUI
|
||||||
const char *funcName = "removeLine";
|
const char *funcName = "removeLine";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
removeLine((uint) ls.toNumber(1));
|
removeLine((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1833,7 +1833,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName);
|
CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName);
|
||||||
}
|
}
|
||||||
setUserGroupRight((uint) ls.toNumber(1), group, true);
|
setUserGroupRight((uint) ls.toInteger(1), group, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1853,7 +1853,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName);
|
CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName);
|
||||||
}
|
}
|
||||||
setUserGroupLeft((uint) ls.toNumber(1), group, true);
|
setUserGroupLeft((uint) ls.toInteger(1), group, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1864,7 +1864,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getUserGroupRight";
|
const char *funcName = "getUserGroupRight";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CLuaIHM::pushUIOnStack(ls, getUserGroupRight((uint) ls.toNumber(1)));
|
CLuaIHM::pushUIOnStack(ls, getUserGroupRight((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1875,7 +1875,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getUserGroupLeft";
|
const char *funcName = "getUserGroupLeft";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CInterfaceElement *pIE = getUserGroupLeft((uint) ls.toNumber(1));
|
CInterfaceElement *pIE = getUserGroupLeft((uint) ls.toInteger(1));
|
||||||
if (pIE)
|
if (pIE)
|
||||||
{
|
{
|
||||||
CLuaIHM::pushUIOnStack(ls, pIE);
|
CLuaIHM::pushUIOnStack(ls, pIE);
|
||||||
|
@ -1890,7 +1890,7 @@ namespace NLGUI
|
||||||
const char *funcName = "setMaxVisibleLine";
|
const char *funcName = "setMaxVisibleLine";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
setMaxVisibleLine((uint) ls.toNumber(1));
|
setMaxVisibleLine((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2566,7 +2566,7 @@ namespace NLGUI
|
||||||
const char *funcName = "setMinW";
|
const char *funcName = "setMinW";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
setMinW((sint32) ls.toNumber(1));
|
setMinW((sint32) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@ namespace NLGUI
|
||||||
if (tabB)
|
if (tabB)
|
||||||
{
|
{
|
||||||
// don't use addTab to avoid selection of new tab
|
// don't use addTab to avoid selection of new tab
|
||||||
addTab(tabB, (sint) ls.toNumber(2));
|
addTab(tabB, (sint) ls.toInteger(2));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ namespace NLGUI
|
||||||
const char *funcName = "removeTab";
|
const char *funcName = "removeTab";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
removeTab((uint) ls.toNumber(1));
|
removeTab((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getTabButton";
|
const char *funcName = "getTabButton";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CCtrlTabButton* tab = getTabButton((uint) ls.toNumber(1));
|
CCtrlTabButton* tab = getTabButton((uint) ls.toInteger(1));
|
||||||
if(tab != NULL)
|
if(tab != NULL)
|
||||||
{
|
{
|
||||||
CLuaIHM::pushUIOnStack(ls, tab);
|
CLuaIHM::pushUIOnStack(ls, tab);
|
||||||
|
@ -562,7 +562,7 @@ namespace NLGUI
|
||||||
const char *funcName = "showTabButton";
|
const char *funcName = "showTabButton";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
sint showTab = (sint)ls.toNumber(1);
|
sint showTab = (sint)ls.toInteger(1);
|
||||||
|
|
||||||
if(showTab>=0 && showTab<(sint)_Buttons.size())
|
if(showTab>=0 && showTab<(sint)_Buttons.size())
|
||||||
{
|
{
|
||||||
|
@ -770,7 +770,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getGroup";
|
const char *funcName = "getGroup";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CInterfaceGroup* group = getGroup((uint) ls.toNumber(1));
|
CInterfaceGroup* group = getGroup((uint) ls.toInteger(1));
|
||||||
if(group != NULL)
|
if(group != NULL)
|
||||||
{
|
{
|
||||||
CLuaIHM::pushUIOnStack(ls, group);
|
CLuaIHM::pushUIOnStack(ls, group);
|
||||||
|
|
|
@ -1815,7 +1815,7 @@ namespace NLGUI
|
||||||
const char *funcName = "CGroupTree::SNode::luaAddChildAtIndex";
|
const char *funcName = "CGroupTree::SNode::luaAddChildAtIndex";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 2);
|
CLuaIHM::checkArgCount(ls, funcName, 2);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER);
|
||||||
addChildAtIndex(luaGetNodeOnStack(ls, funcName), (sint) ls.toNumber(2));
|
addChildAtIndex(luaGetNodeOnStack(ls, funcName), (sint) ls.toInteger(2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1847,7 +1847,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
//
|
//
|
||||||
sint index = (sint) ls.toNumber(1);
|
sint index = (sint) ls.toInteger(1);
|
||||||
if (index < 0 || index >= (sint) Children.size())
|
if (index < 0 || index >= (sint) Children.size())
|
||||||
{
|
{
|
||||||
std::string range = Children.empty() ? "<empty>" : toString("[0, %d]", Children.size() - 1);
|
std::string range = Children.empty() ? "<empty>" : toString("[0, %d]", Children.size() - 1);
|
||||||
|
@ -1890,7 +1890,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 1, LUA_TNUMBER);
|
||||||
CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 2, LUA_TBOOLEAN);
|
CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 2, LUA_TBOOLEAN);
|
||||||
selectLine((uint) ls.toNumber(1), ls.toBoolean(2));
|
selectLine((uint) ls.toInteger(1), ls.toBoolean(2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,7 @@ namespace NLGUI
|
||||||
if (ptr) _Dynamic = CInterfaceElement::convertBool (ptr);
|
if (ptr) _Dynamic = CInterfaceElement::convertBool (ptr);
|
||||||
|
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"type");
|
ptr = xmlGetProp (cur, (xmlChar*)"type");
|
||||||
string sTmp = ptr.str();
|
string sTmp = toLower(ptr.str());
|
||||||
sTmp = strlwr(sTmp);
|
|
||||||
if (sTmp == "linear")
|
if (sTmp == "linear")
|
||||||
_Type = Track_Linear;
|
_Type = Track_Linear;
|
||||||
else if (sTmp == "bezier")
|
else if (sTmp == "bezier")
|
||||||
|
|
|
@ -312,8 +312,7 @@ namespace NLGUI
|
||||||
ptr = (char*) xmlGetProp( cur, (xmlChar*)"max_sizeparent" );
|
ptr = (char*) xmlGetProp( cur, (xmlChar*)"max_sizeparent" );
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
string idparent = ptr.str();
|
string idparent = NLMISC::toLower(ptr.str());
|
||||||
idparent = NLMISC::strlwr(idparent);
|
|
||||||
if (idparent != "parent")
|
if (idparent != "parent")
|
||||||
{
|
{
|
||||||
if (parentGroup)
|
if (parentGroup)
|
||||||
|
@ -1184,7 +1183,7 @@ namespace NLGUI
|
||||||
const char *funcName = "CInterfaceGroup::getGroup";
|
const char *funcName = "CInterfaceGroup::getGroup";
|
||||||
CLuaIHM::checkArgCount(ls, "CInterfaceGroup::getGroup", 1);
|
CLuaIHM::checkArgCount(ls, "CInterfaceGroup::getGroup", 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
uint index = (uint) ls.toNumber(1);
|
uint index = (uint) ls.toInteger(1);
|
||||||
if (index >= _ChildrenGroups.size())
|
if (index >= _ChildrenGroups.size())
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "getGroup : try to index group %s, but there are only %d son groups", ls.toString(1), (int) _ChildrenGroups.size());
|
CLuaIHM::fails(ls, "getGroup : try to index group %s, but there are only %d son groups", ls.toString(1), (int) _ChildrenGroups.size());
|
||||||
|
|
|
@ -127,8 +127,7 @@ namespace NLGUI
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
const CInterfaceOptionValue &CInterfaceOptions::getValue(const string &sParamName) const
|
const CInterfaceOptionValue &CInterfaceOptions::getValue(const string &sParamName) const
|
||||||
{
|
{
|
||||||
string sLwrParamName = strlwr (sParamName);
|
std::map<std::string, CInterfaceOptionValue>::const_iterator it = _ParamValue.find (toLower(sParamName));
|
||||||
std::map<std::string, CInterfaceOptionValue>::const_iterator it = _ParamValue.find (sLwrParamName);
|
|
||||||
if (it != _ParamValue.end())
|
if (it != _ParamValue.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
else
|
else
|
||||||
|
|
|
@ -1359,6 +1359,9 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
||||||
if (!ptr) return false;
|
if (!ptr) return false;
|
||||||
|
|
||||||
|
string stmp2 = toLower(string((const char*)ptr));
|
||||||
|
|
||||||
CInterfaceElement *pEltFound = NULL;
|
CInterfaceElement *pEltFound = NULL;
|
||||||
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
||||||
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
||||||
|
@ -1367,8 +1370,8 @@ namespace NLGUI
|
||||||
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
||||||
{
|
{
|
||||||
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
||||||
string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
||||||
string stmp2 = strlwr(string((const char*)ptr));
|
|
||||||
if (stmp == stmp2)
|
if (stmp == stmp2)
|
||||||
{
|
{
|
||||||
pEltFound = pIG;
|
pEltFound = pIG;
|
||||||
|
@ -1408,6 +1411,9 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
||||||
if (!ptr) return false;
|
if (!ptr) return false;
|
||||||
|
|
||||||
|
string stmp2 = toLower(string((const char*)ptr));
|
||||||
|
|
||||||
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
||||||
CInterfaceElement *pEltFound = NULL;
|
CInterfaceElement *pEltFound = NULL;
|
||||||
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
||||||
|
@ -1416,8 +1422,7 @@ namespace NLGUI
|
||||||
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
||||||
{
|
{
|
||||||
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
||||||
string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
||||||
string stmp2 = strlwr(string((const char*)ptr));
|
|
||||||
if (stmp == stmp2)
|
if (stmp == stmp2)
|
||||||
{
|
{
|
||||||
pEltFound = pIG;
|
pEltFound = pIG;
|
||||||
|
@ -1600,6 +1605,9 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
||||||
if (!ptr) return false;
|
if (!ptr) return false;
|
||||||
|
|
||||||
|
string stmp2 = toLower(string((const char*)ptr));
|
||||||
|
|
||||||
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
||||||
CInterfaceElement *pEltFound = NULL;
|
CInterfaceElement *pEltFound = NULL;
|
||||||
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
||||||
|
@ -1608,8 +1616,8 @@ namespace NLGUI
|
||||||
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
||||||
{
|
{
|
||||||
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
||||||
string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
||||||
string stmp2 = strlwr(string((const char*)ptr));
|
|
||||||
if (stmp == stmp2)
|
if (stmp == stmp2)
|
||||||
{
|
{
|
||||||
pEltFound = pIG;
|
pEltFound = pIG;
|
||||||
|
|
|
@ -623,6 +623,23 @@ namespace NLGUI
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
sint64 CLuaState::getTableIntegerValue(const char *name, sint64 defaultValue)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_getTableIntegerValue)
|
||||||
|
nlassert(name);
|
||||||
|
push(name);
|
||||||
|
getTable(-2);
|
||||||
|
if (isNil())
|
||||||
|
{
|
||||||
|
pop();
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
sint64 result = toInteger(-1);
|
||||||
|
pop();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
const char *CLuaState::getTableStringValue(const char *name, const char *defaultValue)
|
const char *CLuaState::getTableStringValue(const char *name, const char *defaultValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -231,20 +231,24 @@ namespace NLGUI
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LUA_VERSION_NUM < 503
|
||||||
|
#define lua_isinteger(a, b) lua_isnumber(a, b)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
#define LUA_REGISTER_BASIC(_type_) \
|
#define LUA_REGISTER_BASIC(_type_) \
|
||||||
luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \
|
luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \
|
||||||
_type_ convert_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
|
_type_ convert_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
|
||||||
{ \
|
{ \
|
||||||
return (_type_)lua_tonumber(L, index); \
|
return (_type_)lua_tointeger(L, index); \
|
||||||
} \
|
} \
|
||||||
int match_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
|
int match_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
|
||||||
{ \
|
{ \
|
||||||
if (lua_isnumber(L, index)) return 0; else return -1; \
|
if (lua_isinteger(L, index)) return 0; else return -1; \
|
||||||
} \
|
} \
|
||||||
void convert_cpp_to_lua(lua_State* L, const _type_& v) \
|
void convert_cpp_to_lua(lua_State* L, const _type_& v) \
|
||||||
{ \
|
{ \
|
||||||
lua_pushnumber(L, (double)v); \
|
lua_pushinteger(L, (double)v); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic LUA types
|
// Basic LUA types
|
||||||
|
@ -258,8 +262,6 @@ namespace NLGUI
|
||||||
LUA_REGISTER_BASIC(uint16)
|
LUA_REGISTER_BASIC(uint16)
|
||||||
LUA_REGISTER_BASIC(sint32)
|
LUA_REGISTER_BASIC(sint32)
|
||||||
LUA_REGISTER_BASIC(uint32)
|
LUA_REGISTER_BASIC(uint32)
|
||||||
// LUA_REGISTER_BASIC(sint)
|
|
||||||
// LUA_REGISTER_BASIC(uint)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1381,7 +1383,7 @@ namespace NLGUI
|
||||||
ls.push( (reflectedObject.*(property.GetMethod.GetBool))() );
|
ls.push( (reflectedObject.*(property.GetMethod.GetBool))() );
|
||||||
break;
|
break;
|
||||||
case CReflectedProperty::SInt32:
|
case CReflectedProperty::SInt32:
|
||||||
ls.push( (lua_Number)(reflectedObject.*(property.GetMethod.GetSInt32))() );
|
ls.push( (lua_Integer)(reflectedObject.*(property.GetMethod.GetSInt32))() );
|
||||||
break;
|
break;
|
||||||
case CReflectedProperty::Float:
|
case CReflectedProperty::Float:
|
||||||
ls.push( (lua_Number)(reflectedObject.*(property.GetMethod.GetFloat))() );
|
ls.push( (lua_Number)(reflectedObject.*(property.GetMethod.GetFloat))() );
|
||||||
|
@ -1447,13 +1449,13 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
case CReflectedProperty::SInt32:
|
case CReflectedProperty::SInt32:
|
||||||
{
|
{
|
||||||
sint32 val= (sint32)ls.toNumber(stackIndex);
|
sint32 val= (sint32)ls.toInteger(stackIndex);
|
||||||
(target.*(property.SetMethod.SetSInt32))(val);
|
(target.*(property.SetMethod.SetSInt32))(val);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case CReflectedProperty::UInt32:
|
case CReflectedProperty::UInt32:
|
||||||
{
|
{
|
||||||
uint32 val= (uint32)ls.toNumber(stackIndex);
|
uint32 val= (uint32)ls.toInteger(stackIndex);
|
||||||
(target.*(property.SetMethod.SetUInt32))(val);
|
(target.*(property.SetMethod.SetUInt32))(val);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1474,7 +1476,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
ucstring val;
|
ucstring val;
|
||||||
// Additionaly return of CInterfaceExpr may be std::string... test std string too
|
// Additionaly return of CInterfaceExpr may be std::string... test std string too
|
||||||
if(ls.isString() || ls.isNumber())
|
if(ls.isString() || ls.isNumber() || ls.isInteger())
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
ls.toString(stackIndex, str);
|
ls.toString(stackIndex, str);
|
||||||
|
|
|
@ -32,10 +32,22 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
CLuaManager::~CLuaManager()
|
CLuaManager::~CLuaManager()
|
||||||
|
{
|
||||||
|
if (luaState)
|
||||||
{
|
{
|
||||||
delete luaState;
|
delete luaState;
|
||||||
luaState = NULL;
|
luaState = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaManager::releaseInstance()
|
||||||
|
{
|
||||||
|
if (instance)
|
||||||
|
{
|
||||||
|
delete instance;
|
||||||
|
instance = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CLuaManager::executeLuaScript( const std::string &luaScript, bool smallScript )
|
bool CLuaManager::executeLuaScript( const std::string &luaScript, bool smallScript )
|
||||||
{
|
{
|
||||||
|
@ -60,7 +72,8 @@ namespace NLGUI
|
||||||
|
|
||||||
void CLuaManager::ResetLuaState()
|
void CLuaManager::ResetLuaState()
|
||||||
{
|
{
|
||||||
delete luaState;
|
if (luaState) delete luaState;
|
||||||
|
|
||||||
luaState = new CLuaState( debugLua );
|
luaState = new CLuaState( debugLua );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,7 @@ namespace NLGUI
|
||||||
// *************************************************
|
// *************************************************
|
||||||
bool CLuaObject::isNil() const { push(); bool result = _LuaState->isNil(); _LuaState->pop(); return result; }
|
bool CLuaObject::isNil() const { push(); bool result = _LuaState->isNil(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isNumber() const { push(); bool result = _LuaState->isNumber(); _LuaState->pop(); return result; }
|
bool CLuaObject::isNumber() const { push(); bool result = _LuaState->isNumber(); _LuaState->pop(); return result; }
|
||||||
|
bool CLuaObject::isInteger() const { push(); bool result = _LuaState->isInteger(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isBoolean() const { push(); bool result = _LuaState->isBoolean(); _LuaState->pop(); return result; }
|
bool CLuaObject::isBoolean() const { push(); bool result = _LuaState->isBoolean(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isString() const { push(); bool result = _LuaState->isString(); _LuaState->pop(); return result; }
|
bool CLuaObject::isString() const { push(); bool result = _LuaState->isString(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isFunction() const { push(); bool result = _LuaState->isFunction(); _LuaState->pop(); return result; }
|
bool CLuaObject::isFunction() const { push(); bool result = _LuaState->isFunction(); _LuaState->pop(); return result; }
|
||||||
|
@ -168,6 +169,7 @@ namespace NLGUI
|
||||||
// *************************************************
|
// *************************************************
|
||||||
bool CLuaObject::toBoolean() const { push(); bool result = _LuaState->toBoolean(); _LuaState->pop(); return result; }
|
bool CLuaObject::toBoolean() const { push(); bool result = _LuaState->toBoolean(); _LuaState->pop(); return result; }
|
||||||
lua_Number CLuaObject::toNumber() const { push(); lua_Number result = _LuaState->toNumber(); _LuaState->pop(); return result; }
|
lua_Number CLuaObject::toNumber() const { push(); lua_Number result = _LuaState->toNumber(); _LuaState->pop(); return result; }
|
||||||
|
lua_Integer CLuaObject::toInteger() const { push(); lua_Integer result = _LuaState->toInteger(); _LuaState->pop(); return result; }
|
||||||
std::string CLuaObject::toString() const
|
std::string CLuaObject::toString() const
|
||||||
{
|
{
|
||||||
push();
|
push();
|
||||||
|
@ -194,6 +196,8 @@ namespace NLGUI
|
||||||
CLuaObject::operator bool() const { return toBoolean(); }
|
CLuaObject::operator bool() const { return toBoolean(); }
|
||||||
CLuaObject::operator float() const { return (float) toNumber(); }
|
CLuaObject::operator float() const { return (float) toNumber(); }
|
||||||
CLuaObject::operator double() const { return (double) toNumber(); }
|
CLuaObject::operator double() const { return (double) toNumber(); }
|
||||||
|
CLuaObject::operator sint32() const { return (sint32) toInteger(); }
|
||||||
|
CLuaObject::operator sint64() const { return (sint64) toInteger(); }
|
||||||
CLuaObject::operator std::string() const { return toString(); }
|
CLuaObject::operator std::string() const { return toString(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,56 +84,43 @@ namespace NLGUI
|
||||||
_OffsetY = getY();
|
_OffsetY = getY();
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_default");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_default");
|
||||||
if (prop) _TxDefault = (const char *) prop;
|
if (prop) _TxDefault = NLMISC::toLower ((const char *) prop);
|
||||||
_TxDefault = NLMISC::strlwr (_TxDefault);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_move_window");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_move_window");
|
||||||
if (prop) _TxMoveWindow = (const char *) prop;
|
if (prop) _TxMoveWindow = NLMISC::toLower ((const char *) prop);
|
||||||
_TxMoveWindow = NLMISC::strlwr (_TxMoveWindow);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BR_TL");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BR_TL");
|
||||||
if (prop) _TxResizeBRTL = (const char *) prop;
|
if (prop) _TxResizeBRTL = NLMISC::toLower ((const char *) prop);
|
||||||
_TxResizeBRTL = NLMISC::strlwr (_TxResizeBRTL);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BL_TR");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BL_TR");
|
||||||
if (prop) _TxResizeBLTR = (const char *) prop;
|
if (prop) _TxResizeBLTR = NLMISC::toLower ((const char *) prop);
|
||||||
_TxResizeBLTR = NLMISC::strlwr (_TxResizeBLTR);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_TB");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_TB");
|
||||||
if (prop) _TxResizeTB = (const char *) prop;
|
if (prop) _TxResizeTB = NLMISC::toLower ((const char *) prop);
|
||||||
_TxResizeTB = NLMISC::strlwr (_TxResizeTB);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_LR");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_LR");
|
||||||
if (prop) _TxResizeLR = (const char *) prop;
|
if (prop) _TxResizeLR = NLMISC::toLower ((const char *) prop);
|
||||||
_TxResizeLR = NLMISC::strlwr (_TxResizeLR);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_rotate");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_rotate");
|
||||||
if (prop) _TxRotate = (const char *) prop;
|
if (prop) _TxRotate = NLMISC::toLower ((const char *) prop);
|
||||||
_TxRotate = NLMISC::strlwr (_TxRotate);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_scale");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_scale");
|
||||||
if (prop) _TxScale = (const char *) prop;
|
if (prop) _TxScale = NLMISC::toLower ((const char *) prop);
|
||||||
_TxScale = NLMISC::strlwr (_TxScale);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_colpick");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_colpick");
|
||||||
if (prop) _TxColPick = (const char *) prop;
|
if (prop) _TxColPick = NLMISC::toLower ((const char *) prop);
|
||||||
_TxColPick = NLMISC::strlwr (_TxColPick);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan");
|
||||||
if (prop) _TxPan = (const char *) prop;
|
if (prop) _TxPan = NLMISC::toLower ((const char *) prop);
|
||||||
_TxPan = NLMISC::strlwr (_TxPan);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan");
|
||||||
if (prop) _TxCanPan = (const char *) prop;
|
if (prop) _TxCanPan = NLMISC::toLower ((const char *) prop);
|
||||||
_TxCanPan = NLMISC::strlwr (_TxCanPan);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan_r2");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan_r2");
|
||||||
if (prop) _TxPanR2 = (const char *) prop;
|
if (prop) _TxPanR2 = NLMISC::toLower ((const char *) prop);
|
||||||
_TxPanR2 = NLMISC::strlwr (_TxPanR2);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan_r2");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan_r2");
|
||||||
if (prop) _TxCanPanR2 = (const char *) prop;
|
if (prop) _TxCanPanR2 = NLMISC::toLower ((const char *) prop);
|
||||||
_TxCanPanR2 = NLMISC::strlwr (_TxCanPanR2);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"color");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"color");
|
||||||
if (prop) _Color = convertColor(prop);
|
if (prop) _Color = convertColor(prop);
|
||||||
|
|
|
@ -854,12 +854,11 @@ namespace NLGUI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Look if already existing
|
// Look if already existing
|
||||||
string sLwrGTName = strlwr(sGlobalTextureName);
|
string sLwrGTName = toLower(sGlobalTextureName);
|
||||||
TGlobalTextureList::iterator ite = _GlobalTextures.begin();
|
TGlobalTextureList::iterator ite = _GlobalTextures.begin();
|
||||||
while (ite != _GlobalTextures.end())
|
while (ite != _GlobalTextures.end())
|
||||||
{
|
{
|
||||||
std::string sText = strlwr(ite->Name);
|
if (toLower(ite->Name) == sLwrGTName)
|
||||||
if (sText == sLwrGTName)
|
|
||||||
break;
|
break;
|
||||||
ite++;
|
ite++;
|
||||||
}
|
}
|
||||||
|
@ -984,11 +983,11 @@ namespace NLGUI
|
||||||
*/
|
*/
|
||||||
NL3D::UTexture *CViewRenderer::getGlobalTexture(const std::string &name)
|
NL3D::UTexture *CViewRenderer::getGlobalTexture(const std::string &name)
|
||||||
{
|
{
|
||||||
string sLwrGTName = strlwr(name);
|
string sLwrGTName = NLMISC::toLower(name);
|
||||||
TGlobalTextureList::iterator ite = _GlobalTextures.begin();
|
TGlobalTextureList::iterator ite = _GlobalTextures.begin();
|
||||||
while (ite != _GlobalTextures.end())
|
while (ite != _GlobalTextures.end())
|
||||||
{
|
{
|
||||||
std::string sText = strlwr(ite->Name);
|
std::string sText = NLMISC::toLower(ite->Name);
|
||||||
if (sText == sLwrGTName)
|
if (sText == sLwrGTName)
|
||||||
break;
|
break;
|
||||||
ite++;
|
ite++;
|
||||||
|
|
|
@ -734,11 +734,13 @@ void CRGBA::buildFromHLS(float h, float l, float s)
|
||||||
|
|
||||||
CRGBA CRGBA::stringToRGBA( const char *ptr )
|
CRGBA CRGBA::stringToRGBA( const char *ptr )
|
||||||
{
|
{
|
||||||
if (!ptr)
|
if (ptr)
|
||||||
return NLMISC::CRGBA::White;
|
{
|
||||||
|
|
||||||
int r = 255, g = 255, b = 255, a = 255;
|
int r = 255, g = 255, b = 255, a = 255;
|
||||||
sscanf( ptr, "%d %d %d %d", &r, &g, &b, &a );
|
|
||||||
|
// we need at least 3 integer values to consider string is valid
|
||||||
|
if (sscanf( ptr, "%d %d %d %d", &r, &g, &b, &a ) >= 3)
|
||||||
|
{
|
||||||
clamp( r, 0, 255 );
|
clamp( r, 0, 255 );
|
||||||
clamp( g, 0, 255 );
|
clamp( g, 0, 255 );
|
||||||
clamp( b, 0, 255 );
|
clamp( b, 0, 255 );
|
||||||
|
@ -746,6 +748,10 @@ CRGBA CRGBA::stringToRGBA( const char *ptr )
|
||||||
|
|
||||||
return CRGBA( r,g,b,a );
|
return CRGBA( r,g,b,a );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NLMISC::CRGBA::White;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CRGBA::toString() const
|
std::string CRGBA::toString() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,8 +61,7 @@ void CAnimationFX::buildTrack(NL3D::UAnimationSet *as)
|
||||||
nlassert(Sheet != NULL);
|
nlassert(Sheet != NULL);
|
||||||
if (!as) return;
|
if (!as) return;
|
||||||
if (Sheet->TrajectoryAnim.empty()) return;
|
if (Sheet->TrajectoryAnim.empty()) return;
|
||||||
std::string animName = Sheet->TrajectoryAnim;
|
std::string animName = NLMISC::toLower(Sheet->TrajectoryAnim);
|
||||||
NLMISC::strlwr(animName);
|
|
||||||
uint id = as->getAnimationIdByName(animName);
|
uint id = as->getAnimationIdByName(animName);
|
||||||
NL3D::UAnimation *anim = NULL;
|
NL3D::UAnimation *anim = NULL;
|
||||||
if (id != NL3D::UAnimationSet::NotFound)
|
if (id != NL3D::UAnimationSet::NotFound)
|
||||||
|
|
|
@ -81,7 +81,7 @@ void initAutoAnimation()
|
||||||
file.getline(line, 512);
|
file.getline(line, 512);
|
||||||
|
|
||||||
// Read the animation file
|
// Read the animation file
|
||||||
string animName = strlwr (CFile::getFilenameWithoutExtension(line));
|
string animName = toLower(CFile::getFilenameWithoutExtension(line));
|
||||||
uint id = AutoAnimSet->addAnimation (line, animName.c_str ());
|
uint id = AutoAnimSet->addAnimation (line, animName.c_str ());
|
||||||
if (id == UAnimationSet::NotFound)
|
if (id == UAnimationSet::NotFound)
|
||||||
{
|
{
|
||||||
|
|
|
@ -610,7 +610,7 @@ uint32 CCharacterCL::buildEquipment(const CCharacterSheet::CEquipment &slot, SLO
|
||||||
{
|
{
|
||||||
// IS the item a valid one ?
|
// IS the item a valid one ?
|
||||||
CSheetId itemId;
|
CSheetId itemId;
|
||||||
if(itemId.buildSheetId(NLMISC::strlwr(slot.getItem())))
|
if(itemId.buildSheetId(NLMISC::toLower(slot.getItem())))
|
||||||
{
|
{
|
||||||
// Is it stored in the database ?
|
// Is it stored in the database ?
|
||||||
CEntitySheet *entitySheet = SheetMngr.get(itemId);
|
CEntitySheet *entitySheet = SheetMngr.get(itemId);
|
||||||
|
@ -1098,7 +1098,7 @@ string CCharacterCL::automatonType() const // virtual
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
void CCharacterCL::computeAutomaton()
|
void CCharacterCL::computeAutomaton()
|
||||||
{
|
{
|
||||||
_CurrentAutomaton = automatonType() + "_" + NLMISC::strlwr(MBEHAV::modeToString(_Mode)) + ".automaton";
|
_CurrentAutomaton = automatonType() + "_" + NLMISC::toLower(MBEHAV::modeToString(_Mode)) + ".automaton";
|
||||||
}// computeAutomaton //
|
}// computeAutomaton //
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -520,7 +520,7 @@ int main(int argc, char **argv)
|
||||||
uint i;
|
uint i;
|
||||||
for (i=0; i<files.size(); i++)
|
for (i=0; i<files.size(); i++)
|
||||||
{
|
{
|
||||||
if (strlwr (CFile::getExtension (files[i])) == "ttf")
|
if (toLower(CFile::getExtension (files[i])) == "ttf")
|
||||||
CFile::deleteFile (files[i]);
|
CFile::deleteFile (files[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,7 +676,6 @@ CClientConfig::CClientConfig()
|
||||||
DamageShieldEnabled = false;
|
DamageShieldEnabled = false;
|
||||||
|
|
||||||
AllowDebugLua = false;
|
AllowDebugLua = false;
|
||||||
LoadLuaDebugger = false;
|
|
||||||
DisplayLuaDebugInfo = false;
|
DisplayLuaDebugInfo = false;
|
||||||
BeepWhenLaunched = false;
|
BeepWhenLaunched = false;
|
||||||
|
|
||||||
|
@ -1747,7 +1746,6 @@ void CClientConfig::setValues()
|
||||||
READ_BOOL_DEV(DamageShieldEnabled)
|
READ_BOOL_DEV(DamageShieldEnabled)
|
||||||
|
|
||||||
READ_BOOL_DEV(AllowDebugLua)
|
READ_BOOL_DEV(AllowDebugLua)
|
||||||
READ_BOOL_DEV(LoadLuaDebugger)
|
|
||||||
READ_BOOL_DEV(DisplayLuaDebugInfo)
|
READ_BOOL_DEV(DisplayLuaDebugInfo)
|
||||||
|
|
||||||
READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled)
|
READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled)
|
||||||
|
|
|
@ -766,7 +766,6 @@ struct CClientConfig
|
||||||
|
|
||||||
/// Allow Lua commands (commands beginning with Lua)
|
/// Allow Lua commands (commands beginning with Lua)
|
||||||
bool AllowDebugLua;
|
bool AllowDebugLua;
|
||||||
bool LoadLuaDebugger;
|
|
||||||
|
|
||||||
bool LuaDebugInfoGotoButtonEnabled;
|
bool LuaDebugInfoGotoButtonEnabled;
|
||||||
std::string LuaDebugInfoGotoButtonTemplate;
|
std::string LuaDebugInfoGotoButtonTemplate;
|
||||||
|
|
|
@ -929,7 +929,7 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string type = NLMISC::strlwr(args[0]);
|
std::string type = NLMISC::toLower(args[0]);
|
||||||
if (type == "none")
|
if (type == "none")
|
||||||
Verbose = VerboseNone;
|
Verbose = VerboseNone;
|
||||||
else if(type == "magic")
|
else if(type == "magic")
|
||||||
|
|
|
@ -522,7 +522,7 @@ void CContinent::select(const CVectorD &pos, NLMISC::IProgressCallback &progress
|
||||||
// Associate IGs with the ZC number or -1 if there is no ZC.
|
// Associate IGs with the ZC number or -1 if there is no ZC.
|
||||||
for(uint i = 0; i<igsWithNames.size(); ++i)
|
for(uint i = 0; i<igsWithNames.size(); ++i)
|
||||||
{
|
{
|
||||||
string igZone = strlwr(CFile::getFilenameWithoutExtension(igsWithNames[i].second));
|
string igZone = toLower(CFile::getFilenameWithoutExtension(igsWithNames[i].second));
|
||||||
|
|
||||||
// Search for the IG name in the ZC list to associate.
|
// Search for the IG name in the ZC list to associate.
|
||||||
for(uint j = 0; j<ZCList.size(); ++j)
|
for(uint j = 0; j<ZCList.size(); ++j)
|
||||||
|
@ -532,7 +532,7 @@ void CContinent::select(const CVectorD &pos, NLMISC::IProgressCallback &progress
|
||||||
if (outpost)
|
if (outpost)
|
||||||
{
|
{
|
||||||
// If name matching -> this zone should be a ZC.
|
// If name matching -> this zone should be a ZC.
|
||||||
string outpostZone = strlwr(CFile::getFilenameWithoutExtension(ZCList[j].Name));
|
string outpostZone = toLower(CFile::getFilenameWithoutExtension(ZCList[j].Name));
|
||||||
if(igZone == outpostZone)
|
if(igZone == outpostZone)
|
||||||
{
|
{
|
||||||
nlctassert(RZ_MAX_BUILDING_PER_OUTPOST==4);
|
nlctassert(RZ_MAX_BUILDING_PER_OUTPOST==4);
|
||||||
|
@ -788,7 +788,7 @@ void CContinent::reloadFogMap()
|
||||||
const R2::CScenarioEntryPoints::CCompleteIsland *completeIsland = R2::CScenarioEntryPoints::getInstance().getCompleteIslandFromCoords(CVector2f((float) UserEntity->pos().x, (float) UserEntity->pos().y));
|
const R2::CScenarioEntryPoints::CCompleteIsland *completeIsland = R2::CScenarioEntryPoints::getInstance().getCompleteIslandFromCoords(CVector2f((float) UserEntity->pos().x, (float) UserEntity->pos().y));
|
||||||
if (completeIsland)
|
if (completeIsland)
|
||||||
{
|
{
|
||||||
std::string islandName = strlwr(completeIsland->Island);
|
std::string islandName = toLower(completeIsland->Island);
|
||||||
std::string::size_type lastPos = islandName.find_last_of("_");
|
std::string::size_type lastPos = islandName.find_last_of("_");
|
||||||
if (lastPos != std::string::npos)
|
if (lastPos != std::string::npos)
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,7 +183,7 @@ void CContinentManager::preloadSheets()
|
||||||
for (i = 0; i < ws->ContLocs.size(); ++i)
|
for (i = 0; i < ws->ContLocs.size(); ++i)
|
||||||
{
|
{
|
||||||
const SContLoc &clTmp = ws->ContLocs[i];
|
const SContLoc &clTmp = ws->ContLocs[i];
|
||||||
std::string continentSheetName = NLMISC::strlwr(clTmp.ContinentName);
|
std::string continentSheetName = NLMISC::toLower(clTmp.ContinentName);
|
||||||
if (continentSheetName.find(".continent") == std::string::npos)
|
if (continentSheetName.find(".continent") == std::string::npos)
|
||||||
{
|
{
|
||||||
continentSheetName += ".continent";
|
continentSheetName += ".continent";
|
||||||
|
|
|
@ -248,8 +248,7 @@ void CDoorManager::SDoor::checkToClose()
|
||||||
std::string CDoorManager::transformName (uint /* index */, const std::string &/* instanceName */, const std::string &shapeName)
|
std::string CDoorManager::transformName (uint /* index */, const std::string &/* instanceName */, const std::string &shapeName)
|
||||||
{
|
{
|
||||||
if (shapeName.rfind('.') == string::npos) return shapeName;
|
if (shapeName.rfind('.') == string::npos) return shapeName;
|
||||||
string sExt = shapeName.substr(shapeName.rfind('.')+1,shapeName.size());
|
string sExt = toLower(shapeName.substr(shapeName.rfind('.')+1,shapeName.size()));
|
||||||
sExt = strlwr(sExt);
|
|
||||||
if (sExt != "pacs_prim") return shapeName;
|
if (sExt != "pacs_prim") return shapeName;
|
||||||
return ""; // Do not load a pacs prim as a mesh...
|
return ""; // Do not load a pacs prim as a mesh...
|
||||||
}
|
}
|
||||||
|
@ -266,8 +265,7 @@ void CDoorManager::loadedCallback (NL3D::UInstanceGroup *ig)
|
||||||
string sShapeName = ig->getShapeName(k);
|
string sShapeName = ig->getShapeName(k);
|
||||||
if (sShapeName.rfind('.') == string::npos) continue;
|
if (sShapeName.rfind('.') == string::npos) continue;
|
||||||
|
|
||||||
string sExt = sShapeName.substr(sShapeName.rfind('.')+1,sShapeName.size());
|
string sExt = toLower(sShapeName.substr(sShapeName.rfind('.')+1,sShapeName.size()));
|
||||||
sExt = strlwr(sExt);
|
|
||||||
if (sExt != "pacs_prim") continue;
|
if (sExt != "pacs_prim") continue;
|
||||||
|
|
||||||
// Check if the pacs_prim is a door detection
|
// Check if the pacs_prim is a door detection
|
||||||
|
@ -349,7 +347,7 @@ void CDoorManager::loadedCallback (NL3D::UInstanceGroup *ig)
|
||||||
case SDoor::Matis3PartBourgeon:
|
case SDoor::Matis3PartBourgeon:
|
||||||
{
|
{
|
||||||
string sDebug = ig->getShapeName(i);
|
string sDebug = ig->getShapeName(i);
|
||||||
sDebug = strlwr(sDebug.substr(sDebug.rfind('_')+1,sDebug.size()));
|
sDebug = toLower(sDebug.substr(sDebug.rfind('_')+1,sDebug.size()));
|
||||||
if (sDebug == "gauche")
|
if (sDebug == "gauche")
|
||||||
pDoor->Instances[0] = i;
|
pDoor->Instances[0] = i;
|
||||||
else if (sDebug == "droite")
|
else if (sDebug == "droite")
|
||||||
|
@ -362,7 +360,7 @@ void CDoorManager::loadedCallback (NL3D::UInstanceGroup *ig)
|
||||||
case SDoor::Zorai2Part:
|
case SDoor::Zorai2Part:
|
||||||
{
|
{
|
||||||
string sDebug = ig->getShapeName(i);
|
string sDebug = ig->getShapeName(i);
|
||||||
sDebug = strlwr(sDebug.substr(sDebug.rfind('_')+1,sDebug.size()));
|
sDebug = toLower(sDebug.substr(sDebug.rfind('_')+1,sDebug.size()));
|
||||||
if (sDebug == "gauche")
|
if (sDebug == "gauche")
|
||||||
pDoor->Instances[0] = i;
|
pDoor->Instances[0] = i;
|
||||||
else if (sDebug == "droite")
|
else if (sDebug == "droite")
|
||||||
|
|
|
@ -205,7 +205,7 @@ void CEntityAnimationManager::load(NLMISC::IProgressCallback &/* progress */, bo
|
||||||
for (uint32 i = 0; i < pASLS->AnimSetList.size(); ++i)
|
for (uint32 i = 0; i < pASLS->AnimSetList.size(); ++i)
|
||||||
{
|
{
|
||||||
CAnimationSet as;
|
CAnimationSet as;
|
||||||
string sTmp = strlwr(pASLS->AnimSetList[i].Name);
|
string sTmp = toLower(pASLS->AnimSetList[i].Name);
|
||||||
sTmp = sTmp.substr(0,sTmp.rfind('.'));
|
sTmp = sTmp.substr(0,sTmp.rfind('.'));
|
||||||
pair<map<string,CAnimationSet>::iterator, bool> it;
|
pair<map<string,CAnimationSet>::iterator, bool> it;
|
||||||
it = _AnimSet.insert(pair<string,CAnimationSet>(sTmp,as));
|
it = _AnimSet.insert(pair<string,CAnimationSet>(sTmp,as));
|
||||||
|
|
|
@ -520,7 +520,7 @@ void CGroundFXManager::update(const NLMISC::CVectorD &camPos)
|
||||||
}
|
}
|
||||||
if (!fxName.empty())
|
if (!fxName.empty())
|
||||||
{
|
{
|
||||||
stdFXName = NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(fxName));
|
stdFXName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(fxName));
|
||||||
}
|
}
|
||||||
// is an fx already attached to the entity ?
|
// is an fx already attached to the entity ?
|
||||||
if (_SortedInstances[k]->HasFX)
|
if (_SortedInstances[k]->HasFX)
|
||||||
|
|
|
@ -197,7 +197,7 @@ void CIGCallback::CIGInstance::instanceGroupAdded()
|
||||||
uint numInstances = _IG->getNumInstance();
|
uint numInstances = _IG->getNumInstance();
|
||||||
for(uint k = 0; k < numInstances; ++k)
|
for(uint k = 0; k < numInstances; ++k)
|
||||||
{
|
{
|
||||||
TPacsPrimMap::iterator pbIt = PacsPrims.find(NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(_IG->getShapeName(k))));
|
TPacsPrimMap::iterator pbIt = PacsPrims.find(NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(_IG->getShapeName(k))));
|
||||||
if (pbIt != PacsPrims.end())
|
if (pbIt != PacsPrims.end())
|
||||||
{
|
{
|
||||||
// compute orientation and position
|
// compute orientation and position
|
||||||
|
|
|
@ -505,8 +505,7 @@ void checkDriverVersion()
|
||||||
uint i;
|
uint i;
|
||||||
for (i=0; i< sizeofarray(driversVersion); i++)
|
for (i=0; i< sizeofarray(driversVersion); i++)
|
||||||
{
|
{
|
||||||
string lwr = deviceName;
|
string lwr = toLower(deviceName);
|
||||||
strlwr(lwr);
|
|
||||||
if ((lwr.find (driversTest[i])!=string::npos) && (driversNTest[i]==NULL || lwr.find (driversNTest[i])==string::npos))
|
if ((lwr.find (driversTest[i])!=string::npos) && (driversNTest[i]==NULL || lwr.find (driversNTest[i])==string::npos))
|
||||||
{
|
{
|
||||||
if (driverVersion < driversVersion[i])
|
if (driverVersion < driversVersion[i])
|
||||||
|
@ -1290,7 +1289,7 @@ void initBotObjectSelection()
|
||||||
{
|
{
|
||||||
// IS the item a valid one ?
|
// IS the item a valid one ?
|
||||||
CSheetId itemId;
|
CSheetId itemId;
|
||||||
if(itemId.buildSheetId(NLMISC::strlwr(strShape)))
|
if(itemId.buildSheetId(NLMISC::toLower(strShape)))
|
||||||
{
|
{
|
||||||
// Get this item sheet ?
|
// Get this item sheet ?
|
||||||
CItemSheet *itemSheet= dynamic_cast<CItemSheet *>(SheetMngr.get(itemId));
|
CItemSheet *itemSheet= dynamic_cast<CItemSheet *>(SheetMngr.get(itemId));
|
||||||
|
|
|
@ -333,29 +333,29 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"nature" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"nature" );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
if (NLMISC::strlwr(prop.str()) == "item")
|
if (NLMISC::toLower(prop.str()) == "item")
|
||||||
_Type = CCtrlSheetInfo::SheetType_Item;
|
_Type = CCtrlSheetInfo::SheetType_Item;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "pact")
|
else if (NLMISC::toLower(prop.str()) == "pact")
|
||||||
_Type = CCtrlSheetInfo::SheetType_Pact;
|
_Type = CCtrlSheetInfo::SheetType_Pact;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "skill")
|
else if (NLMISC::toLower(prop.str()) == "skill")
|
||||||
_Type = CCtrlSheetInfo::SheetType_Skill;
|
_Type = CCtrlSheetInfo::SheetType_Skill;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "auto")
|
else if (NLMISC::toLower(prop.str()) == "auto")
|
||||||
_Type = CCtrlSheetInfo::SheetType_Auto;
|
_Type = CCtrlSheetInfo::SheetType_Auto;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "macro")
|
else if (NLMISC::toLower(prop.str()) == "macro")
|
||||||
_Type = CCtrlSheetInfo::SheetType_Macro;
|
_Type = CCtrlSheetInfo::SheetType_Macro;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "guild_flag")
|
else if (NLMISC::toLower(prop.str()) == "guild_flag")
|
||||||
_Type = CCtrlSheetInfo::SheetType_GuildFlag;
|
_Type = CCtrlSheetInfo::SheetType_GuildFlag;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "mission")
|
else if (NLMISC::toLower(prop.str()) == "mission")
|
||||||
_Type = CCtrlSheetInfo::SheetType_Mission;
|
_Type = CCtrlSheetInfo::SheetType_Mission;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "sbrick")
|
else if (NLMISC::toLower(prop.str()) == "sbrick")
|
||||||
_Type = CCtrlSheetInfo::SheetType_SBrick;
|
_Type = CCtrlSheetInfo::SheetType_SBrick;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "sphraseid")
|
else if (NLMISC::toLower(prop.str()) == "sphraseid")
|
||||||
_Type = CCtrlSheetInfo::SheetType_SPhraseId;
|
_Type = CCtrlSheetInfo::SheetType_SPhraseId;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "sphrase")
|
else if (NLMISC::toLower(prop.str()) == "sphrase")
|
||||||
_Type = CCtrlSheetInfo::SheetType_SPhrase;
|
_Type = CCtrlSheetInfo::SheetType_SPhrase;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "elevator_destination")
|
else if (NLMISC::toLower(prop.str()) == "elevator_destination")
|
||||||
_Type = CCtrlSheetInfo::SheetType_ElevatorDestination;
|
_Type = CCtrlSheetInfo::SheetType_ElevatorDestination;
|
||||||
else if (NLMISC::strlwr(prop.str()) == "outpost_building")
|
else if (NLMISC::toLower(prop.str()) == "outpost_building")
|
||||||
_Type = CCtrlSheetInfo::SheetType_OutpostBuilding;
|
_Type = CCtrlSheetInfo::SheetType_OutpostBuilding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,8 +363,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_noitem" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_noitem" );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
string TxName = (const char *) prop;
|
string TxName = toLower((const char *) prop);
|
||||||
TxName = strlwr (TxName);
|
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
_DispNoSheetBmpId = rVR.getTextureIdFromName (TxName);
|
_DispNoSheetBmpId = rVR.getTextureIdFromName (TxName);
|
||||||
}
|
}
|
||||||
|
@ -410,27 +409,23 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_l" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_l" );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
string tmp = (const char *) prop;
|
_ListMenuLeft = toLower((const char *) prop);
|
||||||
_ListMenuLeft = strlwr(tmp);
|
|
||||||
}
|
}
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
string tmp = (const char *) prop;
|
_ListMenuRight = toLower((const char *) prop);
|
||||||
_ListMenuRight = strlwr(tmp);
|
|
||||||
}
|
}
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r_empty_slot" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r_empty_slot" );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
string tmp = (const char *) prop;
|
_ListMenuRightEmptySlot = toLower((const char *) prop);
|
||||||
_ListMenuRightEmptySlot = strlwr(tmp);
|
|
||||||
}
|
}
|
||||||
// list menu on both clicks
|
// list menu on both clicks
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_b" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_b" );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
string tmp = (const char *) prop;
|
setListMenuBoth(toLower((const char *) prop));
|
||||||
setListMenuBoth(strlwr(tmp));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// _BrickTypeBitField
|
// _BrickTypeBitField
|
||||||
|
@ -1745,7 +1740,7 @@ void CDBCtrlSheet::resetCharBitmaps()
|
||||||
void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar, bool topDown)
|
void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar, bool topDown)
|
||||||
{
|
{
|
||||||
// Use the optString for the Macro name
|
// Use the optString for the Macro name
|
||||||
_OptString = strlwr(_OptString);
|
_OptString = toLower(_OptString);
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ void CCompassTarget::serial(NLMISC::IStream &f)
|
||||||
// for the name, try to save a string identifier if possible, because language may be changed between
|
// for the name, try to save a string identifier if possible, because language may be changed between
|
||||||
// save & reload
|
// save & reload
|
||||||
f.serial(Name);
|
f.serial(Name);
|
||||||
std::string language = strlwr(ClientCfg.LanguageCode);
|
std::string language = toLower(ClientCfg.LanguageCode);
|
||||||
f.serial(language);
|
f.serial(language);
|
||||||
f.serialEnum(_Type);
|
f.serialEnum(_Type);
|
||||||
if (_Type == PosTracker)
|
if (_Type == PosTracker)
|
||||||
|
@ -100,7 +100,7 @@ void CCompassTarget::serial(NLMISC::IStream &f)
|
||||||
// reset the compass to north to avoid incoherency
|
// reset the compass to north to avoid incoherency
|
||||||
if (f.isReading())
|
if (f.isReading())
|
||||||
{
|
{
|
||||||
if (strlwr(ClientCfg.LanguageCode) != language)
|
if (toLower(ClientCfg.LanguageCode) != language)
|
||||||
{
|
{
|
||||||
*this = CCompassTarget();
|
*this = CCompassTarget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -729,7 +729,7 @@ bool CDBGroupListAscensor::CSheetChildAscensor::isInvalidated(CDBGroupListSheetT
|
||||||
{
|
{
|
||||||
|
|
||||||
LIFT_ICONS::TLiftIcon li = (LIFT_ICONS::TLiftIcon)(icon & UINT64_CONSTANT(0x7FFFFFFFFFFFFFFF));
|
LIFT_ICONS::TLiftIcon li = (LIFT_ICONS::TLiftIcon)(icon & UINT64_CONSTANT(0x7FFFFFFFFFFFFFFF));
|
||||||
string str = strlwr(LIFT_ICONS::toString(li));
|
string str = toLower(LIFT_ICONS::toString(li));
|
||||||
Ctrl->setType(CCtrlSheetInfo::SheetType_Teleport_Location);
|
Ctrl->setType(CCtrlSheetInfo::SheetType_Teleport_Location);
|
||||||
Ctrl->setSlot("asc_"+str+".tga");
|
Ctrl->setSlot("asc_"+str+".tga");
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||||
CXMLAutoPtr ptr((const char*)xmlGetProp (cur, (xmlChar*)"name"));
|
CXMLAutoPtr ptr((const char*)xmlGetProp (cur, (xmlChar*)"name"));
|
||||||
string animName;
|
string animName;
|
||||||
if (ptr)
|
if (ptr)
|
||||||
animName = strlwr (CFile::getFilenameWithoutExtension(ptr.str()));
|
animName = toLower(CFile::getFilenameWithoutExtension(ptr.str()));
|
||||||
|
|
||||||
if (!animName.empty())
|
if (!animName.empty())
|
||||||
{
|
{
|
||||||
|
@ -856,7 +856,7 @@ int CInterface3DCharacter::luaSetupCharacter3D(CLuaState &ls)
|
||||||
const char *funcName = "setupCharacter3D";
|
const char *funcName = "setupCharacter3D";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
setupCharacter3D((sint32) ls.toNumber(1));
|
setupCharacter3D((sint32) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1084,11 +1084,9 @@ bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup)
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"rot");
|
ptr = xmlGetProp (cur, (xmlChar*)"rot");
|
||||||
if (ptr) _Rot = convertVector(ptr);
|
if (ptr) _Rot = convertVector(ptr);
|
||||||
|
|
||||||
string name;
|
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"name");
|
ptr = xmlGetProp (cur, (xmlChar*)"name");
|
||||||
if (ptr) name = (const char*)ptr;
|
if (ptr) _Name = toLower((const char*)ptr);
|
||||||
|
|
||||||
_Name = strlwr(name);
|
|
||||||
_IG = UInstanceGroup::createInstanceGroup(_Name);
|
_IG = UInstanceGroup::createInstanceGroup(_Name);
|
||||||
if (_IG == NULL)
|
if (_IG == NULL)
|
||||||
return true; // Create anyway
|
return true; // Create anyway
|
||||||
|
@ -1202,7 +1200,7 @@ std::string CInterface3DIG::getName() const
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void CInterface3DIG::setName (const std::string &ht)
|
void CInterface3DIG::setName (const std::string &ht)
|
||||||
{
|
{
|
||||||
string lwrname = strlwr(ht);
|
string lwrname = toLower(ht);
|
||||||
if (lwrname != _Name)
|
if (lwrname != _Name)
|
||||||
{
|
{
|
||||||
CInterface3DScene *pI3DS = dynamic_cast<CInterface3DScene*>(_Parent);
|
CInterface3DScene *pI3DS = dynamic_cast<CInterface3DScene*>(_Parent);
|
||||||
|
@ -1248,11 +1246,9 @@ bool CInterface3DShape::parse (xmlNodePtr cur, CInterface3DScene *parentGroup)
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"rot");
|
ptr = xmlGetProp (cur, (xmlChar*)"rot");
|
||||||
if (ptr) _Rot = convertVector(ptr);
|
if (ptr) _Rot = convertVector(ptr);
|
||||||
|
|
||||||
string name;
|
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"name");
|
ptr = xmlGetProp (cur, (xmlChar*)"name");
|
||||||
if (ptr) name = (const char*)ptr;
|
if (ptr) _Name = toLower((const char*)ptr);
|
||||||
|
|
||||||
_Name = strlwr(name);
|
|
||||||
_Instance = parentGroup->getScene()->createInstance(_Name);
|
_Instance = parentGroup->getScene()->createInstance(_Name);
|
||||||
if (_Instance.empty())
|
if (_Instance.empty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -1529,11 +1525,8 @@ bool CInterface3DFX::parse (xmlNodePtr cur, CInterface3DScene *parentGroup)
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"rot");
|
ptr = xmlGetProp (cur, (xmlChar*)"rot");
|
||||||
if (ptr) _Rot = convertVector(ptr);
|
if (ptr) _Rot = convertVector(ptr);
|
||||||
|
|
||||||
string name;
|
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"name");
|
ptr = xmlGetProp (cur, (xmlChar*)"name");
|
||||||
if (ptr) name = (const char*)ptr;
|
if (ptr) _Name = toLower((const char*)ptr);
|
||||||
|
|
||||||
_Name = strlwr(name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2280,7 +2280,7 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat
|
||||||
CRGBA color = CRGBA::White;
|
CRGBA color = CRGBA::White;
|
||||||
|
|
||||||
|
|
||||||
map<string, CClientConfig::SSysInfoParam>::const_iterator it = ClientCfg.SystemInfoParams.find(strlwr(cat));
|
map<string, CClientConfig::SSysInfoParam>::const_iterator it = ClientCfg.SystemInfoParams.find(toLower(cat));
|
||||||
if (it != ClientCfg.SystemInfoParams.end())
|
if (it != ClientCfg.SystemInfoParams.end())
|
||||||
{
|
{
|
||||||
mode = it->second.Mode;
|
mode = it->second.Mode;
|
||||||
|
@ -2315,7 +2315,7 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat
|
||||||
CRGBA CInterfaceManager::getSystemInfoColor(const std::string &cat)
|
CRGBA CInterfaceManager::getSystemInfoColor(const std::string &cat)
|
||||||
{
|
{
|
||||||
CRGBA col = CRGBA::White;
|
CRGBA col = CRGBA::White;
|
||||||
map<string, CClientConfig::SSysInfoParam>::const_iterator it = ClientCfg.SystemInfoParams.find(strlwr(cat));
|
map<string, CClientConfig::SSysInfoParam>::const_iterator it = ClientCfg.SystemInfoParams.find(toLower(cat));
|
||||||
if (it != ClientCfg.SystemInfoParams.end())
|
if (it != ClientCfg.SystemInfoParams.end())
|
||||||
col = it->second.Color;
|
col = it->second.Color;
|
||||||
return col;
|
return col;
|
||||||
|
@ -3327,11 +3327,17 @@ void CInterfaceManager::getLuaValueInfo(std::string &str, sint index)
|
||||||
|
|
||||||
sint type= ls.type(index);
|
sint type= ls.type(index);
|
||||||
if(type==LUA_TNIL)
|
if(type==LUA_TNIL)
|
||||||
|
{
|
||||||
str= "nil";
|
str= "nil";
|
||||||
|
}
|
||||||
else if(type==LUA_TNUMBER)
|
else if(type==LUA_TNUMBER)
|
||||||
str= NLMISC::toString(ls.toNumber(index));
|
{
|
||||||
|
str= NLMISC::toString(ls.isInteger(index) ? ls.toInteger(index):ls.toNumber(index));
|
||||||
|
}
|
||||||
else if(type==LUA_TBOOLEAN)
|
else if(type==LUA_TBOOLEAN)
|
||||||
|
{
|
||||||
str= ls.toBoolean(index)?"true":"false";
|
str= ls.toBoolean(index)?"true":"false";
|
||||||
|
}
|
||||||
else if(type==LUA_TSTRING)
|
else if(type==LUA_TSTRING)
|
||||||
{
|
{
|
||||||
ls.toString(index, str);
|
ls.toString(index, str);
|
||||||
|
|
|
@ -3488,7 +3488,7 @@ CItemImage &CInventoryManager::getServerItem(uint inv, uint index)
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
CInventoryManager::TInvType CInventoryManager::invTypeFromString(const string &str)
|
CInventoryManager::TInvType CInventoryManager::invTypeFromString(const string &str)
|
||||||
{
|
{
|
||||||
string sTmp = strlwr(str);
|
string sTmp = toLower(str);
|
||||||
if (sTmp == "inv_bag") return InvBag;
|
if (sTmp == "inv_bag") return InvBag;
|
||||||
if (sTmp == "inv_pa0") return InvPA0;
|
if (sTmp == "inv_pa0") return InvPA0;
|
||||||
if (sTmp == "inv_pa1") return InvPA1;
|
if (sTmp == "inv_pa1") return InvPA1;
|
||||||
|
|
|
@ -219,17 +219,24 @@ static DECLARE_INTERFACE_USER_FCT(lua)
|
||||||
ok= true;
|
ok= true;
|
||||||
}
|
}
|
||||||
else if(type==LUA_TNUMBER)
|
else if(type==LUA_TNUMBER)
|
||||||
|
{
|
||||||
|
if (ls.isInteger())
|
||||||
|
{
|
||||||
|
// get and pop
|
||||||
|
sint64 val= ls.toInteger();
|
||||||
|
ls.pop();
|
||||||
|
result.setInteger(val);
|
||||||
|
ok= true;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// get and pop
|
// get and pop
|
||||||
double val= ls.toNumber();
|
double val= ls.toNumber();
|
||||||
ls.pop();
|
ls.pop();
|
||||||
// set double or integer?
|
|
||||||
if(val==floor(val))
|
|
||||||
result.setInteger(sint64(floor(val)));
|
|
||||||
else
|
|
||||||
result.setDouble(val);
|
result.setDouble(val);
|
||||||
ok= true;
|
ok= true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(type==LUA_TSTRING)
|
else if(type==LUA_TSTRING)
|
||||||
{
|
{
|
||||||
// get and pop
|
// get and pop
|
||||||
|
@ -1020,7 +1027,7 @@ int CLuaIHMRyzom::setLuaBreakPoint(CLuaState &ls)
|
||||||
#ifdef LUA_NEVRAX_VERSION
|
#ifdef LUA_NEVRAX_VERSION
|
||||||
if (LuaDebuggerIDE)
|
if (LuaDebuggerIDE)
|
||||||
{
|
{
|
||||||
LuaDebuggerIDE->setBreakPoint(ls.toString(1), (int) ls.toNumber(2));
|
LuaDebuggerIDE->setBreakPoint(ls.toString(1), (int) ls.toInteger(2));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1144,7 +1151,7 @@ int CLuaIHMRyzom::getPlayerDirection(CLuaState &ls)
|
||||||
int CLuaIHMRyzom::getPlayerGender(CLuaState &ls)
|
int CLuaIHMRyzom::getPlayerGender(CLuaState &ls)
|
||||||
{
|
{
|
||||||
CLuaIHM::checkArgCount(ls, "getPlayerGender", 0);
|
CLuaIHM::checkArgCount(ls, "getPlayerGender", 0);
|
||||||
ls.push((lua_Number)(UserEntity->getGender()));
|
ls.push((lua_Integer)(UserEntity->getGender()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1210,7 +1217,7 @@ int CLuaIHMRyzom::getTargetGender(CLuaState &ls)
|
||||||
CLuaIHM::checkArgCount(ls, "getTargetGender", 0);
|
CLuaIHM::checkArgCount(ls, "getTargetGender", 0);
|
||||||
CCharacterCL* target = (CCharacterCL*)getTargetEntity();
|
CCharacterCL* target = (CCharacterCL*)getTargetEntity();
|
||||||
if (!target) return (int)GSGENDER::unknown;
|
if (!target) return (int)GSGENDER::unknown;
|
||||||
ls.push((lua_Number)(target->getGender()));
|
ls.push((lua_Integer)(target->getGender()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,14 +1351,14 @@ int CLuaIHMRyzom::getSheet2idx(CLuaState &ls)
|
||||||
CLuaIHM::checkArgType(ls, "getSheet2idx", 2, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, "getSheet2idx", 2, LUA_TNUMBER);
|
||||||
|
|
||||||
const std::string & sheedtName = ls.toString(1);
|
const std::string & sheedtName = ls.toString(1);
|
||||||
uint32 slotId = (uint32)ls.toNumber(2);
|
uint32 slotId = (uint32)ls.toInteger(2);
|
||||||
|
|
||||||
NLMISC::CSheetId sheetId;
|
NLMISC::CSheetId sheetId;
|
||||||
|
|
||||||
if (sheetId.buildSheetId(sheedtName))
|
if (sheetId.buildSheetId(sheedtName))
|
||||||
{
|
{
|
||||||
uint32 idx = CVisualSlotManager::getInstance()->sheet2Index(sheetId, (SLOTTYPE::EVisualSlot)slotId);
|
uint32 idx = CVisualSlotManager::getInstance()->sheet2Index(sheetId, (SLOTTYPE::EVisualSlot)slotId);
|
||||||
ls.push((lua_Number)idx);
|
ls.push((lua_Integer)idx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1362,7 +1369,7 @@ int CLuaIHMRyzom::getSheet2idx(CLuaState &ls)
|
||||||
int CLuaIHMRyzom::getTargetSlot(CLuaState &ls)
|
int CLuaIHMRyzom::getTargetSlot(CLuaState &ls)
|
||||||
{
|
{
|
||||||
uint32 slot = (uint32)getTargetSlotNr();
|
uint32 slot = (uint32)getTargetSlotNr();
|
||||||
ls.push((lua_Number)slot);
|
ls.push((lua_Integer)slot);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1372,7 +1379,7 @@ int CLuaIHMRyzom::getSlotDataSetId(CLuaState &ls)
|
||||||
CLuaIHM::checkArgCount(ls, "getSlotDataSetId", 1);
|
CLuaIHM::checkArgCount(ls, "getSlotDataSetId", 1);
|
||||||
CLuaIHM::checkArgType(ls, "getSlotDataSetId", 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, "getSlotDataSetId", 1, LUA_TNUMBER);
|
||||||
|
|
||||||
uint32 slot = (uint32)ls.toNumber(1);
|
uint32 slot = (uint32)ls.toInteger(1);
|
||||||
CEntityCL *e = getSlotEntity(slot);
|
CEntityCL *e = getSlotEntity(slot);
|
||||||
string id = toString(e->dataSetId());
|
string id = toString(e->dataSetId());
|
||||||
ls.push(id);
|
ls.push(id);
|
||||||
|
@ -1676,7 +1683,7 @@ int CLuaIHMRyzom::displayBubble(CLuaState &ls)
|
||||||
strs.push_back(it.nextKey().toString());
|
strs.push_back(it.nextKey().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
InSceneBubbleManager.webIgChatOpen((uint32)ls.toNumber(1), ls.toString(2), strs, links);
|
InSceneBubbleManager.webIgChatOpen((uint32)ls.toInteger(1), ls.toString(2), strs, links);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,7 @@ public:
|
||||||
while (*bufferPtr)
|
while (*bufferPtr)
|
||||||
{
|
{
|
||||||
// Concat the directory name with the filename
|
// Concat the directory name with the filename
|
||||||
if (strlwr (CFile::getExtension(bufferPtr)) == "m3u")
|
if (toLower(CFile::getExtension(bufferPtr)) == "m3u")
|
||||||
playlists.push_back (path+bufferPtr);
|
playlists.push_back (path+bufferPtr);
|
||||||
else
|
else
|
||||||
filenames.push_back (path+bufferPtr);
|
filenames.push_back (path+bufferPtr);
|
||||||
|
|
|
@ -155,10 +155,10 @@ bool CPeopleList::create(const CPeopleListDesc &desc, const CChatWindowDesc *cha
|
||||||
//==================================================================
|
//==================================================================
|
||||||
sint CPeopleList::getIndexFromName(const ucstring &name) const
|
sint CPeopleList::getIndexFromName(const ucstring &name) const
|
||||||
{
|
{
|
||||||
string sNameIn = strlwr(name.toString());
|
string sNameIn = toLower(name.toString());
|
||||||
for(uint k = 0; k < _Peoples.size(); ++k)
|
for(uint k = 0; k < _Peoples.size(); ++k)
|
||||||
{
|
{
|
||||||
string sPeopleName = strlwr(_Peoples[k].getName().toString());
|
string sPeopleName = toLower(_Peoples[k].getName().toString());
|
||||||
if (sPeopleName == sNameIn) return k;
|
if (sPeopleName == sNameIn) return k;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -404,8 +404,7 @@ void CSBrickManager::compileBrickProperties()
|
||||||
string::size_type pos = prop.Text.find(':');
|
string::size_type pos = prop.Text.find(':');
|
||||||
if (pos != string::npos)
|
if (pos != string::npos)
|
||||||
{
|
{
|
||||||
string key = prop.Text.substr(0, pos);
|
string key = toLower(prop.Text.substr(0, pos));
|
||||||
strlwr(key);
|
|
||||||
string value = prop.Text.substr(pos + 1);
|
string value = prop.Text.substr(pos + 1);
|
||||||
// get key id.
|
// get key id.
|
||||||
if (_BrickPropIdMap.find(key) == _BrickPropIdMap.end())
|
if (_BrickPropIdMap.find(key) == _BrickPropIdMap.end())
|
||||||
|
@ -501,12 +500,12 @@ void CSBrickManager::compileBrickProperties()
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
// get the key and replace text with value
|
// get the key and replace text with value
|
||||||
if(key.size())
|
if (!key.empty())
|
||||||
{
|
{
|
||||||
// Parse all the brick properties if match the key
|
// Parse all the brick properties if match the key
|
||||||
float value= 0.f;
|
float value= 0.f;
|
||||||
// get the wanted prop id
|
// get the wanted prop id
|
||||||
strlwr(key);
|
key = toLower(key);
|
||||||
uint propId= getBrickPropId(key);
|
uint propId= getBrickPropId(key);
|
||||||
// if propid exist
|
// if propid exist
|
||||||
if(propId)
|
if(propId)
|
||||||
|
|
|
@ -59,8 +59,7 @@ bool CViewBitmapFaberMp::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_noitem" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_noitem" );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
_TextureNoItemName = (const char *) prop;
|
_TextureNoItemName = toLower((const char *) prop);
|
||||||
_TextureNoItemName = strlwr (_TextureNoItemName);
|
|
||||||
_TextureNoItemId = -2;
|
_TextureNoItemId = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,7 @@ bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)spotTextureNames[i] );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)spotTextureNames[i] );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
txName = (const char *) prop;
|
txName = toLower((const char *) prop);
|
||||||
txName = strlwr (txName);
|
|
||||||
}
|
}
|
||||||
_SpotDescriptions[i].TextureId.setTexture(txName.c_str());
|
_SpotDescriptions[i].TextureId.setTexture(txName.c_str());
|
||||||
rVR.getTextureSizeFromId (_SpotDescriptions[i].TextureId, _SpotDescriptions[i].TxW, _SpotDescriptions[i].TxH);
|
rVR.getTextureSizeFromId (_SpotDescriptions[i].TextureId, _SpotDescriptions[i].TxW, _SpotDescriptions[i].TxH);
|
||||||
|
@ -105,8 +104,7 @@ bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)spotMiniTextureNames[i] );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)spotMiniTextureNames[i] );
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
txName = (const char *) prop;
|
txName = toLower((const char *) prop);
|
||||||
txName = strlwr (txName);
|
|
||||||
}
|
}
|
||||||
_SpotDescriptions[i].MiniTextureId.setTexture(txName.c_str());
|
_SpotDescriptions[i].MiniTextureId.setTexture(txName.c_str());
|
||||||
rVR.getTextureSizeFromId (_SpotDescriptions[i].MiniTextureId, _SpotDescriptions[i].MTxW, _SpotDescriptions[i].MTxH);
|
rVR.getTextureSizeFromId (_SpotDescriptions[i].MiniTextureId, _SpotDescriptions[i].MTxW, _SpotDescriptions[i].MTxH);
|
||||||
|
|
|
@ -108,7 +108,7 @@ void CMeshCameraColManager::instanceGroupAdded(NL3D::UInstanceGroup *ig)
|
||||||
bool avoidCollisionInside= ig->dontCastShadowForInterior(i);
|
bool avoidCollisionInside= ig->dontCastShadowForInterior(i);
|
||||||
bool avoidCollisionOutside= ig->dontCastShadowForExterior(i);
|
bool avoidCollisionOutside= ig->dontCastShadowForExterior(i);
|
||||||
// very special patch for the matis serre (grrrrrrrrrrrrr)
|
// very special patch for the matis serre (grrrrrrrrrrrrr)
|
||||||
avoidCollisionOutside= avoidCollisionOutside || strlwr(shapeName)== "ma_serre_interieur.shape";
|
avoidCollisionOutside= avoidCollisionOutside || toLower(shapeName)== "ma_serre_interieur.shape";
|
||||||
|
|
||||||
// then send the result to the collision manager, and keep the mesh col id if succeed
|
// then send the result to the collision manager, and keep the mesh col id if succeed
|
||||||
uint32 meshId= CollisionManager->addMeshInstanceCollision(colMesh, mat, avoidCollisionInside, avoidCollisionOutside);
|
uint32 meshId= CollisionManager->addMeshInstanceCollision(colMesh, mat, avoidCollisionInside, avoidCollisionOutside);
|
||||||
|
|
|
@ -692,7 +692,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
|
||||||
if (!stringCategory.empty() && stringCategory != "SYS")
|
if (!stringCategory.empty() && stringCategory != "SYS")
|
||||||
{
|
{
|
||||||
map<string, CClientConfig::SSysInfoParam>::const_iterator it;
|
map<string, CClientConfig::SSysInfoParam>::const_iterator it;
|
||||||
it = ClientCfg.SystemInfoParams.find(strlwr(stringCategory));
|
it = ClientCfg.SystemInfoParams.find(toLower(stringCategory));
|
||||||
if (it != ClientCfg.SystemInfoParams.end())
|
if (it != ClientCfg.SystemInfoParams.end())
|
||||||
{
|
{
|
||||||
col = it->second.Color;
|
col = it->second.Color;
|
||||||
|
@ -723,7 +723,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
|
||||||
if( !stringCategory.empty() )
|
if( !stringCategory.empty() )
|
||||||
{
|
{
|
||||||
map<string, CClientConfig::SSysInfoParam>::const_iterator it;
|
map<string, CClientConfig::SSysInfoParam>::const_iterator it;
|
||||||
it = ClientCfg.SystemInfoParams.find( strlwr(stringCategory) );
|
it = ClientCfg.SystemInfoParams.find( toLower(stringCategory) );
|
||||||
if( it != ClientCfg.SystemInfoParams.end() )
|
if( it != ClientCfg.SystemInfoParams.end() )
|
||||||
{
|
{
|
||||||
if( !(*it).second.SysInfoFxName.empty() )
|
if( !(*it).second.SysInfoFxName.empty() )
|
||||||
|
|
|
@ -99,7 +99,7 @@ void COutpost::initOutpost ()
|
||||||
for (i=0; i<RZ_MAX_BUILDING_PER_OUTPOST; i++)
|
for (i=0; i<RZ_MAX_BUILDING_PER_OUTPOST; i++)
|
||||||
{
|
{
|
||||||
// Put the ZC pacs_prim
|
// Put the ZC pacs_prim
|
||||||
TPacsPrimMap::iterator pbIt = PacsPrims.find(NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(ClientCfg.ZCPacsPrim)));
|
TPacsPrimMap::iterator pbIt = PacsPrims.find(NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(ClientCfg.ZCPacsPrim)));
|
||||||
if (pbIt != PacsPrims.end())
|
if (pbIt != PacsPrims.end())
|
||||||
{
|
{
|
||||||
// Build the building matrix
|
// Build the building matrix
|
||||||
|
|
|
@ -142,7 +142,7 @@ UInstanceGroup *getCluster(const UGlobalPosition &gp)
|
||||||
if(strPos.empty())
|
if(strPos.empty())
|
||||||
return 0;
|
return 0;
|
||||||
// try to find the ig in the loaded ig map
|
// try to find the ig in the loaded ig map
|
||||||
std::map<std::string, UInstanceGroup *>::const_iterator igIt = IGLoaded.find(strlwr(strPos));
|
std::map<std::string, UInstanceGroup *>::const_iterator igIt = IGLoaded.find(toLower(strPos));
|
||||||
if (igIt != IGLoaded.end())
|
if (igIt != IGLoaded.end())
|
||||||
{
|
{
|
||||||
return igIt->second;
|
return igIt->second;
|
||||||
|
@ -188,7 +188,7 @@ void releaseLandscapeIGCallbacks()
|
||||||
|
|
||||||
void addPacsPrim(const std::string &fileName)
|
void addPacsPrim(const std::string &fileName)
|
||||||
{
|
{
|
||||||
std::string ppName = NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(fileName));
|
std::string ppName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(fileName));
|
||||||
if (PacsPrims.find(ppName) != PacsPrims.end())
|
if (PacsPrims.find(ppName) != PacsPrims.end())
|
||||||
{
|
{
|
||||||
nlwarning(("Pacs primitive " + ppName + " already has been inserted").c_str());
|
nlwarning(("Pacs primitive " + ppName + " already has been inserted").c_str());
|
||||||
|
|
|
@ -144,9 +144,9 @@ typedef CConfigVar<double> CConfigVarDouble;
|
||||||
inline std::string getConfigVarTypename(const sint32 &/* dummy */) { return "sint32"; }
|
inline std::string getConfigVarTypename(const sint32 &/* dummy */) { return "sint32"; }
|
||||||
inline bool getConfigVarValue(CLuaObject &luaValue, sint32 &dest)
|
inline bool getConfigVarValue(CLuaObject &luaValue, sint32 &dest)
|
||||||
{
|
{
|
||||||
if (luaValue.isNumber())
|
if (luaValue.isInteger())
|
||||||
{
|
{
|
||||||
dest = (sint32) luaValue.toNumber();
|
dest = (sint32) luaValue.toInteger();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -403,10 +403,10 @@ sint CComLuaModule::luaSaveUserComponentFile(lua_State* state)
|
||||||
luaL_checktype(state, 1, LUA_TSTRING);
|
luaL_checktype(state, 1, LUA_TSTRING);
|
||||||
luaL_checktype(state, 2, LUA_TNUMBER);
|
luaL_checktype(state, 2, LUA_TNUMBER);
|
||||||
std::string filename( lua_tostring(state, 1) );
|
std::string filename( lua_tostring(state, 1) );
|
||||||
double mustCompress( lua_tonumber(state, 2) );
|
bool mustCompress(lua_tointeger(state, 2) != 0);
|
||||||
|
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
this2->_Client->getEditionModule().saveUserComponentFile(filename, mustCompress != 0);
|
this2->_Client->getEditionModule().saveUserComponentFile(filename, mustCompress);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ sint CComLuaModule::luaUpdateUserComponentsInfo(lua_State* state)
|
||||||
std::string filename( lua_tostring(state, 1) );
|
std::string filename( lua_tostring(state, 1) );
|
||||||
std::string name( lua_tostring(state, 2) );
|
std::string name( lua_tostring(state, 2) );
|
||||||
std::string description( lua_tostring(state, 3) );
|
std::string description( lua_tostring(state, 3) );
|
||||||
uint32 timestamp( static_cast<uint32>(lua_tonumber(state, 3) ));
|
uint32 timestamp( static_cast<uint32>(lua_tointeger(state, 3) ));
|
||||||
std::string md5Id( lua_tostring(state, 3) );
|
std::string md5Id( lua_tostring(state, 3) );
|
||||||
|
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
|
@ -441,7 +441,7 @@ sint CComLuaModule::luaGetSheetIdName(lua_State* state)
|
||||||
|
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
nlassert(this2);
|
nlassert(this2);
|
||||||
uint32 sheetIdValue = static_cast<uint32>( lua_tonumber(state, 1) );
|
uint32 sheetIdValue = static_cast<uint32>( lua_tointeger(state, 1) );
|
||||||
|
|
||||||
NLMISC::CSheetId sheetId(sheetIdValue);
|
NLMISC::CSheetId sheetId(sheetIdValue);
|
||||||
if(sheetId != NLMISC::CSheetId::Unknown)
|
if(sheetId != NLMISC::CSheetId::Unknown)
|
||||||
|
@ -538,7 +538,7 @@ sint CComLuaModule::luaRequestSetWeather(lua_State* state)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CComLuaModule_luaRequestSetWeather)
|
//H_AUTO(R2_CComLuaModule_luaRequestSetWeather)
|
||||||
luaL_checktype(state, 1, LUA_TNUMBER);
|
luaL_checktype(state, 1, LUA_TNUMBER);
|
||||||
uint16 weatherValue = (uint16) lua_tonumber(state, 1);
|
uint16 weatherValue = (uint16) lua_tointeger(state, 1);
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
nlassert(this2);
|
nlassert(this2);
|
||||||
this2->_Client->getEditionModule().requestSetWeather(weatherValue);
|
this2->_Client->getEditionModule().requestSetWeather(weatherValue);
|
||||||
|
@ -550,7 +550,7 @@ sint CComLuaModule::luaRequestSetSeason(lua_State* state)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CComLuaModule_luaRequestSetSeason)
|
//H_AUTO(R2_CComLuaModule_luaRequestSetSeason)
|
||||||
luaL_checktype(state, 1, LUA_TNUMBER);
|
luaL_checktype(state, 1, LUA_TNUMBER);
|
||||||
uint8 season = (uint8) lua_tonumber(state, 1);
|
uint8 season = (uint8) lua_tointeger(state, 1);
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
nlassert(this2);
|
nlassert(this2);
|
||||||
this2->_Client->getEditionModule().requestSetSeason(season);
|
this2->_Client->getEditionModule().requestSetSeason(season);
|
||||||
|
@ -572,7 +572,7 @@ sint CComLuaModule::luaRequestStartAct(lua_State* state)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CComLuaModule_luaRequestStartAct)
|
//H_AUTO(R2_CComLuaModule_luaRequestStartAct)
|
||||||
luaL_checktype(state, 1, LUA_TNUMBER);
|
luaL_checktype(state, 1, LUA_TNUMBER);
|
||||||
uint32 actId(static_cast<uint32>(lua_tonumber(state, 1)));
|
uint32 actId(static_cast<uint32>(lua_tointeger(state, 1)));
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
nlassert(this2);
|
nlassert(this2);
|
||||||
this2->_Client->getEditionModule().requestStartAct(actId);
|
this2->_Client->getEditionModule().requestStartAct(actId);
|
||||||
|
@ -712,7 +712,7 @@ sint CComLuaModule::luaRequestMapConnection(lua_State* state)
|
||||||
CHECK_LUA_ARG_COUNT(1, "requestMapConnection");
|
CHECK_LUA_ARG_COUNT(1, "requestMapConnection");
|
||||||
luaL_checktype(state, 1, LUA_TNUMBER);
|
luaL_checktype(state, 1, LUA_TNUMBER);
|
||||||
|
|
||||||
uint32 adventureId = static_cast<uint32>( lua_tonumber(state, 1) );
|
uint32 adventureId = static_cast<uint32>( lua_tointeger(state, 1) );
|
||||||
|
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
nlassert(this2);
|
nlassert(this2);
|
||||||
|
@ -751,7 +751,7 @@ sint CComLuaModule::requestInsertNode(lua_State* state, bool isGhost)
|
||||||
|
|
||||||
std::string instanceId(lua_tostring(state, 1));
|
std::string instanceId(lua_tostring(state, 1));
|
||||||
std::string attrName(lua_tostring(state, 2));
|
std::string attrName(lua_tostring(state, 2));
|
||||||
sint position(static_cast<sint>(lua_tonumber(state, 3)));
|
sint position(static_cast<sint>(lua_tointeger(state, 3)));
|
||||||
std::string key(lua_tostring(state, 4));
|
std::string key(lua_tostring(state, 4));
|
||||||
CObject* value = getObjectFromLua(state, 5);
|
CObject* value = getObjectFromLua(state, 5);
|
||||||
value->setGhost(isGhost);
|
value->setGhost(isGhost);
|
||||||
|
@ -837,7 +837,7 @@ sint CComLuaModule::luaRequestEraseNode(lua_State* state)
|
||||||
std::string attrName;
|
std::string attrName;
|
||||||
sint position = -1;
|
sint position = -1;
|
||||||
if (args>1){ attrName = lua_tostring(state, 2);}
|
if (args>1){ attrName = lua_tostring(state, 2);}
|
||||||
if (args>2){ position = static_cast<sint>(lua_tonumber(state, 3));}
|
if (args>2){ position = static_cast<sint>(lua_tointeger(state, 3));}
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
nlassert(this2);
|
nlassert(this2);
|
||||||
this2->_Client->requestEraseNode( instanceId, attrName, position);
|
this2->_Client->requestEraseNode( instanceId, attrName, position);
|
||||||
|
@ -863,11 +863,11 @@ sint CComLuaModule::luaRequestMoveNode(lua_State* state)
|
||||||
|
|
||||||
std::string instanceId(lua_tostring(state, 1));
|
std::string instanceId(lua_tostring(state, 1));
|
||||||
std::string attrName(lua_tostring(state, 2));
|
std::string attrName(lua_tostring(state, 2));
|
||||||
sint position = static_cast<sint>(lua_tonumber(state, 3));
|
sint position = static_cast<sint>(lua_tointeger(state, 3));
|
||||||
|
|
||||||
std::string instanceId2(lua_tostring(state, 4));
|
std::string instanceId2(lua_tostring(state, 4));
|
||||||
std::string attrName2(lua_tostring(state, 5));
|
std::string attrName2(lua_tostring(state, 5));
|
||||||
sint position2 = static_cast<sint>(lua_tonumber(state, 6));
|
sint position2 = static_cast<sint>(lua_tointeger(state, 6));
|
||||||
|
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
nlassert(this2);
|
nlassert(this2);
|
||||||
|
@ -967,7 +967,7 @@ sint CComLuaModule::luaRequestNewMultiAction(lua_State* state)
|
||||||
sint args = lua_gettop(state);
|
sint args = lua_gettop(state);
|
||||||
CHECK_LUA_ARG_COUNT(2, funcName);
|
CHECK_LUA_ARG_COUNT(2, funcName);
|
||||||
luaL_checktype(state, 2, LUA_TNUMBER);
|
luaL_checktype(state, 2, LUA_TNUMBER);
|
||||||
uint count = (uint) lua_tonumber(state, 2);
|
uint count = (uint) lua_tointeger(state, 2);
|
||||||
lua_pop(state, 1);
|
lua_pop(state, 1);
|
||||||
return luaRequestNewAction(state, false, count);
|
return luaRequestNewAction(state, false, count);
|
||||||
}
|
}
|
||||||
|
@ -979,7 +979,7 @@ sint CComLuaModule::luaRequestNewPendingMultiAction(lua_State* state)
|
||||||
sint args = lua_gettop(state);
|
sint args = lua_gettop(state);
|
||||||
CHECK_LUA_ARG_COUNT(2, funcName);
|
CHECK_LUA_ARG_COUNT(2, funcName);
|
||||||
luaL_checktype(state, 2, LUA_TNUMBER);
|
luaL_checktype(state, 2, LUA_TNUMBER);
|
||||||
uint count = (uint) lua_tonumber(state, 2);
|
uint count = (uint) lua_tointeger(state, 2);
|
||||||
lua_pop(state, 1);
|
lua_pop(state, 1);
|
||||||
return luaRequestNewAction(state, true, count);
|
return luaRequestNewAction(state, true, count);
|
||||||
}
|
}
|
||||||
|
@ -1049,6 +1049,13 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
|
||||||
lua_pushnil(state);
|
lua_pushnil(state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( object->isInteger() )
|
||||||
|
{
|
||||||
|
lua_pushinteger(state, object->toInteger());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( object->isNumber() )
|
if ( object->isNumber() )
|
||||||
{
|
{
|
||||||
lua_pushnumber(state, object->toNumber());
|
lua_pushnumber(state, object->toNumber());
|
||||||
|
@ -1226,10 +1233,21 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx)
|
||||||
{
|
{
|
||||||
case LUA_TNUMBER:
|
case LUA_TNUMBER:
|
||||||
{
|
{
|
||||||
|
#if LUA_VERSION_NUM >= 503
|
||||||
|
if (lua_isinteger(state, -1) != 0)
|
||||||
|
{
|
||||||
|
sint64 value = lua_tointeger(state, -1);
|
||||||
|
lua_pop(state, 1);
|
||||||
|
return new CObjectInteger(value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
double value = lua_tonumber(state, -1);
|
double value = lua_tonumber(state, -1);
|
||||||
lua_pop(state, 1);
|
lua_pop(state, 1);
|
||||||
return new CObjectNumber(value);
|
return new CObjectNumber(value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LUA_TBOOLEAN:
|
case LUA_TBOOLEAN:
|
||||||
|
@ -1738,8 +1756,8 @@ sint CComLuaModule::luaTriggerUserTrigger(lua_State* state)
|
||||||
//H_AUTO(R2_CComLuaModule_luaTriggerUserTrigger)
|
//H_AUTO(R2_CComLuaModule_luaTriggerUserTrigger)
|
||||||
CComLuaModule* this2 = getInstance(state);
|
CComLuaModule* this2 = getInstance(state);
|
||||||
nlassert(this2);
|
nlassert(this2);
|
||||||
uint32 actId( static_cast<uint32>(lua_tonumber(state, 1) ) );
|
uint32 actId( static_cast<uint32>(lua_tointeger(state, 1) ) );
|
||||||
uint32 id( static_cast<uint32>(lua_tonumber(state, 2) ));
|
uint32 id( static_cast<uint32>(lua_tointeger(state, 2) ));
|
||||||
this2->_Client->getEditionModule().requestTriggerUserTrigger(actId, id);
|
this2->_Client->getEditionModule().requestTriggerUserTrigger(actId, id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1869,7 +1887,7 @@ sint CComLuaModule::luaReserveIdRange(lua_State* state)
|
||||||
CHECK_LUA_ARG_COUNT(1, "reserveIdRange");
|
CHECK_LUA_ARG_COUNT(1, "reserveIdRange");
|
||||||
luaL_checktype(state, 1, LUA_TNUMBER);
|
luaL_checktype(state, 1, LUA_TNUMBER);
|
||||||
|
|
||||||
uint32 range=static_cast<uint32>( lua_tonumber(state, 1) );
|
uint32 range=static_cast<uint32>( lua_tointeger(state, 1) );
|
||||||
|
|
||||||
this2->_Client->getEditionModule().reserveIdRange(range);
|
this2->_Client->getEditionModule().reserveIdRange(range);
|
||||||
|
|
||||||
|
@ -1897,7 +1915,7 @@ sint CComLuaModule::luaRequestTpToEntryPoint(lua_State* state)
|
||||||
CHECK_LUA_ARG_COUNT(1, "requestTpToEntryPoint");
|
CHECK_LUA_ARG_COUNT(1, "requestTpToEntryPoint");
|
||||||
luaL_checktype(state, 1, LUA_TNUMBER);
|
luaL_checktype(state, 1, LUA_TNUMBER);
|
||||||
|
|
||||||
uint32 actIndex = static_cast<uint32>( lua_tonumber(state, 1) );
|
uint32 actIndex = static_cast<uint32>( lua_tointeger(state, 1) );
|
||||||
this2->_Client->getEditionModule().requestTpToEntryPoint(actIndex);
|
this2->_Client->getEditionModule().requestTpToEntryPoint(actIndex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1914,7 +1932,7 @@ sint CComLuaModule::luaRequestSetStartingAct(lua_State* state)
|
||||||
CHECK_LUA_ARG_COUNT(1, "requestSetStartingAct");
|
CHECK_LUA_ARG_COUNT(1, "requestSetStartingAct");
|
||||||
luaL_checktype(state, 1, LUA_TNUMBER);
|
luaL_checktype(state, 1, LUA_TNUMBER);
|
||||||
|
|
||||||
uint32 actIndex = static_cast<uint32>( lua_tonumber(state, 1) );
|
uint32 actIndex = static_cast<uint32>( lua_tointeger(state, 1) );
|
||||||
this2->_Client->getEditionModule().requestSetStartingAct(actIndex);
|
this2->_Client->getEditionModule().requestSetStartingAct(actIndex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1993,7 +2011,7 @@ sint CComLuaModule::luaSetDisplayInfo(lua_State* state)
|
||||||
|
|
||||||
|
|
||||||
std::string formName( lua_tostring(state, 1) );
|
std::string formName( lua_tostring(state, 1) );
|
||||||
bool displayInfo = static_cast<bool>(lua_tonumber(state, 2) == 0);
|
bool displayInfo = lua_tointeger(state, 2) != 0;
|
||||||
|
|
||||||
//this2->_Client->getEditionModule().reserveIdRange(range);
|
//this2->_Client->getEditionModule().reserveIdRange(range);
|
||||||
this2->_Client->getEditionModule().setDisplayInfo(formName, displayInfo);
|
this2->_Client->getEditionModule().setDisplayInfo(formName, displayInfo);
|
||||||
|
@ -2024,7 +2042,7 @@ sint CComLuaModule::luaSetStartingActIndex(lua_State* state)
|
||||||
sint args = lua_gettop(state);
|
sint args = lua_gettop(state);
|
||||||
CHECK_LUA_ARG_COUNT(1, "setStartingActIndex");
|
CHECK_LUA_ARG_COUNT(1, "setStartingActIndex");
|
||||||
luaL_checktype(state, 1, LUA_TNUMBER);
|
luaL_checktype(state, 1, LUA_TNUMBER);
|
||||||
this2->_Client->getEditionModule().setStartingActIndex( static_cast<uint32>(lua_tonumber(state, 1)) );
|
this2->_Client->getEditionModule().setStartingActIndex( static_cast<uint32>(lua_tointeger(state, 1)) );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2229,12 +2247,12 @@ sint CComLuaModule::luaUpdateScenarioAck(lua_State* state)
|
||||||
{
|
{
|
||||||
std::string key = object->getKey(i);
|
std::string key = object->getKey(i);
|
||||||
CObject* value = object->getValue(i);
|
CObject* value = object->getValue(i);
|
||||||
if (value->isNumber())
|
if (value->isInteger())
|
||||||
{
|
{
|
||||||
|
|
||||||
if (key.size() == 1)
|
if (key.size() == 1)
|
||||||
{
|
{
|
||||||
level[key] = static_cast<int>(value->toNumber());
|
level[key] = static_cast<int>(value->toInteger());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,14 @@ double CPropertyAccessor::getValueAsNumber(CObject* component, const std::string
|
||||||
return object->toNumber();
|
return object->toNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sint64 CPropertyAccessor::getValueAsInteger(CObject* component, const std::string& attrName) const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CPropertyAccessor_getValueAsInteger)
|
||||||
|
const CObject* object=getPropertyValue((const CObject *) component, attrName);
|
||||||
|
if (!object || !object->isInteger()) { return 0; }
|
||||||
|
return object->toInteger();
|
||||||
|
}
|
||||||
|
|
||||||
bool CPropertyAccessor::hasValueInBase(CObject *component, const std::string& attrName)
|
bool CPropertyAccessor::hasValueInBase(CObject *component, const std::string& attrName)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CPropertyAccessor_hasValueInBase)
|
//H_AUTO(R2_CPropertyAccessor_hasValueInBase)
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace R2
|
||||||
|
|
||||||
//get The propertyValue as number or 0 if not found
|
//get The propertyValue as number or 0 if not found
|
||||||
double getValueAsNumber(CObject* component, const std::string& attrName) const;
|
double getValueAsNumber(CObject* component, const std::string& attrName) const;
|
||||||
|
sint64 getValueAsInteger(CObject* component, const std::string& attrName) const;
|
||||||
|
|
||||||
const CObject* getPropertyValue(const CObject* component, const std::string& attrName) const;
|
const CObject* getPropertyValue(const CObject* component, const std::string& attrName) const;
|
||||||
|
|
||||||
|
|
|
@ -1297,13 +1297,13 @@ int CEditor::luaSetPlotItemInfos(CLuaState &ls)
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 3);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 3);
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 4);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 4);
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 5);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 5);
|
||||||
CItemSheet *item = dynamic_cast<CItemSheet *>(SheetMngr.get(CSheetId((uint32) ls.toNumber(2))));
|
CItemSheet *item = dynamic_cast<CItemSheet *>(SheetMngr.get(CSheetId((uint32) ls.toInteger(2))));
|
||||||
if (!item || item->Family != ITEMFAMILY::SCROLL_R2)
|
if (!item || item->Family != ITEMFAMILY::SCROLL_R2)
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "%s : bad sheet, r2 plot item required", funcName);
|
CLuaIHM::fails(ls, "%s : bad sheet, r2 plot item required", funcName);
|
||||||
}
|
}
|
||||||
R2::TMissionItem mi;
|
R2::TMissionItem mi;
|
||||||
mi.SheetId = (uint32) ls.toNumber(2);
|
mi.SheetId = (uint32) ls.toInteger(2);
|
||||||
CLuaIHM::getUCStringOnStack(ls, 3, mi.Name);
|
CLuaIHM::getUCStringOnStack(ls, 3, mi.Name);
|
||||||
CLuaIHM::getUCStringOnStack(ls, 4, mi.Description);
|
CLuaIHM::getUCStringOnStack(ls, 4, mi.Description);
|
||||||
CLuaIHM::getUCStringOnStack(ls, 5, mi.Comment);
|
CLuaIHM::getUCStringOnStack(ls, 5, mi.Comment);
|
||||||
|
@ -1383,7 +1383,7 @@ int CEditor::luaKickCharacter(CLuaState &ls)
|
||||||
|
|
||||||
CSessionBrowserImpl &sb = CSessionBrowserImpl::getInstance();
|
CSessionBrowserImpl &sb = CSessionBrowserImpl::getInstance();
|
||||||
sb.kickCharacter(sb.getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(),
|
sb.kickCharacter(sb.getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(),
|
||||||
(uint32)ls.toNumber(2));
|
(uint32)ls.toInteger(2));
|
||||||
|
|
||||||
if(!sb.waitOneMessage(sb.getMessageName("on_invokeResult")))
|
if(!sb.waitOneMessage(sb.getMessageName("on_invokeResult")))
|
||||||
nlwarning("kickCharacter callback return false");
|
nlwarning("kickCharacter callback return false");
|
||||||
|
@ -1401,7 +1401,7 @@ int CEditor::luaUnkickCharacter(CLuaState &ls)
|
||||||
|
|
||||||
CSessionBrowserImpl &sb = CSessionBrowserImpl::getInstance();
|
CSessionBrowserImpl &sb = CSessionBrowserImpl::getInstance();
|
||||||
sb.unkickCharacter(sb.getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(),
|
sb.unkickCharacter(sb.getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(),
|
||||||
(uint32)ls.toNumber(2));
|
(uint32)ls.toInteger(2));
|
||||||
|
|
||||||
if(!sb.waitOneMessage(sb.getMessageName("on_invokeResult")))
|
if(!sb.waitOneMessage(sb.getMessageName("on_invokeResult")))
|
||||||
nlwarning("unkickCharacter callback return false");
|
nlwarning("unkickCharacter callback return false");
|
||||||
|
@ -1419,7 +1419,7 @@ int CEditor::luaTeleportToCharacter(CLuaState &ls)
|
||||||
|
|
||||||
CClientEditionModule & cem = R2::getEditor().getDMC().getEditionModule();
|
CClientEditionModule & cem = R2::getEditor().getDMC().getEditionModule();
|
||||||
cem.requestTeleportOneCharacterToAnother(cem.getCurrentAdventureId(), CSessionBrowserImpl::getInstance().getCharId(),
|
cem.requestTeleportOneCharacterToAnother(cem.getCurrentAdventureId(), CSessionBrowserImpl::getInstance().getCharId(),
|
||||||
(uint32)ls.toNumber(2));
|
(uint32)ls.toInteger(2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1954,17 +1954,17 @@ int CEditor::luaRemoveInstanceObserver(CLuaState &ls)
|
||||||
const char *funcName = "removeInstanceObserver";
|
const char *funcName = "removeInstanceObserver";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 2); // this is a method (self + 1 params)
|
CLuaIHM::checkArgCount(ls, funcName, 2); // this is a method (self + 1 params)
|
||||||
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); // instance id
|
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); // instance id
|
||||||
IInstanceObserver *observer = getEditor().getInstanceObserver((TInstanceObserverHandle) ls.toNumber(2));
|
IInstanceObserver *observer = getEditor().getInstanceObserver((TInstanceObserverHandle) ls.toInteger(2));
|
||||||
if (observer == NULL)
|
if (observer == NULL)
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "Instance observer not found for handle = %d", (int) ls.toNumber(2));
|
CLuaIHM::fails(ls, "Instance observer not found for handle = %d"NL_I64, ls.toInteger(2));
|
||||||
}
|
}
|
||||||
CInstanceObserverLua *luaObserver = dynamic_cast<CInstanceObserverLua *>(observer);
|
CInstanceObserverLua *luaObserver = dynamic_cast<CInstanceObserverLua *>(observer);
|
||||||
if (luaObserver == NULL)
|
if (luaObserver == NULL)
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "Instance observer found for handle %d, but has bad type, it wasn't registered from lua.", (int) ls.toNumber(2));
|
CLuaIHM::fails(ls, "Instance observer found for handle %d"NL_I64", but has bad type, it wasn't registered from lua.", ls.toInteger(2));
|
||||||
}
|
}
|
||||||
getEditor().removeInstanceObserver((TInstanceObserverHandle) ls.toNumber(2));
|
getEditor().removeInstanceObserver((TInstanceObserverHandle) ls.toInteger(2));
|
||||||
CLuaObject receiver = luaObserver->getReceiver();
|
CLuaObject receiver = luaObserver->getReceiver();
|
||||||
delete luaObserver;
|
delete luaObserver;
|
||||||
receiver.push();
|
receiver.push();
|
||||||
|
@ -3221,10 +3221,10 @@ void CEditor::initObjectProjectionMetatable()
|
||||||
throw ELuaWrappedFunctionException(&ls, "Attempt to access an erased object");
|
throw ELuaWrappedFunctionException(&ls, "Attempt to access an erased object");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ls.isNumber(2))
|
if (ls.isInteger(2))
|
||||||
{
|
{
|
||||||
// index is a number
|
// index is an integer
|
||||||
const CObject *other = obj->getValue((uint32) ls.toNumber(2));
|
const CObject *other = obj->getValue((uint32) ls.toInteger(2));
|
||||||
if (other)
|
if (other)
|
||||||
{
|
{
|
||||||
pushValue(ls, other);
|
pushValue(ls, other);
|
||||||
|
@ -3481,6 +3481,10 @@ void CEditor::initObjectProjectionMetatable()
|
||||||
{
|
{
|
||||||
ls.push(obj->toString());
|
ls.push(obj->toString());
|
||||||
}
|
}
|
||||||
|
else if (obj->isInteger())
|
||||||
|
{
|
||||||
|
ls.push(obj->toInteger());
|
||||||
|
}
|
||||||
else if (obj->isNumber())
|
else if (obj->isNumber())
|
||||||
{
|
{
|
||||||
ls.push(obj->toNumber());
|
ls.push(obj->toNumber());
|
||||||
|
@ -3574,9 +3578,9 @@ void CEditor::initObjectProjectionMetatable()
|
||||||
// continuation of traversal
|
// continuation of traversal
|
||||||
// -> retrieve index from the key
|
// -> retrieve index from the key
|
||||||
sint32 index;
|
sint32 index;
|
||||||
if (ls.isNumber(2))
|
if (ls.isInteger(2))
|
||||||
{
|
{
|
||||||
index = (uint32) ls.toNumber(2);
|
index = (uint32) ls.toInteger(2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5384,12 +5388,12 @@ sint CEditor::getLeftQuota()
|
||||||
CLuaState &ls = getLua();
|
CLuaState &ls = getLua();
|
||||||
CLuaStackChecker lsc(&ls);
|
CLuaStackChecker lsc(&ls);
|
||||||
callEnvMethod("getLeftQuota", 0, 1);
|
callEnvMethod("getLeftQuota", 0, 1);
|
||||||
if (!ls.isNumber(-1))
|
if (!ls.isInteger(-1))
|
||||||
{
|
{
|
||||||
ls.pop(1);
|
ls.pop(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sint result = (sint) ls.toNumber(-1);
|
sint result = (sint) ls.toInteger(-1);
|
||||||
ls.pop(1);
|
ls.pop(1);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -5419,7 +5423,7 @@ bool CEditor::verifyRoomLeft(uint aiCost, uint staticCost)
|
||||||
if (aiCost)
|
if (aiCost)
|
||||||
{
|
{
|
||||||
CLuaStackChecker lsc(&ls);
|
CLuaStackChecker lsc(&ls);
|
||||||
getEditor().getLua().push((lua_Number)aiCost);
|
getEditor().getLua().push((lua_Integer)aiCost);
|
||||||
callEnvMethod("checkAiQuota", 1, 1);
|
callEnvMethod("checkAiQuota", 1, 1);
|
||||||
if (!ls.isBoolean(-1))
|
if (!ls.isBoolean(-1))
|
||||||
{
|
{
|
||||||
|
@ -5433,7 +5437,7 @@ bool CEditor::verifyRoomLeft(uint aiCost, uint staticCost)
|
||||||
if (staticCost)
|
if (staticCost)
|
||||||
{
|
{
|
||||||
CLuaStackChecker lsc(&ls);
|
CLuaStackChecker lsc(&ls);
|
||||||
getEditor().getLua().push((lua_Number)staticCost);
|
getEditor().getLua().push((lua_Integer)staticCost);
|
||||||
callEnvMethod("checkStaticQuota", 1, 1);
|
callEnvMethod("checkStaticQuota", 1, 1);
|
||||||
if (!ls.isBoolean(-1))
|
if (!ls.isBoolean(-1))
|
||||||
{
|
{
|
||||||
|
@ -5781,7 +5785,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct
|
||||||
// teleport in good island
|
// teleport in good island
|
||||||
if (ClientCfg.Local)
|
if (ClientCfg.Local)
|
||||||
{
|
{
|
||||||
sint locationId = (uint) _ScenarioInstance->getLuaProjection()["Description"]["LocationId"].toNumber();
|
sint locationId = (uint) _ScenarioInstance->getLuaProjection()["Description"]["LocationId"].toInteger();
|
||||||
|
|
||||||
CScenarioEntryPoints &sep = CScenarioEntryPoints::getInstance();
|
CScenarioEntryPoints &sep = CScenarioEntryPoints::getInstance();
|
||||||
_IslandCollision.loadEntryPoints();
|
_IslandCollision.loadEntryPoints();
|
||||||
|
@ -6647,10 +6651,16 @@ std::string getString(const CObject *obj, const std::string &attrName)
|
||||||
double getNumber(const CObject *obj, const std::string &attrName)
|
double getNumber(const CObject *obj, const std::string &attrName)
|
||||||
{
|
{
|
||||||
obj = getObject(obj, attrName);
|
obj = getObject(obj, attrName);
|
||||||
if (!obj) return 0;
|
if (!obj) return 0.0;
|
||||||
return obj->isNumber() ? obj->toNumber() : 0;
|
return obj->isNumber() ? obj->toNumber() : 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sint64 getInteger(const CObject *obj, const std::string &attrName)
|
||||||
|
{
|
||||||
|
obj = getObject(obj, attrName);
|
||||||
|
if (!obj) return 0;
|
||||||
|
return obj->isInteger() ? obj->toInteger() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool isEditionCurrent()
|
bool isEditionCurrent()
|
||||||
{
|
{
|
||||||
|
@ -6703,7 +6713,7 @@ bool CEditor::getVisualPropertiesFromObject(CObject* object, SPropVisualA& vA, S
|
||||||
|
|
||||||
//-------------------------random init npc visual properties
|
//-------------------------random init npc visual properties
|
||||||
|
|
||||||
std::map< std::string, double > visualProps;
|
std::map< std::string, sint64 > visualProps;
|
||||||
|
|
||||||
|
|
||||||
static const char* keys[] = { "GabaritHeight", "GabaritTorsoWidth", "GabaritArmsWidth", "GabaritLegsWidth", "GabaritBreastSize"
|
static const char* keys[] = { "GabaritHeight", "GabaritTorsoWidth", "GabaritArmsWidth", "GabaritLegsWidth", "GabaritBreastSize"
|
||||||
|
@ -6719,7 +6729,7 @@ bool CEditor::getVisualPropertiesFromObject(CObject* object, SPropVisualA& vA, S
|
||||||
unsigned int last = sizeof(keys) / sizeof(keys[0]);
|
unsigned int last = sizeof(keys) / sizeof(keys[0]);
|
||||||
for (; first != last; ++first)
|
for (; first != last; ++first)
|
||||||
{
|
{
|
||||||
visualProps[keys[first]] = getNumber(object, keys[first]);
|
visualProps[keys[first]] = getInteger(object, keys[first]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//vA.PropertySubData.Sex = (uint) visualProps["Sex"];
|
//vA.PropertySubData.Sex = (uint) visualProps["Sex"];
|
||||||
|
@ -7054,10 +7064,10 @@ class CAHCreateEntity : public IActionHandler
|
||||||
if (getEditor().getEnv().callMethodByNameNoThrow("randomNPCProperties", 2, 1))
|
if (getEditor().getEnv().callMethodByNameNoThrow("randomNPCProperties", 2, 1))
|
||||||
{
|
{
|
||||||
CLuaObject result(getEditor().getLua());
|
CLuaObject result(getEditor().getLua());
|
||||||
std::map< std::string, double > visualProps;
|
std::map< std::string, sint64 > visualProps;
|
||||||
ENUM_LUA_TABLE(result, it)
|
ENUM_LUA_TABLE(result, it)
|
||||||
{
|
{
|
||||||
visualProps[it.nextKey().toString()] = it.nextValue().toNumber();
|
visualProps[it.nextKey().toString()] = it.nextValue().toInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
// visual property A depends on the type of the entity
|
// visual property A depends on the type of the entity
|
||||||
|
|
|
@ -650,9 +650,9 @@ sint CInstance::getSelectedSequence() const
|
||||||
//H_AUTO(R2_CInstance_getSelectedSequence)
|
//H_AUTO(R2_CInstance_getSelectedSequence)
|
||||||
CLuaObject selected = const_cast<CInstance *>(this)->getLuaProjection()["User"]["SelectedSequence"];
|
CLuaObject selected = const_cast<CInstance *>(this)->getLuaProjection()["User"]["SelectedSequence"];
|
||||||
sint index = 0;
|
sint index = 0;
|
||||||
if (selected.isNumber())
|
if (selected.isInteger())
|
||||||
{
|
{
|
||||||
index = (sint) selected.toNumber();
|
index = (sint) selected.toInteger();
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void readFromLua(const CLuaObject &table, const char *key, float &dest)
|
||||||
}
|
}
|
||||||
void readFromLua(const CLuaObject &table, const char *key, uint &dest)
|
void readFromLua(const CLuaObject &table, const char *key, uint &dest)
|
||||||
{
|
{
|
||||||
if (table[key].isNumber()) dest = (uint) table[key].toNumber();
|
if (table[key].isInteger()) dest = (uint) table[key].toInteger();
|
||||||
}
|
}
|
||||||
void readFromLua(const CLuaObject &table, const char *key, std::string &dest)
|
void readFromLua(const CLuaObject &table, const char *key, std::string &dest)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,17 +66,17 @@ bool CToolSelectMove::checkAdditionnalRoomLeftFor(CInstance &instance)
|
||||||
CLuaStackRestorer lsr(&ls, 0);
|
CLuaStackRestorer lsr(&ls, 0);
|
||||||
// check ai & static cost : if they are too big, can't create the duplicate
|
// check ai & static cost : if they are too big, can't create the duplicate
|
||||||
if (!luaProj.callMethodByNameNoThrow("getAiCost", 0, 1)
|
if (!luaProj.callMethodByNameNoThrow("getAiCost", 0, 1)
|
||||||
|| !ls.isNumber(-1))
|
|| !ls.isInteger(-1))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint aiCost = (uint) ls.toNumber(-1);
|
uint aiCost = (uint) ls.toInteger(-1);
|
||||||
ls.pop();
|
ls.pop();
|
||||||
if (!luaProj.callMethodByNameNoThrow("getStaticObjectCost", 0, 1))
|
if (!luaProj.callMethodByNameNoThrow("getStaticObjectCost", 0, 1))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint staticCost = (uint) ls.toNumber(-1);
|
uint staticCost = (uint) ls.toInteger(-1);
|
||||||
ls.pop();
|
ls.pop();
|
||||||
if (!getEditor().verifyRoomLeft(aiCost, staticCost))
|
if (!getEditor().verifyRoomLeft(aiCost, staticCost))
|
||||||
{
|
{
|
||||||
|
|
|
@ -659,7 +659,7 @@ void release()
|
||||||
CInterfaceExpr::release();
|
CInterfaceExpr::release();
|
||||||
CPdrTokenRegistry::releaseInstance();
|
CPdrTokenRegistry::releaseInstance();
|
||||||
NLNET::IModuleManager::releaseInstance();
|
NLNET::IModuleManager::releaseInstance();
|
||||||
delete &CLuaManager::getInstance();
|
CLuaManager::releaseInstance();
|
||||||
NLGUI::CDBManager::release();
|
NLGUI::CDBManager::release();
|
||||||
CWidgetManager::release();
|
CWidgetManager::release();
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ int CSessionBrowserImpl::luaUpdateScenarioScores(CLuaState &ls)
|
||||||
if (R2::getEditor().getMode() != R2::CEditor::NotInitialized)
|
if (R2::getEditor().getMode() != R2::CEditor::NotInitialized)
|
||||||
{
|
{
|
||||||
CSessionBrowserImpl::getInstance().setPlayerRating(getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(),
|
CSessionBrowserImpl::getInstance().setPlayerRating(getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(),
|
||||||
(uint32) ls.toNumber(1), (uint32) ls.toNumber(2), (uint32) ls.toNumber(3), (uint32) ls.toNumber(4), (uint32) ls.toNumber(5));
|
(uint32) ls.toInteger(1), (uint32) ls.toInteger(2), (uint32) ls.toInteger(3), (uint32) ls.toInteger(4), (uint32) ls.toInteger(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -210,7 +210,7 @@ int CSessionBrowserImpl::luaJoinRingSession(CLuaState &ls)
|
||||||
|
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||||
CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance();
|
CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance();
|
||||||
sessionBrowser.joinSession(getCharId(), (TSessionId)(uint32) ls.toNumber(1), ClientCfg.ConfigFile.getVar("Application").asString(0));
|
sessionBrowser.joinSession(getCharId(), (TSessionId)(uint32) ls.toInteger(1), ClientCfg.ConfigFile.getVar("Application").asString(0));
|
||||||
|
|
||||||
if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_joinSessionResult")))
|
if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_joinSessionResult")))
|
||||||
{
|
{
|
||||||
|
|
|
@ -281,7 +281,7 @@ CBitmap *buildSharedBitmap(const std::string &filename,
|
||||||
{
|
{
|
||||||
alreadyBuilt = false;
|
alreadyBuilt = false;
|
||||||
if (filename.empty()) return NULL;
|
if (filename.empty()) return NULL;
|
||||||
std::string lcBMFilename = strlwr(CFile::getFilenameWithoutExtension(filename));
|
std::string lcBMFilename = toLower(CFile::getFilenameWithoutExtension(filename));
|
||||||
std::map<std::string, CBitmap *>::iterator it = bitmapByName.find(lcBMFilename);
|
std::map<std::string, CBitmap *>::iterator it = bitmapByName.find(lcBMFilename);
|
||||||
if (it != bitmapByName.end())
|
if (it != bitmapByName.end())
|
||||||
{
|
{
|
||||||
|
|
|
@ -291,10 +291,8 @@ bool CStreamableIG::setIG(uint ig, const std::string &name, const std::string &p
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load this IG
|
// Load this IG
|
||||||
_IGs[ig].Name = NLMISC::CFile::getFilenameWithoutExtension(name);
|
_IGs[ig].Name = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(name));
|
||||||
_IGs[ig].ParentName = NLMISC::CFile::getFilenameWithoutExtension(parentName);
|
_IGs[ig].ParentName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(parentName));
|
||||||
NLMISC::strlwr(_IGs[ig].Name);
|
|
||||||
NLMISC::strlwr(_IGs[ig].ParentName);
|
|
||||||
_IGs[ig].IG = NULL;
|
_IGs[ig].IG = NULL;
|
||||||
_IGs[ig].Loading = false;
|
_IGs[ig].Loading = false;
|
||||||
_Linked = false;
|
_Linked = false;
|
||||||
|
@ -308,10 +306,8 @@ void CStreamableIG::addIG(const std::string &name,const std::string &parentName,
|
||||||
{
|
{
|
||||||
H_AUTO_USE(RZ_StremableIG)
|
H_AUTO_USE(RZ_StremableIG)
|
||||||
_IGs.push_back(CIGNode ());
|
_IGs.push_back(CIGNode ());
|
||||||
_IGs.back().Name = NLMISC::CFile::getFilenameWithoutExtension(name);
|
_IGs.back().Name = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(name));
|
||||||
_IGs.back().ParentName = NLMISC::CFile::getFilenameWithoutExtension(parentName);
|
_IGs.back().ParentName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(parentName));
|
||||||
NLMISC::strlwr(_IGs.back().Name);
|
|
||||||
NLMISC::strlwr(_IGs.back().ParentName);
|
|
||||||
_IGs.back().IG = NULL;
|
_IGs.back().IG = NULL;
|
||||||
_IGs.back().Loading = false;
|
_IGs.back().Loading = false;
|
||||||
_IGs.back().Pos = pos;
|
_IGs.back().Pos = pos;
|
||||||
|
@ -376,7 +372,7 @@ void CStreamableIG::addLoadedIGToMap()
|
||||||
if (_IGs[k].IG && _IGs[k].IG != (NL3D::UInstanceGroup *)-1) // is this a successfully loaded ig ?
|
if (_IGs[k].IG && _IGs[k].IG != (NL3D::UInstanceGroup *)-1) // is this a successfully loaded ig ?
|
||||||
{
|
{
|
||||||
// insert the new ig if it hasn't before..
|
// insert the new ig if it hasn't before..
|
||||||
if( _IGMap->insert(std::make_pair(NLMISC::strlwr(_IGs[k].Name), _IGs[k].IG)).second )
|
if( _IGMap->insert(std::make_pair(NLMISC::toLower(_IGs[k].Name), _IGs[k].IG)).second )
|
||||||
// if inserted, must notify IG Added, else already notifiyed by loadAsync()
|
// if inserted, must notify IG Added, else already notifiyed by loadAsync()
|
||||||
this->notifyIGAdded(_IGs[k].IG);
|
this->notifyIGAdded(_IGs[k].IG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1413,8 +1413,7 @@ const ucchar * CStringManagerClient::getSpecialWord(const std::string &label, bo
|
||||||
|
|
||||||
// avoid case problems
|
// avoid case problems
|
||||||
static std::string lwrLabel;
|
static std::string lwrLabel;
|
||||||
lwrLabel = label;
|
lwrLabel = toLower(label);
|
||||||
strlwr(lwrLabel);
|
|
||||||
|
|
||||||
if (_SpecItem_MemoryCompressed)
|
if (_SpecItem_MemoryCompressed)
|
||||||
{
|
{
|
||||||
|
@ -1464,8 +1463,7 @@ const ucchar * CStringManagerClient::getSpecialDesc(const std::string &label)
|
||||||
|
|
||||||
// avoid case problems
|
// avoid case problems
|
||||||
static std::string lwrLabel;
|
static std::string lwrLabel;
|
||||||
lwrLabel= label;
|
lwrLabel = toLower(label);
|
||||||
strlwr(lwrLabel);
|
|
||||||
|
|
||||||
if (_SpecItem_MemoryCompressed)
|
if (_SpecItem_MemoryCompressed)
|
||||||
{
|
{
|
||||||
|
@ -1498,8 +1496,7 @@ const ucchar * CStringManagerClient::getSpecialDesc2(const std::string &label)
|
||||||
|
|
||||||
// avoid case problems
|
// avoid case problems
|
||||||
static std::string lwrLabel;
|
static std::string lwrLabel;
|
||||||
lwrLabel= label;
|
lwrLabel = toLower(label);
|
||||||
strlwr(lwrLabel);
|
|
||||||
|
|
||||||
if (_SpecItem_MemoryCompressed)
|
if (_SpecItem_MemoryCompressed)
|
||||||
{
|
{
|
||||||
|
@ -1703,8 +1700,7 @@ void CStringManagerClient::replaceSBrickName(NLMISC::CSheetId id, const ucstring
|
||||||
|
|
||||||
// avoid case problems
|
// avoid case problems
|
||||||
static std::string lwrLabel;
|
static std::string lwrLabel;
|
||||||
lwrLabel= label;
|
lwrLabel = toLower(label);
|
||||||
strlwr(lwrLabel);
|
|
||||||
|
|
||||||
if (_SpecItem_MemoryCompressed)
|
if (_SpecItem_MemoryCompressed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -359,8 +359,7 @@ void CStaticFames::loadStaticFame( const string& filename )
|
||||||
// 1st, build the index table
|
// 1st, build the index table
|
||||||
for (uint i=1; i<ws.size(); ++i)
|
for (uint i=1; i<ws.size(); ++i)
|
||||||
{
|
{
|
||||||
string name = ws.getData(i, 0).toString();
|
string name = toLower(ws.getData(i, 0).toString());
|
||||||
name = strlwr(name);
|
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
break;
|
break;
|
||||||
_FactionNameIndex.insert(make_pair(CStringMapper::map(name), i-1));
|
_FactionNameIndex.insert(make_pair(CStringMapper::map(name), i-1));
|
||||||
|
@ -376,8 +375,7 @@ void CStaticFames::loadStaticFame( const string& filename )
|
||||||
// 2nd check the table structure
|
// 2nd check the table structure
|
||||||
for (uint i=2; i<ws.ColCount; ++i)
|
for (uint i=2; i<ws.ColCount; ++i)
|
||||||
{
|
{
|
||||||
string name = ws.getData(0, i).toString();
|
string name = toLower(ws.getData(0, i).toString());
|
||||||
name = strlwr(name);
|
|
||||||
|
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
{
|
{
|
||||||
|
@ -608,8 +606,7 @@ uint CStaticFames::getFactionIndex(NLMISC::TStringId factionName)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
uint CStaticFames::getFactionIndex(const std::string &factionName)
|
uint CStaticFames::getFactionIndex(const std::string &factionName)
|
||||||
{
|
{
|
||||||
string n = strlwr(factionName);
|
return getFactionIndex(CStringMapper::map(toLower(factionName)));
|
||||||
return getFactionIndex(CStringMapper::map(n));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -667,11 +664,7 @@ sint32 CStaticFames::getStaticFame(NLMISC::TStringId faction1, NLMISC::TStringId
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
sint32 CStaticFames::getStaticFame(const std::string &faction1, const std::string &faction2)
|
sint32 CStaticFames::getStaticFame(const std::string &faction1, const std::string &faction2)
|
||||||
{
|
{
|
||||||
string n1, n2;
|
return getStaticFame(CStringMapper::map(toLower(faction1)), CStringMapper::map(toLower(faction2)));
|
||||||
n1 = strlwr(faction1);
|
|
||||||
n2 = strlwr(faction2);
|
|
||||||
|
|
||||||
return getStaticFame(CStringMapper::map(n1), CStringMapper::map(n2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -168,6 +168,12 @@ void CObject::inPlaceCopy(const CObjectNumber &src)
|
||||||
copyMismatchMsg(src);
|
copyMismatchMsg(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CObject::inPlaceCopy(const CObjectInteger &src)
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObject_inPlaceCopy)
|
||||||
|
copyMismatchMsg(src);
|
||||||
|
}
|
||||||
|
|
||||||
void CObject::inPlaceCopy(const CObjectTable &src)
|
void CObject::inPlaceCopy(const CObjectTable &src)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CObject_inPlaceCopy)
|
//H_AUTO(R2_CObject_inPlaceCopy)
|
||||||
|
@ -189,6 +195,18 @@ bool CObject::isNumber(const std::string & prop) const
|
||||||
return doIsNumber();
|
return doIsNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CObject::isInteger(const std::string & prop) const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObject_isInteger)
|
||||||
|
if (!prop.empty())
|
||||||
|
{
|
||||||
|
CObject* attr = getAttr(prop);
|
||||||
|
if (!attr) return false;
|
||||||
|
return attr->doIsInteger();
|
||||||
|
}
|
||||||
|
return doIsInteger();
|
||||||
|
}
|
||||||
|
|
||||||
bool CObject::isString(const std::string & prop) const
|
bool CObject::isString(const std::string & prop) const
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CObject_isString)
|
//H_AUTO(R2_CObject_isString)
|
||||||
|
@ -239,6 +257,12 @@ bool CObject::doIsNumber() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CObject::doIsInteger() const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObject_doIsInteger)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CObject::doIsString() const
|
bool CObject::doIsString() const
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CObject_doIsString)
|
//H_AUTO(R2_CObject_doIsString)
|
||||||
|
@ -272,6 +296,20 @@ double CObject::toNumber(const std::string & prop) const
|
||||||
return doToNumber();
|
return doToNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sint64 CObject::toInteger(const std::string & prop) const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObject_toInteger)
|
||||||
|
if (!prop.empty())
|
||||||
|
{
|
||||||
|
CObject* attr = getAttr(prop);
|
||||||
|
if (!attr)
|
||||||
|
{
|
||||||
|
BOMB("Try to use the method toInteger() on a NULL Object", return 0);
|
||||||
|
}
|
||||||
|
return attr->doToInteger();
|
||||||
|
}
|
||||||
|
return doToInteger();
|
||||||
|
}
|
||||||
|
|
||||||
std::string CObject::toString(const std::string & prop) const
|
std::string CObject::toString(const std::string & prop) const
|
||||||
{
|
{
|
||||||
|
@ -328,6 +366,14 @@ double CObject::doToNumber() const
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sint64 CObject::doToInteger() const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObject_doToInteger)
|
||||||
|
BOMB("Try to convert an objet to integer without being allowed", return 0);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
std::string CObject::doToString() const
|
std::string CObject::doToString() const
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CObject_doToString)
|
//H_AUTO(R2_CObject_doToString)
|
||||||
|
@ -366,11 +412,18 @@ bool CObject::set(const std::string& /* key */, const std::string & /* value */)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CObject::set(const std::string& /* key */, double /* value */){
|
bool CObject::set(const std::string& /* key */, double /* value */)
|
||||||
|
{
|
||||||
BOMB("Try to set the value of an object with a double on an object that does not allowed it", return false);
|
BOMB("Try to set the value of an object with a double on an object that does not allowed it", return false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CObject::set(const std::string& /* key */, sint64 /* value */)
|
||||||
|
{
|
||||||
|
BOMB("Try to set the value of an object with an integer on an object that does not allowed it", return false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CObject::setObject(const std::string& /* key */, CObject* /* value */)
|
bool CObject::setObject(const std::string& /* key */, CObject* /* value */)
|
||||||
{
|
{
|
||||||
BOMB("Try to set the value of an object with an object that does not allowed it", return false);
|
BOMB("Try to set the value of an object with an object that does not allowed it", return false);
|
||||||
|
@ -602,7 +655,7 @@ bool CObjectString::set(const std::string& key, const std::string & value)
|
||||||
bool CObjectString::setObject(const std::string& key, CObject* value)
|
bool CObjectString::setObject(const std::string& key, CObject* value)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CObjectString_setObject)
|
//H_AUTO(R2_CObjectString_setObject)
|
||||||
BOMB_IF( !key.empty() || ! (value->isString() || value->isNumber()) , "Try to set the a sub value of an object that does not allowed it", return false);
|
BOMB_IF( !key.empty() || ! (value->isString() || value->isNumber() || value->isInteger()) , "Try to set the a sub value of an object that does not allowed it", return false);
|
||||||
bool canSet = set(key, value->toString());
|
bool canSet = set(key, value->toString());
|
||||||
if (canSet)
|
if (canSet)
|
||||||
{
|
{
|
||||||
|
@ -732,7 +785,7 @@ void CObjectNumber::inPlaceCopy(const CObjectNumber &src)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string CObjectNumber::doToString() const { return NLMISC::toString("%d", _Value);}
|
std::string CObjectNumber::doToString() const { return NLMISC::toString("%lf", _Value);}
|
||||||
|
|
||||||
void CObjectNumber::doSerialize(std::string& out, CSerializeContext& /* context */) const
|
void CObjectNumber::doSerialize(std::string& out, CSerializeContext& /* context */) const
|
||||||
{
|
{
|
||||||
|
@ -767,9 +820,6 @@ bool CObjectNumber::set(const std::string& key, const std::string & value)
|
||||||
//H_AUTO(R2_CObjectNumber_set)
|
//H_AUTO(R2_CObjectNumber_set)
|
||||||
//XXX
|
//XXX
|
||||||
BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false);
|
BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false);
|
||||||
// std::stringstream ss ;
|
|
||||||
// ss << value;
|
|
||||||
// ss >> _Value;
|
|
||||||
NLMISC::fromString(value, _Value);
|
NLMISC::fromString(value, _Value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -808,12 +858,108 @@ bool CObjectNumber::equal(const CObject* other) const
|
||||||
double otherValue = other->toNumber();
|
double otherValue = other->toNumber();
|
||||||
if (_Value == otherValue ) return true;
|
if (_Value == otherValue ) return true;
|
||||||
/*
|
/*
|
||||||
fabs + epsilon trick
|
TODO: fabs + epsilon trick
|
||||||
*/
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------- CObjectInteger ----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
CObjectInteger::CObjectInteger(sint64 value) : CObject(), _Value(value){}
|
||||||
|
|
||||||
|
const char *CObjectInteger::getTypeAsString() const
|
||||||
|
{
|
||||||
|
return "Integer";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObjectInteger::visitInternal(IObjectVisitor &visitor)
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_visit)
|
||||||
|
visitor.visit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CObjectInteger::inPlaceCopyTo(CObject &dest) const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_inPlaceCopyTo)
|
||||||
|
dest.inPlaceCopy(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObjectInteger::inPlaceCopy(const CObjectInteger &src)
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_inPlaceCopy)
|
||||||
|
_Value = src._Value;
|
||||||
|
setGhost(src.getGhost());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string CObjectInteger::doToString() const { return NLMISC::toString("%d"NL_I64, _Value); }
|
||||||
|
|
||||||
|
void CObjectInteger::doSerialize(std::string& out, CSerializeContext& /* context */) const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_doSerialize)
|
||||||
|
nlassert(!getGhost());
|
||||||
|
out += NLMISC::toString(_Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CObjectInteger::set(const std::string& key, sint64 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_set)
|
||||||
|
|
||||||
|
BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false);
|
||||||
|
|
||||||
|
_Value = value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CObjectInteger::set(const std::string& key, const std::string & value)
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_set)
|
||||||
|
//XXX
|
||||||
|
BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false);
|
||||||
|
NLMISC::fromString(value, _Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sint64 CObjectInteger::doToInteger() const { return _Value; }
|
||||||
|
|
||||||
|
CObject* CObjectInteger::clone() const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_clone)
|
||||||
|
CObjectInteger *result = new CObjectInteger(_Value);
|
||||||
|
result->setGhost(getGhost());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CObjectInteger::doIsInteger() const { return true;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool CObjectInteger::setObject(const std::string& /* key */, CObject* value)
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_setObject)
|
||||||
|
BOMB_IF(!value->isInteger(), NLMISC::toString("Try to set an element of a type '%s' with a value of type '%s' on an object that is not an integer", this->getTypeAsString(), value->getTypeAsString()), return false);
|
||||||
|
|
||||||
|
_Value = value->toInteger();
|
||||||
|
setGhost(value->getGhost());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool CObjectInteger::equal(const CObject* other) const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_equal)
|
||||||
|
if (!other || !other->isInteger()) return false;
|
||||||
|
sint64 otherValue = other->toInteger();
|
||||||
|
return _Value == otherValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------- CObjectTable ----------------------------------------
|
//----------------------- CObjectTable ----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -1756,7 +1902,7 @@ CObject* CObjectGenerator::instanciate(CObjectFactory* factory) const
|
||||||
{
|
{
|
||||||
CObject*defaultInBase = found->getAttr("DefaultInBase");
|
CObject*defaultInBase = found->getAttr("DefaultInBase");
|
||||||
|
|
||||||
if (!defaultInBase || (defaultInBase->isNumber() && defaultInBase->toNumber() != 1))
|
if (!defaultInBase || (defaultInBase->isInteger() && defaultInBase->toInteger() != 1))
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string type = found->toString("Type");
|
std::string type = found->toString("Type");
|
||||||
|
@ -1824,7 +1970,15 @@ void CObjectNumber::dump(const std::string prefix, uint depth) const
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CObjectNumber_dump)
|
//H_AUTO(R2_CObjectNumber_dump)
|
||||||
std::string result(depth * 4, ' ');
|
std::string result(depth * 4, ' ');
|
||||||
result += NLMISC::toString("%sNumber, ptr = 0x%p, value = %f, ghost = %s", prefix.c_str(), this, _Value, _Ghost ? "true" : "false");
|
result += NLMISC::toString("%sNumber, ptr = 0x%p, value = %lf, ghost = %s", prefix.c_str(), this, _Value, _Ghost ? "true" : "false");
|
||||||
|
nlwarning(result.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObjectInteger::dump(const std::string prefix, uint depth) const
|
||||||
|
{
|
||||||
|
//H_AUTO(R2_CObjectInteger_dump)
|
||||||
|
std::string result(depth * 4, ' ');
|
||||||
|
result += NLMISC::toString("%sInteger, ptr = 0x%p, value = %d"NL_I64", ghost = %s", prefix.c_str(), this, _Value, _Ghost ? "true" : "false");
|
||||||
nlwarning(result.c_str());
|
nlwarning(result.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2021,6 +2175,79 @@ static void writeNumber( NLMISC::IStream& stream, double theValue)
|
||||||
stream.serial(fValue);
|
stream.serial(fValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void writeInteger( NLMISC::IStream& stream, sint64 theValue)
|
||||||
|
{
|
||||||
|
sint64 value = theValue;
|
||||||
|
uint8 type;
|
||||||
|
|
||||||
|
// It's 0
|
||||||
|
if (value == 0)
|
||||||
|
{
|
||||||
|
type = ObjectNumberZero;
|
||||||
|
stream.serial(type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pos = value >= 0;
|
||||||
|
// positif
|
||||||
|
if (pos)
|
||||||
|
{
|
||||||
|
if (value <= uint8Max)
|
||||||
|
{
|
||||||
|
uint8 uint8value = static_cast<uint8>(value);
|
||||||
|
type = ObjectNumberUInt8;
|
||||||
|
stream.serial(type);
|
||||||
|
stream.serial( uint8value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value <= uint16Max)
|
||||||
|
{
|
||||||
|
uint16 uint16value = static_cast<uint16>(value);
|
||||||
|
type = ObjectNumberUInt16;
|
||||||
|
stream.serial(type);
|
||||||
|
stream.serial(uint16value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value <= uint32Max)
|
||||||
|
{
|
||||||
|
uint32 uint32value = static_cast<uint32>(value);
|
||||||
|
type = ObjectNumberUInt32;
|
||||||
|
stream.serial(type);
|
||||||
|
stream.serial(uint32value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//negatif
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( sint8Min <= value && value <= sint8Max)
|
||||||
|
{
|
||||||
|
sint8 sint8value = static_cast<sint8>(value);
|
||||||
|
type = ObjectNumberSInt8;
|
||||||
|
stream.serial(type);
|
||||||
|
stream.serial( sint8value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( sint16Min <= value && value <= sint16Max)
|
||||||
|
{
|
||||||
|
sint16 sint16value = static_cast<sint16>(value);
|
||||||
|
type = ObjectNumberSInt16;
|
||||||
|
stream.serial(type);
|
||||||
|
stream.serial( sint16value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default case
|
||||||
|
type = ObjectNumberSInt32;
|
||||||
|
sint32 fValue = (sint32)value;
|
||||||
|
stream.serial(type);
|
||||||
|
stream.serial(fValue);
|
||||||
|
}
|
||||||
|
|
||||||
static void serialStringInstanceId( NLMISC::IStream& stream, CObject*& data)
|
static void serialStringInstanceId( NLMISC::IStream& stream, CObject*& data)
|
||||||
{
|
{
|
||||||
if (!stream.isReading())
|
if (!stream.isReading())
|
||||||
|
@ -2940,6 +3167,13 @@ void CObjectSerializerImpl::serialImpl(NLMISC::IStream& stream, CObject*& data,
|
||||||
uint endLength = stream.getPos();
|
uint endLength = stream.getPos();
|
||||||
if (serializer->Log) { nldebug("R2NET: (%u) Null sent %u bytes", serializer->Level, endLength - initLength);}
|
if (serializer->Log) { nldebug("R2NET: (%u) Null sent %u bytes", serializer->Level, endLength - initLength);}
|
||||||
}
|
}
|
||||||
|
else if (data->isInteger())
|
||||||
|
{
|
||||||
|
uint initLength = stream.getPos();
|
||||||
|
writeInteger(stream, data->toInteger());
|
||||||
|
uint endLength = stream.getPos();
|
||||||
|
if (serializer->Log) { nldebug("R2NET: (%u) Integer sent %u bytes", serializer->Level, endLength - initLength); }
|
||||||
|
}
|
||||||
else if (data->isNumber())
|
else if (data->isNumber())
|
||||||
{
|
{
|
||||||
uint initLength = stream.getPos();
|
uint initLength = stream.getPos();
|
||||||
|
|
|
@ -38,6 +38,7 @@ class CObjectTable;
|
||||||
class CObjectString;
|
class CObjectString;
|
||||||
class CObjectRefId;
|
class CObjectRefId;
|
||||||
class CObjectNumber;
|
class CObjectNumber;
|
||||||
|
class CObjectInteger;
|
||||||
class CSerializeContext;
|
class CSerializeContext;
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ struct IObjectVisitor
|
||||||
virtual void visit(CObjectRefId &/* obj */) {}
|
virtual void visit(CObjectRefId &/* obj */) {}
|
||||||
virtual void visit(CObjectString &/* obj */) {}
|
virtual void visit(CObjectString &/* obj */) {}
|
||||||
virtual void visit(CObjectNumber &/* obj */) {}
|
virtual void visit(CObjectNumber &/* obj */) {}
|
||||||
|
virtual void visit(CObjectInteger &/* obj */) {}
|
||||||
virtual void visit(CObjectTable &/* obj */) {}
|
virtual void visit(CObjectTable &/* obj */) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -82,6 +84,8 @@ public:
|
||||||
// test type
|
// test type
|
||||||
bool isNumber(const std::string & prop="") const;
|
bool isNumber(const std::string & prop="") const;
|
||||||
|
|
||||||
|
bool isInteger(const std::string & prop="") const;
|
||||||
|
|
||||||
bool isString(const std::string & prop="") const;
|
bool isString(const std::string & prop="") const;
|
||||||
|
|
||||||
bool isTable(const std::string & prop="") const;
|
bool isTable(const std::string & prop="") const;
|
||||||
|
@ -93,6 +97,8 @@ public:
|
||||||
// to Value
|
// to Value
|
||||||
double toNumber(const std::string & prop="") const;
|
double toNumber(const std::string & prop="") const;
|
||||||
|
|
||||||
|
sint64 toInteger(const std::string & prop="") const;
|
||||||
|
|
||||||
std::string toString(const std::string & prop="") const;
|
std::string toString(const std::string & prop="") const;
|
||||||
|
|
||||||
CObjectTable* toTable(const std::string & prop="") const;
|
CObjectTable* toTable(const std::string & prop="") const;
|
||||||
|
@ -127,12 +133,16 @@ public:
|
||||||
|
|
||||||
void add(const std::string& key, double value);
|
void add(const std::string& key, double value);
|
||||||
|
|
||||||
|
void add(const std::string& key, sint64 value);
|
||||||
|
|
||||||
|
|
||||||
// set Value
|
// set Value
|
||||||
virtual bool set(const std::string& key, const std::string & value);
|
virtual bool set(const std::string& key, const std::string & value);
|
||||||
|
|
||||||
virtual bool set(const std::string& key, double value);
|
virtual bool set(const std::string& key, double value);
|
||||||
|
|
||||||
|
virtual bool set(const std::string& key, sint64 value);
|
||||||
|
|
||||||
virtual bool setObject(const std::string& key, CObject* value);
|
virtual bool setObject(const std::string& key, CObject* value);
|
||||||
|
|
||||||
CObject* getParent() const;
|
CObject* getParent() const;
|
||||||
|
@ -172,6 +182,8 @@ protected:
|
||||||
|
|
||||||
virtual bool doIsNumber() const;
|
virtual bool doIsNumber() const;
|
||||||
|
|
||||||
|
virtual bool doIsInteger() const;
|
||||||
|
|
||||||
virtual bool doIsString() const;
|
virtual bool doIsString() const;
|
||||||
|
|
||||||
virtual bool doIsTable() const;
|
virtual bool doIsTable() const;
|
||||||
|
@ -180,6 +192,8 @@ protected:
|
||||||
|
|
||||||
virtual double doToNumber() const;
|
virtual double doToNumber() const;
|
||||||
|
|
||||||
|
virtual sint64 doToInteger() const;
|
||||||
|
|
||||||
virtual std::string doToString() const;
|
virtual std::string doToString() const;
|
||||||
|
|
||||||
virtual CObjectTable* doToTable() const;
|
virtual CObjectTable* doToTable() const;
|
||||||
|
@ -192,6 +206,7 @@ public:
|
||||||
virtual void inPlaceCopyTo(CObject &dest) const = 0;
|
virtual void inPlaceCopyTo(CObject &dest) const = 0;
|
||||||
virtual void inPlaceCopy(const CObjectString &src);
|
virtual void inPlaceCopy(const CObjectString &src);
|
||||||
virtual void inPlaceCopy(const CObjectNumber &src);
|
virtual void inPlaceCopy(const CObjectNumber &src);
|
||||||
|
virtual void inPlaceCopy(const CObjectInteger &src);
|
||||||
virtual void inPlaceCopy(const CObjectTable &src);
|
virtual void inPlaceCopy(const CObjectTable &src);
|
||||||
protected:
|
protected:
|
||||||
void copyMismatchMsg(const CObject &src);
|
void copyMismatchMsg(const CObject &src);
|
||||||
|
@ -307,6 +322,45 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CObjectInteger : public CObject
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CObjectInteger(sint64 value);
|
||||||
|
|
||||||
|
virtual const char *getTypeAsString() const;
|
||||||
|
|
||||||
|
virtual bool set(const std::string& key, sint64 value);
|
||||||
|
virtual bool set(const std::string& key, const std::string &value);
|
||||||
|
|
||||||
|
virtual bool setObject(const std::string& key, CObject* value);
|
||||||
|
|
||||||
|
virtual CObject* clone() const;
|
||||||
|
|
||||||
|
sint64 getValue() const { return _Value; }
|
||||||
|
|
||||||
|
virtual void dump(const std::string prefix = "", uint depth = 0) const;
|
||||||
|
|
||||||
|
virtual bool equal(const CObject* other) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void doSerialize(std::string& out, CSerializeContext& context) const;
|
||||||
|
|
||||||
|
virtual bool doIsInteger() const;
|
||||||
|
|
||||||
|
virtual sint64 doToInteger() const;
|
||||||
|
|
||||||
|
virtual std::string doToString() const;
|
||||||
|
|
||||||
|
virtual void inPlaceCopyTo(CObject &dest) const;
|
||||||
|
virtual void inPlaceCopy(const CObjectInteger &src);
|
||||||
|
|
||||||
|
virtual void visitInternal(IObjectVisitor &visitor);
|
||||||
|
|
||||||
|
private:
|
||||||
|
sint64 _Value;
|
||||||
|
};
|
||||||
|
|
||||||
class CObjectTable: public CObject
|
class CObjectTable: public CObject
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -609,9 +609,9 @@ public:
|
||||||
void setAttributeAsBool(const std::string & attrName, const std::string& propName)
|
void setAttributeAsBool(const std::string & attrName, const std::string& propName)
|
||||||
{
|
{
|
||||||
CObject* attr = _Object->getAttr(attrName);
|
CObject* attr = _Object->getAttr(attrName);
|
||||||
if (attr && attr->isNumber())
|
if (attr && attr->isInteger())
|
||||||
{
|
{
|
||||||
sint value = static_cast<sint>(attr->toNumber());
|
sint value = static_cast<sint>(attr->toInteger());
|
||||||
_Primitive->addPropertyByName(propName.c_str(), new CPropertyString(value?"true":"false"));
|
_Primitive->addPropertyByName(propName.c_str(), new CPropertyString(value?"true":"false"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1093,7 +1093,7 @@ IPrimitive* CServerAnimationModule::getAction(CObject* action, const std::string
|
||||||
CObject* weight = action->getAttr("Weight");
|
CObject* weight = action->getAttr("Weight");
|
||||||
if(weight)
|
if(weight)
|
||||||
{
|
{
|
||||||
uint32 w = (int)weight->toNumber();
|
uint32 w = (int)weight->toInteger();
|
||||||
std::string weightStr = toString(w);
|
std::string weightStr = toString(w);
|
||||||
pAction->addPropertyByName("Weight", new CPropertyString(weightStr));
|
pAction->addPropertyByName("Weight", new CPropertyString(weightStr));
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1381,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
|
||||||
|
|
||||||
animSession->Acts[actId] = rtAct;
|
animSession->Acts[actId] = rtAct;
|
||||||
|
|
||||||
if ( act->isNumber("LocationId")
|
if ( act->isInteger("LocationId")
|
||||||
&& act->isString("Name")
|
&& act->isString("Name")
|
||||||
&& act->isString("ActDescription")
|
&& act->isString("ActDescription")
|
||||||
&& act->isString("PreActDescription")
|
&& act->isString("PreActDescription")
|
||||||
|
@ -1390,7 +1390,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
|
||||||
rtAct->Name = act->toString("Name");
|
rtAct->Name = act->toString("Name");
|
||||||
rtAct->ActDescription = act->toString("ActDescription");
|
rtAct->ActDescription = act->toString("ActDescription");
|
||||||
rtAct->PreActDescription = act->toString("PreActDescription");
|
rtAct->PreActDescription = act->toString("PreActDescription");
|
||||||
rtAct->LocationId = static_cast<uint32>(act->toNumber("LocationId"));
|
rtAct->LocationId = static_cast<uint32>(act->toInteger("LocationId"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1508,9 +1508,9 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
|
||||||
a2pAiState.setAttributeAsStringArray("Keywords", "keywords");
|
a2pAiState.setAttributeAsStringArray("Keywords", "keywords");
|
||||||
|
|
||||||
bool isTriggerZone = false;
|
bool isTriggerZone = false;
|
||||||
if ( aiState->isNumber("IsTriggerZone") )
|
if ( aiState->isInteger("IsTriggerZone") )
|
||||||
{
|
{
|
||||||
isTriggerZone = static_cast<uint32>(aiState->toNumber("IsTriggerZone")) == 1;
|
isTriggerZone = aiState->toInteger("IsTriggerZone") == 1;
|
||||||
}
|
}
|
||||||
if (isTriggerZone)
|
if (isTriggerZone)
|
||||||
{
|
{
|
||||||
|
@ -1550,7 +1550,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
|
||||||
|
|
||||||
npc_group->addPropertyByName("name", new CPropertyString(prefix+component->toString("Id")));
|
npc_group->addPropertyByName("name", new CPropertyString(prefix+component->toString("Id")));
|
||||||
npc_group->addPropertyByName("ai_type", new CPropertyString("GROUP_NPC")); // AJM
|
npc_group->addPropertyByName("ai_type", new CPropertyString("GROUP_NPC")); // AJM
|
||||||
if (component->isNumber("AutoSpawn") && component->toNumber("AutoSpawn")==0)
|
if (component->isInteger("AutoSpawn") && component->toInteger("AutoSpawn")==0)
|
||||||
{
|
{
|
||||||
npc_group->addPropertyByName("autoSpawn", new CPropertyString("false"));
|
npc_group->addPropertyByName("autoSpawn", new CPropertyString("false"));
|
||||||
}
|
}
|
||||||
|
@ -1740,9 +1740,9 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
|
||||||
npc_bot->insertChild(npc_bot_alias);
|
npc_bot->insertChild(npc_bot_alias);
|
||||||
// nlinfo("R2Anim: Bot %u %s", npc_bot_alias->getFullAlias(), std::string(prefix+objectNpc->toString("Id")).c_str());
|
// nlinfo("R2Anim: Bot %u %s", npc_bot_alias->getFullAlias(), std::string(prefix+objectNpc->toString("Id")).c_str());
|
||||||
uint32 dmProperty = 0;
|
uint32 dmProperty = 0;
|
||||||
if (objectNpc->isNumber("DmProperty"))
|
if (objectNpc->isInteger("DmProperty"))
|
||||||
{
|
{
|
||||||
dmProperty = static_cast< uint32 > (objectNpc->toNumber("DmProperty"));
|
dmProperty = static_cast< uint32 > (objectNpc->toInteger("DmProperty"));
|
||||||
}
|
}
|
||||||
CRtNpc* rtNpc = new CRtNpc(npc_bot_alias->getFullAlias(), objectNpc, npc_group_alias->getFullAlias(), dmProperty);
|
CRtNpc* rtNpc = new CRtNpc(npc_bot_alias->getFullAlias(), objectNpc, npc_group_alias->getFullAlias(), dmProperty);
|
||||||
|
|
||||||
|
@ -1770,9 +1770,9 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
|
||||||
CObject* eventObject = events->getValue(firstEvent);
|
CObject* eventObject = events->getValue(firstEvent);
|
||||||
|
|
||||||
bool isTriggerZone = false;
|
bool isTriggerZone = false;
|
||||||
if ( eventObject->isNumber("IsTriggerZone") )
|
if ( eventObject->isInteger("IsTriggerZone") )
|
||||||
{
|
{
|
||||||
isTriggerZone = static_cast<uint32>(eventObject->toNumber("IsTriggerZone")) == 1;
|
isTriggerZone = static_cast<uint32>(eventObject->toInteger("IsTriggerZone")) == 1;
|
||||||
}
|
}
|
||||||
if (isTriggerZone)
|
if (isTriggerZone)
|
||||||
{
|
{
|
||||||
|
@ -1788,7 +1788,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
|
||||||
CObject *weatherValue = act->getAttr("WeatherValue");
|
CObject *weatherValue = act->getAttr("WeatherValue");
|
||||||
if (weatherValue)
|
if (weatherValue)
|
||||||
{
|
{
|
||||||
animSession->Acts[actId]->WeatherValue = (uint16) weatherValue->toNumber();
|
animSession->Acts[actId]->WeatherValue = (uint16) weatherValue->toInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1901,7 +1901,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
|
||||||
CObject* plotItem = plotItems->getValue(firstPlotItem);
|
CObject* plotItem = plotItems->getValue(firstPlotItem);
|
||||||
if (!plotItem
|
if (!plotItem
|
||||||
|| !plotItem->isTable()
|
|| !plotItem->isTable()
|
||||||
|| !plotItem->isNumber("SheetId")
|
|| !plotItem->isInteger("SheetId")
|
||||||
|| !plotItem->isString("Name")
|
|| !plotItem->isString("Name")
|
||||||
|| !plotItem->isString("Description")
|
|| !plotItem->isString("Description")
|
||||||
|| !plotItem->isString("Comment")
|
|| !plotItem->isString("Comment")
|
||||||
|
@ -1911,7 +1911,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 sheetIdAsInt = static_cast<uint32>(plotItem->toNumber("SheetId"));
|
uint32 sheetIdAsInt = static_cast<uint32>(plotItem->toInteger("SheetId"));
|
||||||
CSheetId plotItemSheetId( sheetIdAsInt );
|
CSheetId plotItemSheetId( sheetIdAsInt );
|
||||||
|
|
||||||
|
|
||||||
|
@ -1958,7 +1958,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
|
||||||
CObject* location = locations->getValue(firstLocation);
|
CObject* location = locations->getValue(firstLocation);
|
||||||
if (!location
|
if (!location
|
||||||
|| !location->isTable()
|
|| !location->isTable()
|
||||||
|| !location->isNumber("Season")
|
|| !location->isInteger("Season")
|
||||||
|| !location->isString("Island")
|
|| !location->isString("Island")
|
||||||
|| !location->isString("EntryPoint")
|
|| !location->isString("EntryPoint")
|
||||||
|
|
||||||
|
@ -1969,7 +1969,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
|
||||||
}
|
}
|
||||||
|
|
||||||
CRtLocation locationItem;
|
CRtLocation locationItem;
|
||||||
locationItem.Season = static_cast<uint8>(location->toNumber("Season"));
|
locationItem.Season = static_cast<uint8>(location->toInteger("Season"));
|
||||||
locationItem.Island = location->toString("Island");
|
locationItem.Island = location->toString("Island");
|
||||||
locationItem.EntryPoint = location->toString("EntryPoint");
|
locationItem.EntryPoint = location->toString("EntryPoint");
|
||||||
animSession->Locations.push_back(locationItem);
|
animSession->Locations.push_back(locationItem);
|
||||||
|
|
|
@ -113,7 +113,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CObject* texts = textManager->getAttr("Texts");
|
CObject* texts = textManager->getAttr("Texts");
|
||||||
uint32 maxId = static_cast<uint32>(textManager->getAttr("MaxId")->toNumber());
|
uint32 maxId = static_cast<uint32>(textManager->getAttr("MaxId")->toInteger());
|
||||||
CObject* unused = textManager->getAttr("UnusedIds");
|
CObject* unused = textManager->getAttr("UnusedIds");
|
||||||
uint32 max = unused->getSize();
|
uint32 max = unused->getSize();
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager)
|
||||||
//unused ids
|
//unused ids
|
||||||
for(uint32 i=0;i<max;i++)
|
for(uint32 i=0;i<max;i++)
|
||||||
{
|
{
|
||||||
uint32 id = static_cast<uint32>(unused->getValue(i)->toNumber());
|
uint32 id = static_cast<uint32>(unused->getValue(i)->toInteger());
|
||||||
_FreeIds.insert(id);
|
_FreeIds.insert(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,8 +133,8 @@ CSmallStringManager::CSmallStringManager(CObject* textManager)
|
||||||
{
|
{
|
||||||
CObject* entry = texts->getValue(i);
|
CObject* entry = texts->getValue(i);
|
||||||
std::string text = entry->getAttr("Text")->toString();
|
std::string text = entry->getAttr("Text")->toString();
|
||||||
uint32 textId = static_cast<uint32>(entry->getAttr("TextId")->toNumber());
|
uint32 textId = static_cast<uint32>(entry->getAttr("TextId")->toInteger());
|
||||||
uint32 textCount = static_cast<uint32>(entry->getAttr("Count")->toNumber());
|
uint32 textCount = static_cast<uint32>(entry->getAttr("Count")->toInteger());
|
||||||
_StringToId.insert(std::pair<std::string, uint32>(text, textId));
|
_StringToId.insert(std::pair<std::string, uint32>(text, textId));
|
||||||
_IdToString.insert( std::pair<uint32, std::pair<std::string, uint32> >(textId, std::pair<std::string, uint32>(text, textCount) ) );
|
_IdToString.insert( std::pair<uint32, std::pair<std::string, uint32> >(textId, std::pair<std::string, uint32>(text, textCount) ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ void CWeatherManager::init(const std::vector<const CWeatherSetupSheetBase *> &sh
|
||||||
{
|
{
|
||||||
if (sheets[k])
|
if (sheets[k])
|
||||||
{
|
{
|
||||||
std::string id = NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(sheetNames[k]));
|
std::string id = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(sheetNames[k]));
|
||||||
CWeatherSetup *ws = newWeatherSetup();
|
CWeatherSetup *ws = newWeatherSetup();
|
||||||
if (ws)
|
if (ws)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ void CWeatherManager::release()
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
const CWeatherSetup *CWeatherManager::getSetup(const char *name) const
|
const CWeatherSetup *CWeatherManager::getSetup(const char *name) const
|
||||||
{
|
{
|
||||||
std::string id = NLMISC::strlwr(CFile::getFilenameWithoutExtension(name));
|
std::string id = NLMISC::toLower(CFile::getFilenameWithoutExtension(name));
|
||||||
TWeatherSetupMap::const_iterator it = _WeatherSetupMap.find(id);
|
TWeatherSetupMap::const_iterator it = _WeatherSetupMap.find(id);
|
||||||
if (it == _WeatherSetupMap.end()) return NULL;
|
if (it == _WeatherSetupMap.end()) return NULL;
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
|
@ -85,7 +85,7 @@ void CWeatherStateSheet::build(const NLGEORGES::UFormElm &item)
|
||||||
GetWeatherFormValue(item, fxName, "FXName");
|
GetWeatherFormValue(item, fxName, "FXName");
|
||||||
if (!fxName.empty())
|
if (!fxName.empty())
|
||||||
{
|
{
|
||||||
fxName = NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(fxName));
|
fxName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(fxName));
|
||||||
if (!fxName.empty())
|
if (!fxName.empty())
|
||||||
{
|
{
|
||||||
FXInfos.resize(1);
|
FXInfos.resize(1);
|
||||||
|
@ -192,7 +192,7 @@ void CWeatherSetupSheetBase::build(const NLGEORGES::UFormElm &item)
|
||||||
CloudState.build(item);
|
CloudState.build(item);
|
||||||
std::string setupName;
|
std::string setupName;
|
||||||
GetWeatherFormValue(item, setupName, "SetupName");
|
GetWeatherFormValue(item, setupName, "SetupName");
|
||||||
SetupName = NLMISC::CStringMapper::map(NLMISC::strlwr(setupName));
|
SetupName = NLMISC::CStringMapper::map(NLMISC::toLower(setupName));
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================
|
//==================================================================================
|
||||||
|
@ -203,7 +203,7 @@ void CWeatherSetupSheetBase::serial(class NLMISC::IStream &f) throw(NLMISC::EStr
|
||||||
{
|
{
|
||||||
std::string setupName;
|
std::string setupName;
|
||||||
f.serial(setupName);
|
f.serial(setupName);
|
||||||
SetupName = NLMISC::CStringMapper::map(NLMISC::strlwr(setupName));
|
SetupName = NLMISC::CStringMapper::map(NLMISC::toLower(setupName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue