本文整理汇总了C++中hashtable::access方法的典型用法代码示例。如果您正苦于以下问题:C++ hashtable::access方法的具体用法?C++ hashtable::access怎么用?C++ hashtable::access使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hashtable
的用法示例。
在下文中一共展示了hashtable::access方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
model *loadmodel(const char *name, int i)
{
if(!name)
{
if(!mapmodels.inrange(i)) return NULL;
mapmodelinfo &mmi = mapmodels[i];
if(mmi.m) return mmi.m;
name = mmi.name;
};
model **mm = mdllookup.access(name);
model *m;
if(mm) m = *mm;
else
{
m = new md2(name);
loadingmodel = m;
if(!m->load())
{
delete m;
m = new md3(name);
loadingmodel = m;
if(!m->load())
{
delete m;
loadingmodel = NULL;
return NULL;
};
};
loadingmodel = NULL;
mdllookup.access(m->name(), &m);
};
if(mapmodels.inrange(i) && !mapmodels[i].m) mapmodels[i].m = m;
return m;
};
示例2: delmenu
void delmenu(const char *name)
{
if (!name) return;
gmenu *m = menus.access(name);
if (!m) return;
else menureset(m);
}
示例3: newfont
void newfont(char *name, char *tex, int *defaultw, int *defaulth, int *offsetx, int *offsety, int *offsetw, int *offseth)
{
if(*defaulth < 10) return; // (becomes FONTH)
Texture *_tex = textureload(tex);
if(_tex == notexture || !_tex->xs || !_tex->ys) return;
font *f = fonts.access(name);
if(!f)
{
name = newstring(name);
f = &fonts[name];
f->name = name;
}
f->tex = _tex;
f->chars.shrink(0);
f->defaultw = *defaultw;
f->defaulth = *defaulth;
f->offsetx = *offsetx;
f->offsety = *offsety;
f->offsetw = *offsetw;
f->offseth = *offseth;
f->skip = 33;
fontdef = f;
}
示例4: closemenu
void closemenu(const char *name)
{
gmenu *m;
if(!name)
{
if(curmenu) curmenu->close();
while(!menustack.empty())
{
m = menustack.pop();
if(m) m->close();
}
curmenu = NULL;
return;
}
m = menus.access(name);
if(!m) return;
if(curmenu==m) menuset(menustack.empty() ? NULL : menustack.pop(), false);
else loopv(menustack)
{
if(menustack[i]==m)
{
menustack.remove(i);
return;
}
}
}
示例5: setfont
bool setfont(const char *name)
{
font *f = fonts.access(name);
if(!f) return false;
curfont = f;
return true;
}
示例6: findnormal
void findnormal(const vec &key, const vec &surface, vec &v)
{
const nval *val = normalgroups.access(key);
if(!val) { v = surface; return; }
v = vec(0, 0, 0);
int total = 0;
if(surface.x >= lerpthreshold) { int n = (val->flat>>4)&0xF; v.x += n; total += n; }
示例7: newgui
void newgui(char *name, char *contents)
{
if(guis.access(name))
{
delete[] guis[name];
guis[name] = newstring(contents);
}
else guis[newstring(name)] = newstring(contents);
};
示例8: chmenumdl
void chmenumdl(char *menu, char *mdl, char *anim, int *rotspeed, int *scale)
{
if(!menu || !menus.access(menu)) return;
gmenu &m = menus[menu];
DELETEA(m.mdl);
if(!mdl ||!*mdl) return;
m.mdl = newstring(mdl);
m.anim = findanim(anim)|ANIM_LOOP;
m.rotspeed = clamp(*rotspeed, 0, 100);
m.scale = clamp(*scale, 0, 100);
}
示例9: gui
void gui(g3d_gui &g, bool firstpass)
{
if(guistack.empty()) return;
char *name = guistack.last();
char **contents = guis.access(name);
if(!contents) return;
cgui = &g;
cgui->start(menustart, 0.03f, &menutab);
guitab(name);
execute(*contents);
cgui->end();
cgui = NULL;
};
示例10: destroyvbo
void destroyvbo(GLuint vbo)
{
vboinfo *exists = vbos.access(vbo);
if(!exists) return;
vboinfo &vbi = *exists;
if(vbi.uses <= 0) return;
vbi.uses--;
if(!vbi.uses)
{
glDeleteBuffers_(1, &vbo);
if(vbi.data) delete[] vbi.data;
vbos.remove(vbo);
}
}
示例11: setfont
bool setfont(const char *name)
{
font *f = fonts.access(name);
if(!f) return false;
int v = -1;
if(strcmp(name, "default")==0)
v = 0;
else if(strcmp(name, "serif")==0)
v = 1;
else if(strcmp(name, "mono")==0)
v = 2;
if(v!=-1) __fontsetting = v;
curfont = f;
return true;
}
示例12: addauth
void addauth(char *name, char *flags, char *pubkey, char *email)
{
string authname;
if(filterstring(authname, name, true, true, true, true, 100)) name = authname;
if(authusers.access(name))
{
conoutf("auth handle '%s' already exists, skipping (%s)", name, email);
return;
}
name = newstring(name);
authuser &u = authusers[name];
u.name = name;
u.flags = newstring(flags);
u.pubkey = parsepubkey(pubkey);
u.email = newstring(email);
}
示例13: showgui
void showgui(char *name)
{
int pos = guistack.find(name);
if(pos<0)
{
if(!guis.access(name)) return;
if(guistack.empty()) menupos = menuinfrontofplayer();
guistack.add(newstring(name));
}
else
{
pos = guistack.length()-pos-1;
loopi(pos) delete[] guistack.pop();
};
menutab = 1;
menustart = lastmillis;
};
示例14: showmenu
void showmenu(const char *name, bool top)
{
if(!name)
{
curmenu = NULL;
return;
}
gmenu *m = menus.access(name);
if(!m) return;
if(!top && curmenu)
{
if(curmenu==m) return;
loopv(menustack) if(menustack[i]==m) return;
menustack.insert(0, m);
return;
}
menuset(m);
}
示例15: newfont
void newfont(char *name, char *tex, int *defaultw, int *defaulth, int *offsetx, int *offsety, int *offsetw, int *offseth)
{
font *f = fonts.access(name);
if(!f)
{
name = newstring(name);
f = &fonts[name];
f->name = name;
}
f->tex = textureload(tex);
f->chars.setsize(0);
f->defaultw = *defaultw;
f->defaulth = *defaulth;
f->offsetx = *offsetx;
f->offsety = *offsety;
f->offsetw = *offsetw;
f->offseth = *offseth;
fontdef = f;
}