Don't expose ucstring to Lua, unless compatibility flag is set

develop
kaetemi 4 years ago
parent 0d2633b697
commit 2444d94f4f

@ -42,9 +42,13 @@ namespace NLGUI
UInt32,
Float,
String,
#ifdef RYZOM_LUA_UCSTRING
UCString,
#endif
StringRef,
#ifdef RYZOM_LUA_UCSTRING
UCStringRef,
#endif
RGBA,
LuaMethod
}; // other types will be added when needed
@ -79,9 +83,13 @@ namespace NLGUI
TGetUInt32 GetUInt32;
TGetFloat GetFloat;
TGetString GetString;
#ifdef RYZOM_LUA_UCSTRING
TGetUCString GetUCString;
#endif
TGetStringRef GetStringRef;
#ifdef RYZOM_LUA_UCSTRING
TGetUCStringRef GetUCStringRef;
#endif
TGetRGBA GetRGBA;
TLuaMethod GetLuaMethod; // lua method can only be obtained, not written ...
} GetMethod;
@ -92,7 +100,9 @@ namespace NLGUI
TSetUInt32 SetUInt32;
TSetFloat SetFloat;
TSetString SetString;
#ifdef RYZOM_LUA_UCSTRING
TSetUCString SetUCString;
#endif
TSetRGBA SetRGBA;
} SetMethod;
// name of the property

@ -553,15 +553,19 @@ namespace NLGUI
case CReflectedProperty::String:
result.setString ((elem->*(pRP->GetMethod.GetString))());
break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString:
result.setString ((elem->*(pRP->GetMethod.GetUCString))().toUtf8());
break;
#endif
case CReflectedProperty::StringRef:
result.setString ((elem->*(pRP->GetMethod.GetStringRef))());
break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCStringRef:
result.setString ((elem->*(pRP->GetMethod.GetUCStringRef))().toUtf8());
break;
#endif
case CReflectedProperty::RGBA:
result.setRGBA ((elem->*(pRP->GetMethod.GetRGBA))());
break;

@ -117,18 +117,18 @@ namespace NLGUI
return false;
}
break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString:
case CReflectedProperty::UCStringRef:
#ifdef RYZOM_LUA_UCSTRING
if (valueToAffect.toString())
{
(destElem.*(property.SetMethod.SetUCString))(ucstring::makeFromUtf8(valueToAffect.getString()));
}
else
#endif
{
return false;
}
#endif
break;
case CReflectedProperty::RGBA:
if (valueToAffect.toRGBA())

@ -1412,6 +1412,7 @@ namespace NLGUI
case CReflectedProperty::String:
ls.push( (reflectedObject.*(property.GetMethod.GetString))() );
break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString:
{
ucstring str = (reflectedObject.*(property.GetMethod.GetUCString))();
@ -1434,6 +1435,7 @@ namespace NLGUI
#endif
}
break;
#endif
case CReflectedProperty::StringRef:
ls.push( (reflectedObject.*(property.GetMethod.GetStringRef))() );
break;
@ -1508,6 +1510,7 @@ namespace NLGUI
(target.*(property.SetMethod.SetString))(val);
return;
}
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString:
case CReflectedProperty::UCStringRef:
{
@ -1532,6 +1535,7 @@ namespace NLGUI
(target.*(property.SetMethod.SetUCString))(val);
return;
}
#endif
case CReflectedProperty::RGBA:
{
CRGBA color;

@ -1863,8 +1863,9 @@ string getTarget(CCtrlBase * /* ctrl */, const string &targetName)
return "";
}
#ifdef RYZOM_LUA_UCSTRING
// ------------------------------------------------------------------------------------------------
ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) // TODO: UTF-8 Lua
ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName)
{
string sTmp = targetName;
std::vector<CInterfaceLink::CTargetInfo> targetsVector;
@ -1884,6 +1885,7 @@ ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) // TODO:
return ((elem->*(pRP->GetMethod.GetUCString))());
return ucstring(""); // TODO: UTF-8 Lua
}
#endif
/*// Ask the server to rename a character
// ------------------------------------------------------------------------------------------------
@ -1955,7 +1957,11 @@ public:
string sDBLink = getParam(Params, "dblink");
CharNameValidDBLink = sDBLink;
#ifdef RYZOM_LUA_UCSTRING
string sName = getUCTarget(NULL,sTarget).toUtf8(); // TODO: UTF-8 Lua
#else
string sName = getTarget(NULL, sTarget);
#endif
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (sName.empty())

Loading…
Cancel
Save