summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelcontents.cpp8
-rw-r--r--indra/newview/lltooldraganddrop.cpp2
-rw-r--r--indra/newview/llviewerinventory.cpp2
-rw-r--r--indra/newview/llviewerinventory.h2
-rw-r--r--indra/newview/llviewerobject.cpp11
-rw-r--r--indra/newview/llviewerobject.h6
6 files changed, 15 insertions, 16 deletions
diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp
index 2f060ac2e6..2e4dc88217 100644
--- a/indra/newview/llpanelcontents.cpp
+++ b/indra/newview/llpanelcontents.cpp
@@ -241,7 +241,7 @@ void LLPanelContents::onClickNewScript(void *userdata)
std::string desc;
LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc);
- U8 script_language = LANG_ID_LSL;
+ U8 script_language = SST_LSL;
LLUUID template_id;
LLViewerRegion* region = object->getRegion();
@@ -251,7 +251,7 @@ void LLPanelContents::onClickNewScript(void *userdata)
region->getSimulatorFeatures(simulatorFeatures);
if (simulatorFeatures["LuaScriptsEnabled"].asBoolean())
{
- script_language = LANG_ID_LUA;
+ script_language = SST_LUA;
}
}
// *TODO* Get a template ID and script_language based on user preferences. Template ID is the inventory item UUID of a script
@@ -268,9 +268,9 @@ void LLPanelContents::onClickNewScript(void *userdata)
"New Script",
desc,
LLSaleInfo::DEFAULT,
- LLInventoryItemFlags::II_FLAGS_NONE,
+ LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK & script_language,
time_corrected());
- object->saveScript(new_item, true, true, script_language, template_id);
+ object->saveScript(new_item, true, true, template_id);
std::string name = new_item->getName();
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index bca4743c19..eb8ace339e 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1828,7 +1828,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
}
}
}
- hit_obj->saveScript(new_script, active, true, LANG_ID_LSL, LLUUID::null);
+ hit_obj->saveScript(new_script, active, true, LLUUID::null);
if (gFloaterTools)
{
gFloaterTools->dirty();
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index f5fd234da7..53d87e2869 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1739,7 +1739,7 @@ void create_new_item(const std::string& name,
region->getSimulatorFeatures(simulatorFeatures);
if (simulatorFeatures["LuaScriptsEnabled"].asBoolean())
{
- subtype = LANG_ID_LUA;
+ subtype = SST_LUA;
}
}
break;
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index 4147efe3a9..23f85663e8 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -43,8 +43,6 @@ class LLInventoryCallback;
class LLAvatarName;
constexpr U8 NO_INV_SUBTYPE{ 0 };
-constexpr U8 LANG_ID_LSL = 0;
-constexpr U8 LANG_ID_LUA = 1;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLViewerInventoryItem
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index ca5281b3c7..d280f74fc7 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2767,9 +2767,10 @@ void LLViewerObject::doUpdateInventory(
// If a template_id is provided, the new script will be a copy of that item.
//
// *IMPORTANT* If template_id is provided, it must be the ITEM ID of a
-// copy/mod-able script in the user's inventory.
+// copy/mod-able script in the user's inventory. The simulator will verify
+// permissions.
void LLViewerObject::saveScript(const LLViewerInventoryItem* item,
- bool active, bool is_new, U8 script_language, const LLUUID& template_id)
+ bool active, bool is_new, const LLUUID& template_id)
{
/*
* XXXPAM Investigate not making this copy. Seems unecessary, but I'm unsure about the
@@ -2799,11 +2800,11 @@ void LLViewerObject::saveScript(const LLViewerInventoryItem* item,
msg->nextBlockFast(_PREHASH_InventoryBlock);
task_item->packMessage(msg);
- // This is a completely new script (no asset id)
- if (task_item->getAssetUUID().isNull())
+ // This is a completely new script (no asset id) and we've provided a template.
+ // Note that the script subtype on the template will override any subtype on the item.
+ if (task_item->getAssetUUID().isNull() && template_id.notNull())
{
msg->nextBlock("NewScriptInfo");
- msg->addU8("Type", script_language);
msg->addUUID("TemplateID", template_id);
}
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 3225349506..db1a412c78 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -549,9 +549,9 @@ public:
// in the new one. This method should be called with the asset id
// of the new and old script AFTER the bytecode has been saved.
// The simulator treats the script as new when item->getAssetUUID().isNull() is true; in that case
- // template_id will be used (if non-null) to copy an existing script asset, otherwise script_language
- // is used to request an appropriate generic starting script.
- void saveScript(const LLViewerInventoryItem* item, bool active, bool is_new, U8 script_language, const LLUUID& template_id);
+ // template_id will be used (if non-null) to copy an existing script asset, otherwise the
+ // script subtype in the item will be used to select the correct template.
+ void saveScript(const LLViewerInventoryItem* item, bool active, bool is_new, const LLUUID& template_id);
// move an inventory item out of the task and into agent
// inventory. This operation is based on messaging. No permissions