//------------------------------------------------------------------------------------- void EntityIDClient::onAlloc(void) { if(getSize() > id_enough_limit) { setReqServerAllocFlag(false); return; } if(hasReqServerAlloc()) return; Mercury::Channel* pChannel = Components::getSingleton().getDbmgrChannel(); if(pChannel == NULL) { ERROR_MSG("EntityIDClient::onAlloc: not found dbmgr!\n"); return; } Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject(); (*pBundle).newMessage(DbmgrInterface::onReqAllocEntityID); DbmgrInterface::onReqAllocEntityIDArgs2::staticAddToBundle((*pBundle), pApp_->componentType(), pApp_->componentID()); (*pBundle).send(pApp_->networkInterface(), pChannel); Mercury::Bundle::ObjPool().reclaimObject(pBundle); setReqServerAllocFlag(true); WARNING_MSG(boost::format("EntityIDClient::onAlloc: not enough(%1%) entityIDs!\n") % id_enough_limit); }
//------------------------------------------------------------------------------------- void EntityIDClient::onAlloc(void) { if(size() > id_enough_limit) { setReqServerAllocFlag(false); return; } if(hasReqServerAlloc()) return; Network::Channel* pChannel = Components::getSingleton().getDbmgrChannel(); if(pChannel == NULL) { ERROR_MSG("EntityIDClient::onAlloc: not found dbmgr!\n"); return; } Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(DbmgrInterface::onReqAllocEntityID); DbmgrInterface::onReqAllocEntityIDArgs2::staticAddToBundle((*pBundle), pApp_->componentType(), pApp_->componentID()); pChannel->send(pBundle); setReqServerAllocFlag(true); WARNING_MSG(fmt::format("EntityIDClient::onAlloc: not enough({}) entityIDs!\n", id_enough_limit)); }