本文整理汇总了C++中entity函数的典型用法代码示例。如果您正苦于以下问题:C++ entity函数的具体用法?C++ entity怎么用?C++ entity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了entity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: funserv_cmd_requestbot
static void funserv_cmd_requestbot(sourceinfo_t *si, int parc, char *parv[])
{
char *name = parv[0];
mychan_t *mc;
if (!name)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "REQUESTBOT");
command_fail(si, fault_needmoreparams, _("Syntax: REQUESTBOT <#channel>"));
}
if (*name != '#')
{
command_fail(si, fault_needmoreparams, STR_INVALID_PARAMS, "REQUESTBOT");
command_fail(si, fault_needmoreparams, _("Syntax: REQUESTBOT <#channel>"));
}
if (!(mc = mychan_find(name)))
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), name);
return;
}
if (!is_founder(mc, entity(si->smu)))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
return;
}
myuser_notice(funserv->nick, myuser_find_ext(BOTNAME), "JOIN %s", name);
command_success_nodata(si, "The bot should now be in %s.", name);
}
示例2: entity
bool SearchTreeNode::UnSerializeString(const wxString& s,wxString& result)
{
result.Clear();
size_t i;
int mode = 0;
wxString entity(_T(""));
unsigned int u;
for (i = 0;mode >=0 && i<s.length();i++)
{
wxChar ch = s[i];
if (ch==_T('"') || ch==_T('>') || ch==_T('<'))
{
mode = -1; // Error
break;
}
switch(mode)
{
case 0: // normal
if (ch==_T('&'))
{
mode = 1;
entity.Clear();
}
else
result << ch;
case 1: // escaped
if (ch==_T('&'))
{
mode = -1; // Error
break;
}
else if (ch==_T(';'))
{
mode = 0;
if (entity==_T("quot"))
ch = _T('"');
else if (entity==_T("amp"))
ch = _T('&');
else if (entity==_T("apos"))
ch = _T('\'');
else if (entity==_T("lt"))
ch = _T('<');
else if (entity==_T("gt"))
ch = _T('>');
else if (entity[0]==_T('#') && S2U(entity.substr(1),u))
ch = u;
else
{
mode = -1; // Error: Unrecognized entity
break;
}
result << ch;
}
break;
}
}
if (mode < 0)
result.Clear();
return (mode >= 0);
}
示例3: entity
//------------------------------------------------------------------------------
void ParticleSystem::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
#ifdef ZN_DEBUG
if(r_texture == nullptr)
log.err() << "ParticleSystem::draw: no atlas defined !" << log.endl();
#endif
// apply texture
states.texture = r_texture;
AbstractTransform * t = entity().transform();
if(t && t->matrix())
{
states.transform = *(t->matrix());
}
// draw the vertex array
target.draw(m_vertices, states);
// Test debug
// sf::RectangleShape s(sf::Vector2f(32,32));
// for(u32 i = 0; i < m_particles.size(); ++i)
// {
// s.setPosition(m_particles[i].pos);
// target.draw(s);
// }
}
示例4: check_hidehost
static void check_hidehost(user_t *u)
{
static bool warned = false;
char buf[HOSTLEN + 1];
/* do they qualify? */
if (!(u->flags & UF_HIDEHOSTREQ) || u->myuser == NULL || (u->myuser->flags & MU_WAITAUTH))
return;
/* don't use this if they have some other kind of vhost */
if (strcmp(u->host, u->vhost))
{
slog(LG_DEBUG, "check_hidehost(): +x overruled by other vhost for %s", u->nick);
return;
}
if (me.hidehostsuffix == NULL)
{
if (!warned)
{
wallops("Misconfiguration: serverinfo::hidehostsuffix not set");
warned = true;
}
return;
}
snprintf(buf, sizeof buf, "%s.%s", entity(u->myuser)->name, me.hidehostsuffix);
strshare_unref(u->vhost);
u->vhost = strshare_get(buf);
slog(LG_DEBUG, "check_hidehost(): %s -> %s", u->nick, u->vhost);
}
示例5: entity
Entity EntityManager::CreateEntity(
std::vector<std::shared_ptr<ComponentCreatorBase>> && componentCreators)
{
Entity entity(&context, context.Create(std::move(componentCreators)));
entities.push_back(entity.GetID());
return std::move(entity);
}
示例6: TEST
TEST( EntityHandlerTest, AddAndRemoveComponentsDynamic )
{
SystemHandler system;
EntityHandler entity( &system );
Entity ent1 = entity.CreateEntity();
Entity ent2 = entity.CreateEntity();
entity.AddComponentsAspect( ent1, 1ULL << 1 | 1ULL << 2 );
entity.AddComponentsAspect( ent2, 1ULL << 0 | 1ULL << 2 );
ASSERT_EQ( (Aspect)(entity.GenerateAspect<Component2,Component3>()), entity.GetEntityAspect( ent1 ) );
ASSERT_EQ( (Aspect)(1ULL << 0 | 1ULL << 2), entity.GetEntityAspect( ent2 ) );
entity.RemoveComponentsAspect( ent1, 1ULL << 1 );
entity.RemoveComponentsAspect( ent2, 1ULL << 2 );
ASSERT_EQ( (Aspect)(entity.GenerateAspect<Component3>()), entity.GetEntityAspect( ent1 ) );
ASSERT_EQ( (Aspect)(1ULL << 0), entity.GetEntityAspect( ent2 ) );
entity.RemoveComponentsAspect( ent1, 1ULL << 2 );
entity.RemoveComponentsAspect( ent2, 1ULL << 0 );
ASSERT_EQ( (Aspect)(0ULL), entity.GetEntityAspect( ent1 ) );
ASSERT_EQ( (Aspect)(0ULL), entity.GetEntityAspect( ent2 ) );
}
示例7: show_setpass
static void show_setpass(hook_user_req_t *hdata)
{
if (has_priv(hdata->si, PRIV_USER_AUSPEX))
{
if (get_setpass_key(hdata->mu) != NULL)
{
metadata_t *md;
char strfbuf[BUFSIZE];
char buf[BUFSIZE];
size_t buflen = 0;
buf[0] = '\0';
if ((md = metadata_find(hdata->mu, "private:sendpass:sender")) != NULL)
buflen += snprintf(buf + buflen, sizeof(buf) - buflen, " by %s", md->value);
if ((md = metadata_find(hdata->mu, "private:sendpass:timestamp")) != NULL)
{
time_t ts;
struct tm tm;
ts = atoi(md->value);
tm = *localtime(&ts);
strftime(strfbuf, sizeof strfbuf, TIME_FORMAT, &tm);
buflen += snprintf(buf + buflen, sizeof(buf) - buflen, " on %s (%s ago)", strfbuf, time_ago(ts));
}
if (buf[0] != '\0')
command_success_nodata(hdata->si, _("%s has an active \2SETPASS\2 key (sent%s)"), entity(hdata->mu)->name, buf);
else
command_success_nodata(hdata->si, _("%s has an active \2SETPASS\2 key"), entity(hdata->mu)->name);
}
}
}
示例8: entity
ApplicationVersion ApplicationVersionRepository::findOneByFields(
Texsample::ClientType clienType, BeQt::OSType os, BeQt::ProcessorArchitecture arch, bool portable, bool *ok)
{
ApplicationVersion entity(this);
if (!isValid() || Texsample::UnknownClient == clienType || BeQt::UnknownOS == os
|| BeQt::UnknownArchitecture == arch) {
return bRet(ok, false, entity);
}
QString ws = "client_type = :client_type AND os_type = :os_type AND portable = :portable "
"AND processor_architecture_type = :processor_architecture_type";
QVariantMap values;
values.insert(":client_type", int(clienType));
values.insert(":os_type", int(os));
values.insert(":portable", int(portable));
values.insert(":processor_architecture_type", int(arch));
BSqlResult result = Source->select("application_versions", QStringList() << "download_url" << "version",
BSqlWhere(ws, values));
if (!result.success())
return bRet(ok, false, entity);
if (result.values().isEmpty())
return bRet(ok, true, entity);
entity.mclienType = clienType;
entity.mdownloadUrl = QUrl(result.value("download_url").toString());
entity.mos = os;
entity.mportable = portable;
entity.mprocessorArchitecture = arch;
entity.mversion = BVersion(result.value("version").toString());
entity.valid = true;
return bRet(ok, true, entity);
}
示例9: if
entity table::getEntityWith(vector<attribute> primary_key){
for(unsigned int i = 0; i < entity_list.size(); i++){
entity current_entity = entity_list[i];
bool check = false;
for(unsigned int j = 0; j < primary_keys.size(); j++){
int key = primary_keys[j];
attribute attr = current_entity.getAttribute(key);
if(column_types[key] == INTEGER){
check = (attr.get_int_value() == primary_key[j].get_int_value());
}
else if(column_types[key] == STRING){
check = (attr.get_string_value() == primary_key[j].get_string_value());
}
if(!check){ break; }
}
if(check){
return current_entity;
}
}
return entity();
}
示例10: makeShared
EntityPtr EntityFactory::createTexturedEntity(const string& assetTag, float tx, float ty, float w, float h) {
EntitySystemPtr entitySystem = makeShared(mSystemManager->getSystemByType<EntitySystem>(SystemType::ENTITY));
EntityPtr entity(GCC_NEW Entity());
entitySystem->addEntity(entity);
PhysicsSystemPtr physicsSystem = makeShared(mSystemManager->getSystemByType<PhysicsSystem>(SystemType::PHYSICS));
BodyPtr blockBody(GCC_NEW Body(0.0f, 0.0f, w, h));
physicsSystem->registerBody(entity->id, blockBody);
PhysicsComponentPtr physicsComponent(GCC_NEW PhysicsComponent(entity->id, blockBody));
GraphicsSystemPtr graphicsSystem = makeShared(mSystemManager->getSystemByType<GraphicsSystem>(SystemType::GRAPHICS));
TexturePtr texture(GCC_NEW Texture(assetTag, tx, ty, w, h));
DrawablePtr textureDrawable(GCC_NEW TextureDrawable(texture));
graphicsSystem->registerDrawable(entity->id, textureDrawable);
DrawableComponentPtr drawableComponent(GCC_NEW DrawableComponent(entity->id, textureDrawable));
InputSystemPtr inputSystem = makeShared(mSystemManager->getSystemByType<InputSystem>(SystemType::INPUT));
InputListenerPtr inputListener(GCC_NEW InputListener(entity->id));
inputSystem->registerEventListener(inputListener);
InputComponentPtr inputComponent(GCC_NEW InputComponent(entity->id, inputListener));
entity->addComponent(ComponentPtr(physicsComponent));
entity->addComponent(ComponentPtr(drawableComponent));
entity->addComponent(ComponentPtr(inputComponent));
return entity;
}
示例11: gs_cmd_fdrop
static void gs_cmd_fdrop(sourceinfo_t *si, int parc, char *parv[])
{
mygroup_t *mg;
char *name = parv[0];
if (!name)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "DROP");
command_fail(si, fault_needmoreparams, _("Syntax: DROP <!group>"));
return;
}
if (*name != '!')
{
command_fail(si, fault_badparams, STR_INVALID_PARAMS, "DROP");
command_fail(si, fault_badparams, _("Syntax: DROP <!group>"));
return;
}
if (!(mg = mygroup_find(name)))
{
command_fail(si, fault_nosuch_target, _("Group \2%s\2 does not exist."), name);
return;
}
remove_group_chanacs(mg);
logcommand(si, CMDLOG_ADMIN | LG_REGISTER, "FDROP: \2%s\2", entity(mg)->name);
wallops("%s dropped the group \2%s\2", get_oper_name(si), name);
object_unref(mg);
command_success_nodata(si, _("The group \2%s\2 has been dropped."), name);
return;
}
示例12: onLoad
bool onLoad()
{
// Create the off-screen surface
if (!m_surface.create(800, 600))
return false;
m_surface.setSmooth(true);
// Load the textures
if (!m_backgroundTexture.loadFromFile("resources/sfml.png"))
return false;
m_backgroundTexture.setSmooth(true);
if (!m_entityTexture.loadFromFile("resources/devices.png"))
return false;
m_entityTexture.setSmooth(true);
// Initialize the background sprite
m_backgroundSprite.setTexture(m_backgroundTexture);
m_backgroundSprite.setPosition(135, 100);
// Load the moving entities
for (int i = 0; i < 6; ++i)
{
sf::Sprite entity(m_entityTexture, sf::IntRect(96 * i, 0, 96, 96));
m_entities.push_back(entity);
}
// Load the shader
if (!m_shader.loadFromFile("resources/edge.frag", sf::Shader::Fragment))
return false;
m_shader.setParameter("texture", sf::Shader::CurrentTexture);
return true;
}
示例13: EntityReference_Set_EntityPtr
static duk_ret_t EntityReference_Set_EntityPtr(duk_context* ctx)
{
EntityReference* thisObj = GetThisValueObject<EntityReference>(ctx, EntityReference_ID);
SharedPtr<Entity> entity(GetWeakObject<Entity>(ctx, 0));
thisObj->Set(entity);
return 0;
}
示例14: entity
void
SnatchComponent::update(TIME)
{
if (m_registered)
return;
if (!m_layer) {
Game::WeakSceneLayer l_layer = entity().layer().scene().getLayerType("SnatcherLayer");
m_layer = l_layer.cast<SnatcherLayer>();
}
if (m_layer) {
m_layer->registerEntity(entity());
m_registered = true;
}
}
示例15: check_forward
/* ircd allows forwards to existing channels; the target channel must be
* +F or the setter must have ops in it */
static bool check_forward(const char *value, channel_t *c, mychan_t *mc, user_t *u, myuser_t *mu)
{
channel_t *target_c;
mychan_t *target_mc;
chanuser_t *target_cu;
if (!VALID_GLOBAL_CHANNEL_PFX(value) || strlen(value) > 50)
return false;
if (u == NULL && mu == NULL)
return true;
target_c = channel_find(value);
target_mc = mychan_from(target_c);
if (target_c == NULL && target_mc == NULL)
return false;
if (target_c != NULL && target_c->modes & CMODE_FTARGET)
return true;
if (target_mc != NULL && target_mc->mlock_on & CMODE_FTARGET)
return true;
if (u != NULL)
{
target_cu = chanuser_find(target_c, u);
if (target_cu != NULL && target_cu->modes & CSTATUS_OP)
return true;
if (chanacs_user_flags(target_mc, u) & CA_SET)
return true;
}
else if (mu != NULL)
if (chanacs_entity_has_flag(target_mc, entity(mu), CA_SET))
return true;
return false;
}