Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 7fc2b99

Browse files
committed
Added handling for multiline description to Entity.cpp
Added luabinding for description
1 parent 115dd12 commit 7fc2b99

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Managers/LuaMan.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ int LuaMan::Create()
543543
.def(tostring(const_self))
544544
.property("ClassName", &Entity::GetClassName)
545545
.property("PresetName", &Entity::GetPresetName, &Entity::SetPresetName)
546+
.property("Description", &Entity::GetDescription, &Entity::SetDescription)
546547
.def("GetModuleAndPresetName", &Entity::GetModuleAndPresetName)
547548
.property("IsOriginalPreset", &Entity::IsOriginalPreset)
548549
.property("ModuleID", &Entity::GetModuleID)

System/Entity.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,18 @@ namespace RTE {
7575
// Indicate where this was read from
7676
m_DefinedInModule = reader.GetReadModuleID();
7777
} else if (propName == "Description") {
78-
reader >> m_PresetDescription;
78+
std::string descriptionValue = reader.ReadPropValue();
79+
if (descriptionValue == "MultiLineText") {
80+
m_PresetDescription.clear();
81+
while (reader.NextProperty() && reader.ReadPropName() == "AddLine") {
82+
m_PresetDescription += reader.ReadPropValue() + "\n\n";
83+
}
84+
if (!m_PresetDescription.empty()) {
85+
m_PresetDescription.resize(m_PresetDescription.size() - 2);
86+
}
87+
} else {
88+
m_PresetDescription = descriptionValue;
89+
}
7990
} else if (propName == "RandomWeight") {
8091
reader >> m_RandomWeight;
8192
m_RandomWeight = Limit(m_RandomWeight, 100, 0);

0 commit comments

Comments
 (0)