mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-26 08:46:19 +00:00
Fix r2ed
This commit is contained in:
parent
1a8b6333ba
commit
4f0a79d67a
9 changed files with 71 additions and 59 deletions
|
@ -1132,7 +1132,7 @@ void CFarTP::disconnectFromPreviousShard()
|
|||
*/
|
||||
NetMngr.reinit();
|
||||
|
||||
if (isIngame())
|
||||
if (isIngame() && !isReselectingChar())
|
||||
{
|
||||
nlinfo("FarTP: calling EntitiesMngr.reinit()");
|
||||
EntitiesMngr.reinit();
|
||||
|
|
|
@ -1931,6 +1931,7 @@ void CLuaIHMRyzom::rawDebugInfo(const std::string &dbg)
|
|||
#endif
|
||||
pIM->displaySystemInfo( LuaHelperStuff::formatLuaErrorSysInfo(dbg));
|
||||
}
|
||||
nldebug("LUA: '%s'", dbg.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1116,7 +1116,7 @@ function userComponentManager:export(list, refX, refY, refZ)
|
|||
messageBox(i18n.get("uiR2EDInvalidName"))
|
||||
return
|
||||
end
|
||||
if string.find(form.ComponentFileName, '\.lua', -4) == nil then
|
||||
if string.find(form.ComponentFileName, '.lua', -4) == nil then
|
||||
form.ComponentFileName = form.ComponentFileName .. ".lua"
|
||||
end
|
||||
local refPosition = form.RefPosition
|
||||
|
|
|
@ -140,7 +140,8 @@ end
|
|||
|
||||
function assert(cond)
|
||||
if not cond then
|
||||
rawDebugInfo(colorTag(255, 0, 255) .. "ASSERTION FAILED !! ")
|
||||
-- rawDebugInfo(colorTag(255, 0, 255) .. "ASSERTION FAILED !! ")
|
||||
rawDebugInfo("@{FOFF}ASSERTION FAILED !! ")
|
||||
dumpCallStack(2);
|
||||
error("")
|
||||
end
|
||||
|
|
|
@ -1679,7 +1679,7 @@ Logic.translateChatSequences = function (context, hlComponent, behavior, rtNpcGr
|
|||
event.Name = "activity_sequence_changed"
|
||||
table.insert(context.RtAct.Events, event)
|
||||
|
||||
local rtInitChatStep = r2.Translator.createAction("code", "oldChatStepVar = -1;\n" .. Logic.chatStepVar .." = 0;\n()setTimer(1, " ..Logic.chatTimerId .. ")\;\n")
|
||||
local rtInitChatStep = r2.Translator.createAction("code", "oldChatStepVar = -1;\n" .. Logic.chatStepVar .." = 0;\n()setTimer(1, " ..Logic.chatTimerId .. ");\n")
|
||||
rtInitChatStep.Name = "init_chat_step"
|
||||
table.insert(context.RtAct.Actions, rtInitChatStep)
|
||||
table.insert(event.ActionsId, rtInitChatStep.Id)
|
||||
|
|
|
@ -32,9 +32,8 @@ end
|
|||
-- extension to table library : remove all content of a table without deleting the table object
|
||||
function table.clear(tbl)
|
||||
while next(tbl) do
|
||||
tbl[next(tbl)] = nil
|
||||
table.remove(tbl, next(tbl))
|
||||
end
|
||||
table.setn(tbl, 0)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
@ -174,6 +173,17 @@ end
|
|||
function strify(str)
|
||||
return [["]] .. tostring(str) .. [["]]
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------
|
||||
-- enclose a string by double quotes
|
||||
function strifyXml(str)
|
||||
strxml = string.gsub(str, ">", ">")
|
||||
strxml = string.gsub(strxml, "<", "<")
|
||||
strxml = string.gsub(strxml, "&", "&")
|
||||
strxml = string.gsub(strxml, "'", "'")
|
||||
strxml = string.gsub(strxml, '"', """)
|
||||
return [["]] .. tostring(strxml) .. [["]]
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
-- snap a position to ground, returning the z snapped coordinate
|
||||
|
|
|
@ -328,7 +328,7 @@ end
|
|||
|
||||
local function saveScenarioOnChange(formInstance)
|
||||
r2.print(formInstance.Name)
|
||||
local name = string.gsub(formInstance.Name, "[\\\/\:\*\?\"\<\>\|]", "_")
|
||||
local name = string.gsub(formInstance.Name, "[\\/:*?\"<>|]", "_")
|
||||
if name ~= formInstance.Name then
|
||||
fromInstance.Name = name
|
||||
formInstance.Modified = true
|
||||
|
|
|
@ -47,13 +47,13 @@ function r2:buildEditBox(prop, textRef, entryType, multiLine, maxNumChars, onCha
|
|||
bg_texture="grey_40.tga"
|
||||
onchange="lua" onchange_params="getUICaller():setupDisplayText(); getUICaller():find('edit_text'):updateCoords(); getUICaller():getEnclosingContainer().Env.updateSize()"
|
||||
onenter="lua" on_focus_lost="lua"]] ..
|
||||
[[ id= ]] .. strify(prop.Name) ..
|
||||
[[ text_ref = ]] .. strify(textRef) ..
|
||||
[[ entry_type = ]] .. strify(entryType) ..
|
||||
[[ multi_line = ]] .. strify(multiLine) ..
|
||||
[[ max_num_chars = ]] .. strify(maxNumChars) ..
|
||||
[[ params = ]] .. strify(onChangeAction) ..
|
||||
[[ on_focus_lost_params = ]] .. strify(onFocusLostAction) ..
|
||||
[[ id= ]] .. strifyXml(prop.Name) ..
|
||||
[[ text_ref = ]] .. strifyXml(textRef) ..
|
||||
[[ entry_type = ]] .. strifyXml(entryType) ..
|
||||
[[ multi_line = ]] .. strifyXml(multiLine) ..
|
||||
[[ max_num_chars = ]] .. strifyXml(maxNumChars) ..
|
||||
[[ params = ]] .. strifyXml(onChangeAction) ..
|
||||
[[ on_focus_lost_params = ]] .. strifyXml(onFocusLostAction) ..
|
||||
"/>"
|
||||
return result
|
||||
end
|
||||
|
@ -73,13 +73,13 @@ end
|
|||
-- bg_texture="grey_40.tga"
|
||||
-- onchange="lua" onchange_params="getUICaller():setupDisplayText(); getUICaller():find('edit_text'):updateCoords(); getUICaller():getEnclosingContainer().Env.updateSize()"
|
||||
-- onenter="lua" on_focus_lost="lua"]] ..
|
||||
-- [[ id= ]] .. strify(prop.Name) ..
|
||||
-- [[ text_ref = ]] .. strify(textRef) ..
|
||||
-- [[ entry_type = ]] .. strify(entryType) ..
|
||||
-- [[ multi_line = ]] .. strify(multiLine) ..
|
||||
-- [[ max_num_chars = ]] .. strify(maxNumChars) ..
|
||||
-- [[ params = ]] .. strify(onChangeAction) ..
|
||||
-- [[ on_focus_lost_params = ]] .. strify(onChangeAction) ..
|
||||
-- [[ id= ]] .. strifyXml(prop.Name) ..
|
||||
-- [[ text_ref = ]] .. strifyXml(textRef) ..
|
||||
-- [[ entry_type = ]] .. strifyXml(entryType) ..
|
||||
-- [[ multi_line = ]] .. strifyXml(multiLine) ..
|
||||
-- [[ max_num_chars = ]] .. strifyXml(maxNumChars) ..
|
||||
-- [[ params = ]] .. strifyXml(onChangeAction) ..
|
||||
-- [[ on_focus_lost_params = ]] .. strifyXml(onChangeAction) ..
|
||||
-- [[ />
|
||||
--
|
||||
--
|
||||
|
@ -1043,7 +1043,7 @@ r2.WidgetStyles.Number =
|
|||
width1 = tmp
|
||||
end
|
||||
|
||||
local part0 = [[<TD width=]] .. strify(width0) .. [[ ignore_max_width="true" ignore_min_width="true" bgcolor="80 80 80 127" height="0" align="left" valign="middle" id= "l_]] .. prop.Name .. [[" > ]]
|
||||
local part0 = [[<TD width=]] .. strifyXml(width0) .. [[ ignore_max_width="true" ignore_min_width="true" bgcolor="80 80 80 127" height="0" align="left" valign="middle" id= "l_]] .. prop.Name .. [[" > ]]
|
||||
|
||||
|
||||
local tooltipTextId, tooltipTextIdFound = buildPropTooltipName(className, prop.Name)
|
||||
|
@ -1051,7 +1051,7 @@ r2.WidgetStyles.Number =
|
|||
tooltip_parent="win"
|
||||
tooltip_posref="auto"
|
||||
instant_help="true"
|
||||
tooltip=]] .. strify(tooltipTextId) .. ">"
|
||||
tooltip=]] .. strifyXml(tooltipTextId) .. ">"
|
||||
part0 = part0 .. buildCoverAllButton(prop)
|
||||
|
||||
local color = "255 255 255 255"
|
||||
|
@ -1066,10 +1066,10 @@ r2.WidgetStyles.Number =
|
|||
end
|
||||
|
||||
part0 = part0 .. [[ <view type="text" y="-2" sizeref="w" over_extend_view_text="true" over_extend_parent_rect="true"]] ..
|
||||
[[ id = ]] .. strify(prop.Name .. "_Caption") ..
|
||||
[[ hardtext = ]] .. strify(hardText) ..
|
||||
[[ color = ]] .. strify(color) ..
|
||||
[[ global_color=]] .. strify(globalColor) .. [[ fontsize="12" shadow="true" auto_clamp="true"/> ]]
|
||||
[[ id = ]] .. strifyXml(prop.Name .. "_Caption") ..
|
||||
[[ hardtext = ]] .. strifyXml(hardText) ..
|
||||
[[ color = ]] .. strifyXml(color) ..
|
||||
[[ global_color=]] .. strifyXml(globalColor) .. [[ fontsize="12" shadow="true" auto_clamp="true"/> ]]
|
||||
part0 = part0 .. "</group>"
|
||||
part0 = part0 .. "</TD>"
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ r2.WidgetStyles.Number =
|
|||
--
|
||||
local widgetXml =
|
||||
string.format([[
|
||||
<group posref="TL TL" x="4" y="3" sizeref="w" w="-4" child_resize_h="true" child_resize_hmargin="3" id= ]] .. strify(prop.Name) .. ">" .. [[
|
||||
<group posref="TL TL" x="4" y="3" sizeref="w" w="-4" child_resize_h="true" child_resize_hmargin="3" id= ]] .. strifyXml(prop.Name) .. ">" .. [[
|
||||
<view type="bitmap" id="bk" posref="BL BL" scale="true" y="4" sizeref="w" h="2" texture="W_line_hor2.tga" />
|
||||
<ctrl type="scroll" id="c" posparent="bk" posref="MM MM" x="0" y="-1" sizeref="w" h="12"
|
||||
vertical="false" align="L" tracksize="12"
|
||||
|
@ -1136,14 +1136,14 @@ r2.WidgetStyles.Number =
|
|||
local result =
|
||||
[[
|
||||
<group type="combo_box" sizeref="w" w="-2" x="2" y="0" child_resize_h="true" child_resize_hmargin="10" linked_to_db="false" posref="TL TL" id=]]
|
||||
.. strify(prop.Name) ..
|
||||
.. strifyXml(prop.Name) ..
|
||||
string.format([[ on_change="lua" on_change_params="if getUICaller().parent.Env.Locked ~= true then r2:requestSetObjectProperty('%s', getUICaller().selection) end"]], prop.Name) ..
|
||||
">"
|
||||
result = result .. [[<instance template="combo_box_def1" />]]
|
||||
-- append enumerated values
|
||||
|
||||
for k, v in pairs(prop.Enum) do
|
||||
result = result .. [[<combo_text name="]] .. tostring(v) .. [[" />]]
|
||||
result = result .. [[<combo_text name=]] .. strifyXml(tostring(v)) .. [[ />]]
|
||||
end
|
||||
result = result .. "</group>"
|
||||
return result, setter
|
||||
|
@ -1201,10 +1201,10 @@ function r2:createPropertyXmlTable(props, className, posparent, posref, x, y, wi
|
|||
result = result .. value
|
||||
end
|
||||
add([[<group type="table" sizeparent="parent"]] ..
|
||||
[[ posparent= ]] .. strify(posparent) ..
|
||||
[[ posref= ]] .. strify(posref) ..
|
||||
[[ x= ]] .. strify(x) ..
|
||||
[[ y= ]] .. strify(y) ..
|
||||
[[ posparent= ]] .. strifyXml(posparent) ..
|
||||
[[ posref= ]] .. strifyXml(posref) ..
|
||||
[[ x= ]] .. strifyXml(x) ..
|
||||
[[ y= ]] .. strifyXml(y) ..
|
||||
[[ id="prop_table" sizeref="w" width="100%" border="0" bgcolor="0 0 0 255"
|
||||
cellspacing="1"
|
||||
cellpadding="0"
|
||||
|
@ -1249,18 +1249,18 @@ function r2:createPropertyXmlTable(props, className, posparent, posref, x, y, wi
|
|||
|
||||
local part0
|
||||
if not captionXmlDesc then
|
||||
part0 = [[<TD width=]] .. strify(width0) .. [[ ignore_max_width="true" ignore_min_width="true" bgcolor="80 80 80 127" height="0" align="left" valign="middle" id= "l_]] .. prop.Name .. [[" > ]]
|
||||
part0 = [[<TD width=]] .. strifyXml(width0) .. [[ ignore_max_width="true" ignore_min_width="true" bgcolor="80 80 80 127" height="0" align="left" valign="middle" id= "l_]] .. prop.Name .. [[" > ]]
|
||||
|
||||
part0 = part0 .. [[<group id="caption_group" sizeref="w" child_resize_h="true" posref="ML ML"
|
||||
tooltip_parent="win"
|
||||
tooltip_posref="auto"
|
||||
instant_help="true"
|
||||
tooltip=]] .. strify(tooltipTextId) .. ">"
|
||||
tooltip=]] .. strifyXml(tooltipTextId) .. ">"
|
||||
part0 = part0 .. [[ <view type="text" y="-2" sizeref="w" over_extend_view_text="true" over_extend_parent_rect="true"]] ..
|
||||
[[ id = ]] .. strify(prop.Name .. "_Caption") ..
|
||||
[[ hardtext = ]] .. strify(hardText) ..
|
||||
[[ color = ]] .. strify(color) ..
|
||||
[[ global_color=]] .. strify(globalColor) .. [[ fontsize="12" shadow="true" auto_clamp="true"/> ]]
|
||||
[[ id = ]] .. strifyXml(prop.Name .. "_Caption") ..
|
||||
[[ hardtext = ]] .. strifyXml(hardText) ..
|
||||
[[ color = ]] .. strifyXml(color) ..
|
||||
[[ global_color=]] .. strifyXml(globalColor) .. [[ fontsize="12" shadow="true" auto_clamp="true"/> ]]
|
||||
part0 = part0 .. "</group>"
|
||||
part0 = part0 .. "</TD>"
|
||||
else
|
||||
|
@ -1268,13 +1268,13 @@ function r2:createPropertyXmlTable(props, className, posparent, posref, x, y, wi
|
|||
end
|
||||
|
||||
-- build the widget
|
||||
local part1 = [[<TD width=]] .. strify(width1) .. [[ ignore_max_width="true" ignore_min_width="true" bgcolor="64 64 64 127" height="0" align="left" valign="middle" id= "r_]] .. prop.Name .. [[" > ]]
|
||||
local part1 = [[<TD width=]] .. strifyXml(width1) .. [[ ignore_max_width="true" ignore_min_width="true" bgcolor="64 64 64 127" height="0" align="left" valign="middle" id= "r_]] .. prop.Name .. [[" > ]]
|
||||
part1 = part1 .. [[<group id="widget_group" sizeref="w" child_resize_h="true" posref="ML ML"
|
||||
tooltip_parent="win"
|
||||
tooltip_posref="auto"
|
||||
tooltip_posref_alt="TL TR"
|
||||
instant_help="true"
|
||||
tooltip=]] .. strify(tooltipTextId) .. ">"
|
||||
tooltip=]] .. strifyXml(tooltipTextId) .. ">"
|
||||
part1 = part1 .. widgetXmlDesc .. [[</group></TD>]]
|
||||
|
||||
if invertWidget then
|
||||
|
@ -1397,15 +1397,15 @@ function r2:buildPropRolloutXml(caption, id, posparent, posref, props, className
|
|||
-- add the rollout bar
|
||||
if not isForm then
|
||||
result = result ..
|
||||
[[ <instance template="rollout_bar" caption=]] .. strify(caption) ..
|
||||
[[ color=]] .. strify(color) ..
|
||||
[[ global_color=]] .. strify(globalColor) ..
|
||||
[[ <instance template="rollout_bar" caption=]] .. strifyXml(caption) ..
|
||||
[[ color=]] .. strifyXml(color) ..
|
||||
[[ global_color=]] .. strifyXml(globalColor) ..
|
||||
[[ content_name="prop_table"/> ]]
|
||||
else
|
||||
result = result ..
|
||||
[[ <instance template="form_bar" caption=]] .. strify(caption) ..
|
||||
[[ color=]] .. strify(color) ..
|
||||
[[ global_color=]] .. strify(globalColor) ..
|
||||
[[ <instance template="form_bar" caption=]] .. strifyXml(caption) ..
|
||||
[[ color=]] .. strifyXml(color) ..
|
||||
[[ global_color=]] .. strifyXml(globalColor) ..
|
||||
[[ /> ]]
|
||||
end
|
||||
|
||||
|
@ -1475,9 +1475,9 @@ function r2:buildPropertySheetXml(class, className, id, title, isForm)
|
|||
if isForm then -- for forms, closing the form is equivalent to clicking on 'cancel'
|
||||
add(' resizer="true" ')
|
||||
local w = defaulting(class.Width, 500)
|
||||
add(' pop_min_w=' .. strify(w))
|
||||
add(' pop_max_w=' .. strify(w))
|
||||
add(' w=' .. strify(w))
|
||||
add(' pop_min_w=' .. strifyXml(w))
|
||||
add(' pop_max_w=' .. strifyXml(w))
|
||||
add(' w=' .. strifyXml(w))
|
||||
local cancelCode =
|
||||
[[ local form = getUICaller()
|
||||
if form.Env.Choice == nil then
|
||||
|
@ -1518,7 +1518,7 @@ function r2:buildPropertySheetXml(class, className, id, title, isForm)
|
|||
|
||||
|
||||
|
||||
add([[id=]] .. strify(id) .. [[
|
||||
add([[id=]] .. strifyXml(id) .. [[
|
||||
>]])
|
||||
|
||||
|
||||
|
@ -1647,7 +1647,7 @@ function r2:buildPropertySheetXml(class, className, id, title, isForm)
|
|||
</group> <!-- enclosing -->
|
||||
</group> <!-- content -->
|
||||
</group>
|
||||
<tree node=]] .. strify(id) .. [[ >
|
||||
<tree node=]] .. strifyXml(id) .. [[ >
|
||||
</tree>
|
||||
]])
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ UnitTest.testLoadAnimationScenarioUi = function()
|
|||
end
|
||||
|
||||
local filename = form.LoadScenario_Name
|
||||
if string.find(filename, '\.r2', -3) == nil then
|
||||
if string.find(filename, '.r2', -3) == nil then
|
||||
|
||||
local ui = r2:getForm("LoadScenario")
|
||||
ui.active = true
|
||||
|
@ -134,12 +134,12 @@ UnitTest.testLoadScenarioUi = function()
|
|||
local ucName = ucstring()
|
||||
ucName:fromUtf8(form.LoadScenario_Name)
|
||||
local filename = tostring(ucName)
|
||||
if string.find(filename, '\.r2', -3) == nil then
|
||||
if string.find(filename, '.r2', -3) == nil then
|
||||
messageBox(i18n.get("uiR2EDLoadScenario_InvalidFileName"))
|
||||
return
|
||||
end
|
||||
|
||||
-- if string.find(filename, '\.r2', -3) == nil then
|
||||
-- if string.find(filename, '.r2', -3) == nil then
|
||||
-- filename = form.Name .. ".r2"
|
||||
-- end
|
||||
|
||||
|
@ -206,7 +206,7 @@ function UnitTest.saveScenario(name, overwrite)
|
|||
messageBox(i18n.get("uiR2EDInvalidName"))
|
||||
return
|
||||
end
|
||||
if string.find(name, '\.r2', -3) == nil then
|
||||
if string.find(name, '.r2', -3) == nil then
|
||||
name = name .. ".r2"
|
||||
end
|
||||
-- update scenario name with the new name
|
||||
|
@ -1103,8 +1103,8 @@ end
|
|||
|
||||
|
||||
function t5()
|
||||
local toto = "&ezr_çà'_\\)d //:1' 2 éééà'..)à\/:*?\"<>|à)@4 58ftgsfdg\"\/:*?\"<>|"
|
||||
toto = string.gsub(toto, "[\\\/\:\*\?\"\<\>\|]", "_")
|
||||
local toto = "&ezr_çà'_\\)d //:1' 2 éééà'..)à/:*?\"<>|à)@4 58ftgsfdg\"/:*?\"<>|"
|
||||
toto = string.gsub(toto, "[\\/:*?\"<>|]", "_")
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue