Skip to content

Commit d0a6952

Browse files
committed
up
1 parent 30cc51d commit d0a6952

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

kbe/src/lib/entitydef/datatype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2713,7 +2713,7 @@ PyObject* EntityComponentType::createCellDataFromPersistentStream(MemoryStream*
27132713
PyObject* pyobj = NULL;
27142714

27152715
if(mstream)
2716-
propertyDescription->createFromStream(mstream);
2716+
pyobj = propertyDescription->createFromStream(mstream);
27172717

27182718
if (pyobj == NULL)
27192719
{

kbe/src/lib/entitydef/entitydef.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,7 @@ bool EntityDef::loadAllComponentScriptModules(std::string entitiesPath, std::vec
18531853
flags &= ~ENTITY_CLIENT_DATA_FLAGS;
18541854

18551855
compPropertyInter->second->setFlags(flags);
1856+
compPropertyInter->second->decRef();
18561857

18571858
propertyDescrs.erase(compPropertyInter++);
18581859
continue;
@@ -1902,6 +1903,16 @@ bool EntityDef::loadAllComponentScriptModules(std::string entitiesPath, std::vec
19021903
}
19031904

19041905
pComponentPropertyDescription->setFlags(pflags);
1906+
if (pComponentPropertyDescription->isPersistent() && pCompScriptModule->numPropertys() == 0)
1907+
{
1908+
pComponentPropertyDescription->isPersistent(false);
1909+
1910+
if ((*entityScriptModuleIter)->findPersistentPropertyDescription(pComponentPropertyDescription->getUType()))
1911+
{
1912+
(*entityScriptModuleIter)->getPersistentPropertyDescriptions().erase(pComponentPropertyDescription->getName());
1913+
(*entityScriptModuleIter)->getPersistentPropertyDescriptions_uidmap().erase(pComponentPropertyDescription->getUType());
1914+
}
1915+
}
19051916

19061917
if ((*entityScriptModuleIter)->findPropertyDescription(pComponentPropertyDescription->getName(), g_componentType) != pComponentPropertyDescription)
19071918
{

kbe/src/lib/entitydef/property.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class PropertyDescription : public RefCountable
4646
是否是一个保存到数据库中的属性
4747
*/
4848
INLINE bool isPersistent(void) const;
49-
49+
INLINE void isPersistent(bool v);
50+
5051
/**
5152
获取这个属性的数据类别
5253
*/

kbe/src/lib/entitydef/property.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ INLINE bool PropertyDescription::isPersistent(void) const
1313
return isPersistent_;
1414
};
1515

16+
INLINE void PropertyDescription::isPersistent(bool v)
17+
{
18+
isPersistent_ = v;
19+
}
20+
1621
INLINE DataType* PropertyDescription::getDataType(void) const
1722
{
1823
return dataType_;

kbe/src/server/baseapp/baseapp.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ PyObject* createDictDataFromPersistentStream(MemoryStream& s, const char* entity
7272
bool hasComponentData = false;
7373
EntityComponentType* pEntityComponentType = ((EntityComponentType*)propertyDescription->getDataType());
7474

75-
if(pEntityComponentType->pScriptDefModule()->numPropertys() > 0)
76-
s >> hasComponentData;
75+
s >> hasComponentData;
7776

7877
if (hasComponentData)
7978
{

kbe/src/server/baseapp/entity.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,6 @@ void Entity::addPersistentsDataToStream(uint32 flags, MemoryStream* s)
410410
if(propertyDescription->isPersistent() && (flags & propertyDescription->getFlags()) > 0)
411411
{
412412
bool isComponent = propertyDescription->getDataType()->type() == DATA_TYPE_ENTITY_COMPONENT;
413-
if (isComponent)
414-
{
415-
// 由于存在一种情况, 组件def中没有内容, 但有cell脚本,此时baseapp上无法判断他是否有cell属性,所以写celldata时没有数据写入
416-
EntityComponentType* pEntityComponentType = (EntityComponentType*)propertyDescription->getDataType();
417-
if (pEntityComponentType->pScriptDefModule()->numPropertys() == 0)
418-
continue;
419-
}
420413

421414
PyObject *key = PyUnicode_FromString(attrname);
422415

0 commit comments

Comments
 (0)