Skip to content

Commit 287695b

Browse files
committed
调整函数名和注释。
1 parent 1892c7d commit 287695b

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

kbe/src/lib/server/entity_app.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ class EntityApp : public ServerApp
135135
/**
136136
创建一个entity
137137
*/
138-
E* createEntityCommon(const char* entityType, PyObject* params,
138+
E* createEntity(const char* entityType, PyObject* params,
139139
bool isInitializeScript = true, ENTITY_ID eid = 0, bool initProperty = true);
140140

141-
virtual E* onCreateEntityCommon(PyObject* pyEntity, ScriptDefModule* sm, ENTITY_ID eid);
141+
virtual E* onCreateEntity(PyObject* pyEntity, ScriptDefModule* sm, ENTITY_ID eid);
142142

143143
/** 网络接口
144144
请求分配一个ENTITY_ID段的回调
@@ -550,27 +550,27 @@ bool EntityApp<E>::uninstallPyModules()
550550
}
551551

552552
template<class E>
553-
E* EntityApp<E>::createEntityCommon(const char* entityType, PyObject* params,
553+
E* EntityApp<E>::createEntity(const char* entityType, PyObject* params,
554554
bool isInitializeScript, ENTITY_ID eid, bool initProperty)
555555
{
556556
// 检查ID是否足够, 不足返回NULL
557557
if(eid <= 0 && idClient_.getSize() == 0)
558558
{
559-
PyErr_SetString(PyExc_SystemError, "EntityApp::createEntityCommon: is Failed. not enough entityIDs.");
559+
PyErr_SetString(PyExc_SystemError, "EntityApp::createEntity: is Failed. not enough entityIDs.");
560560
PyErr_PrintEx(0);
561561
return NULL;
562562
}
563563

564564
ScriptDefModule* sm = EntityDef::findScriptModule(entityType);
565565
if(sm == NULL)
566566
{
567-
PyErr_Format(PyExc_TypeError, "EntityApp::createEntityCommon: entity [%s] not found.\n", entityType);
567+
PyErr_Format(PyExc_TypeError, "EntityApp::createEntity: entity [%s] not found.\n", entityType);
568568
PyErr_PrintEx(0);
569569
return NULL;
570570
}
571571
else if(componentType_ == CELLAPP_TYPE ? !sm->hasCell() : !sm->hasBase())
572572
{
573-
PyErr_Format(PyExc_TypeError, "EntityApp::createEntityCommon: entity [%s] not found.\n", entityType);
573+
PyErr_Format(PyExc_TypeError, "EntityApp::createEntity: entity [%s] not found.\n", entityType);
574574
PyErr_PrintEx(0);
575575
return NULL;
576576
}
@@ -582,7 +582,7 @@ E* EntityApp<E>::createEntityCommon(const char* entityType, PyObject* params,
582582
if(id <= 0)
583583
id = idClient_.alloc();
584584

585-
E* entity = onCreateEntityCommon(obj, sm, id);
585+
E* entity = onCreateEntity(obj, sm, id);
586586

587587
if(initProperty)
588588
entity->initProperty();
@@ -598,18 +598,18 @@ E* EntityApp<E>::createEntityCommon(const char* entityType, PyObject* params,
598598

599599
if(g_debugEntity)
600600
{
601-
INFO_MSG(fmt::format("EntityApp::createEntityCommon: new {} ({}) refc={}.\n", entityType, id, obj->ob_refcnt));
601+
INFO_MSG(fmt::format("EntityApp::createEntity: new {} ({}) refc={}.\n", entityType, id, obj->ob_refcnt));
602602
}
603603
else
604604
{
605-
INFO_MSG(fmt::format("EntityApp::createEntityCommon: new {0} {1}\n", entityType, id));
605+
INFO_MSG(fmt::format("EntityApp::createEntity: new {0} {1}\n", entityType, id));
606606
}
607607

608608
return entity;
609609
}
610610

611611
template<class E>
612-
E* EntityApp<E>::onCreateEntityCommon(PyObject* pyEntity, ScriptDefModule* sm, ENTITY_ID eid)
612+
E* EntityApp<E>::onCreateEntity(PyObject* pyEntity, ScriptDefModule* sm, ENTITY_ID eid)
613613
{
614614
// 执行Entity的构造函数
615615
return new(pyEntity) E(eid, sm);

kbe/src/server/baseapp/baseapp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ Base* Baseapp::onCreateEntityCommon(PyObject* pyEntity, ScriptDefModule* sm, ENT
773773
return new(pyEntity) Proxy(eid, sm);
774774
}
775775

776-
return EntityApp<Base>::onCreateEntityCommon(pyEntity, sm, eid);
776+
return EntityApp<Base>::onCreateEntity(pyEntity, sm, eid);
777777
}
778778

779779
//-------------------------------------------------------------------------------------
@@ -796,7 +796,7 @@ PyObject* Baseapp::__py_createBase(PyObject* self, PyObject* args)
796796
return NULL;
797797
}
798798

799-
PyObject* e = Baseapp::getSingleton().createEntityCommon(entityType, params);
799+
PyObject* e = Baseapp::getSingleton().createEntity(entityType, params);
800800
if(e != NULL)
801801
Py_INCREF(e);
802802

@@ -1012,7 +1012,7 @@ void Baseapp::onCreateBaseFromDBIDCallback(Mercury::Channel* pChannel, KBEngine:
10121012
}
10131013

10141014
PyObject* pyDict = createCellDataDictFromPersistentStream(s, entityType.c_str());
1015-
PyObject* e = Baseapp::getSingleton().createEntityCommon(entityType.c_str(), pyDict, false, entityID);
1015+
PyObject* e = Baseapp::getSingleton().createEntity(entityType.c_str(), pyDict, false, entityID);
10161016
if(e)
10171017
{
10181018
static_cast<Base*>(e)->dbid(dbid);
@@ -1267,7 +1267,7 @@ void Baseapp::createBaseAnywhereFromDBIDOtherBaseapp(Mercury::Channel* pChannel,
12671267
s >> wasActive;
12681268

12691269
PyObject* pyDict = createCellDataDictFromPersistentStream(s, entityType.c_str());
1270-
PyObject* e = Baseapp::getSingleton().createEntityCommon(entityType.c_str(), pyDict, false, entityID);
1270+
PyObject* e = Baseapp::getSingleton().createEntity(entityType.c_str(), pyDict, false, entityID);
12711271
if(e)
12721272
{
12731273
static_cast<Base*>(e)->dbid(dbid);
@@ -1511,7 +1511,7 @@ void Baseapp::onCreateBaseAnywhere(Mercury::Channel* pChannel, MemoryStream& s)
15111511
if(strInitData.size() > 0)
15121512
params = script::Pickler::unpickle(strInitData);
15131513

1514-
Base* base = createEntityCommon(entityType.c_str(), params);
1514+
Base* base = createEntity(entityType.c_str(), params);
15151515
Py_XDECREF(params);
15161516

15171517
if(base == NULL)
@@ -2609,7 +2609,7 @@ void Baseapp::onQueryAccountCBFromDbmgr(Mercury::Channel* pChannel, KBEngine::Me
26092609
return;
26102610
}
26112611

2612-
Proxy* base = static_cast<Proxy*>(createEntityCommon(g_serverConfig.getDBMgr().dbAccountEntityScriptType,
2612+
Proxy* base = static_cast<Proxy*>(createEntity(g_serverConfig.getDBMgr().dbAccountEntityScriptType,
26132613
NULL, false, entityID));
26142614

26152615
Mercury::Channel* pClientChannel = this->networkInterface().findChannel(ptinfos->addr);

kbe/src/server/cellapp/cellapp.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ PyObject* Cellapp::__py_createEntity(PyObject* self, PyObject* args)
403403
}
404404

405405
// 创建entity
406-
Entity* pEntity = Cellapp::getSingleton().createEntityCommon(entityType, params, false, 0);
406+
Entity* pEntity = Cellapp::getSingleton().createEntity(entityType, params, false, 0);
407407

408408
if(pEntity != NULL)
409409
{
@@ -747,7 +747,7 @@ void Cellapp::onCreateInNewSpaceFromBaseapp(Mercury::Channel* pChannel, KBEngine
747747
if(space != NULL)
748748
{
749749
// 创建entity
750-
Entity* e = createEntityCommon(entityType.c_str(), NULL, false, mailboxEntityID, false);
750+
Entity* e = createEntity(entityType.c_str(), NULL, false, mailboxEntityID, false);
751751

752752
if(e == NULL)
753753
{
@@ -820,7 +820,7 @@ void Cellapp::onRestoreSpaceInCellFromBaseapp(Mercury::Channel* pChannel, KBEngi
820820
if(space != NULL)
821821
{
822822
// 创建entity
823-
Entity* e = createEntityCommon(entityType.c_str(), NULL, false, mailboxEntityID, false);
823+
Entity* e = createEntity(entityType.c_str(), NULL, false, mailboxEntityID, false);
824824

825825
if(e == NULL)
826826
{
@@ -983,7 +983,7 @@ void Cellapp::_onCreateCellEntityFromBaseapp(std::string& entityType, ENTITY_ID
983983
PyObject* cellData = NULL;
984984

985985
// 创建entity
986-
Entity* e = createEntityCommon(entityType.c_str(), cellData, false, entityID, false);
986+
Entity* e = createEntity(entityType.c_str(), cellData, false, entityID, false);
987987

988988
if(e == NULL)
989989
{
@@ -1563,7 +1563,7 @@ void Cellapp::reqTeleportToTheCellApp(Mercury::Channel* pChannel, MemoryStream&
15631563
}
15641564

15651565
// 创建entity
1566-
Entity* e = createEntityCommon(EntityDef::findScriptModule(entityType)->getName(), NULL, false, teleportEntityID, false);
1566+
Entity* e = createEntity(EntityDef::findScriptModule(entityType)->getName(), NULL, false, teleportEntityID, false);
15671567
if(e == NULL)
15681568
{
15691569
s.rpos(rpos);

kbe/src/server/cellapp/witness.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ void Witness::createFromStream(KBEngine::MemoryStream& s)
118118
//-------------------------------------------------------------------------------------
119119
void Witness::attach(Entity* pEntity)
120120
{
121-
DEBUG_MSG(fmt::format("Witness::attach: {}({}).\n",
122-
pEntity->scriptName(), pEntity->id()));
121+
//DEBUG_MSG(fmt::format("Witness::attach: {}({}).\n",
122+
// pEntity->scriptName(), pEntity->id()));
123123

124124
pEntity_ = pEntity;
125125

@@ -172,8 +172,8 @@ void Witness::onAttach(Entity* pEntity)
172172
//-------------------------------------------------------------------------------------
173173
void Witness::detach(Entity* pEntity)
174174
{
175-
DEBUG_MSG(fmt::format("Witness::detach: {}({}).\n",
176-
pEntity->scriptName(), pEntity->id()));
175+
//DEBUG_MSG(fmt::format("Witness::detach: {}({}).\n",
176+
// pEntity->scriptName(), pEntity->id()));
177177

178178
EntityMailbox* pClientMB = pEntity_->clientMailbox();
179179
if(pClientMB)
@@ -291,8 +291,8 @@ void Witness::onEnterAOI(Entity* pEntity)
291291
{
292292
if(((*iter)->flags() & ENTITYREF_FLAG_LEAVE_CLIENT_PENDING) > 0)
293293
{
294-
DEBUG_MSG(fmt::format("Witness::onEnterAOI: {} entity={}\n",
295-
pEntity_->id(), pEntity->id()));
294+
//DEBUG_MSG(fmt::format("Witness::onEnterAOI: {} entity={}\n",
295+
// pEntity_->id(), pEntity->id()));
296296

297297
(*iter)->removeflags(ENTITYREF_FLAG_LEAVE_CLIENT_PENDING);
298298
(*iter)->pEntity(pEntity);
@@ -302,8 +302,8 @@ void Witness::onEnterAOI(Entity* pEntity)
302302
return;
303303
}
304304

305-
DEBUG_MSG(fmt::format("Witness::onEnterAOI: {} entity={}\n",
306-
pEntity_->id(), pEntity->id()));
305+
//DEBUG_MSG(fmt::format("Witness::onEnterAOI: {} entity={}\n",
306+
// pEntity_->id(), pEntity->id()));
307307

308308
EntityRef* pEntityRef = new EntityRef(pEntity);
309309
pEntityRef->flags(pEntityRef->flags() | ENTITYREF_FLAG_ENTER_CLIENT_PENDING);
@@ -327,8 +327,8 @@ void Witness::onLeaveAOI(Entity* pEntity)
327327
//-------------------------------------------------------------------------------------
328328
void Witness::_onLeaveAOI(EntityRef* pEntityRef)
329329
{
330-
DEBUG_MSG(fmt::format("Witness::onLeaveAOI: {} entity={}\n",
331-
pEntity_->id(), pEntityRef->id()));
330+
//DEBUG_MSG(fmt::format("Witness::onLeaveAOI: {} entity={}\n",
331+
// pEntity_->id(), pEntityRef->id()));
332332

333333
// 这里不delete, 我们需要待update将此行为更新至客户端时再进行
334334
//delete (*iter);

0 commit comments

Comments
 (0)