本文整理汇总了C++中LOC函数的典型用法代码示例。如果您正苦于以下问题:C++ LOC函数的具体用法?C++ LOC怎么用?C++ LOC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: raceprefix
const char *racename(const struct locale *loc, const unit * u, const race * rc)
{
const char *prefix = raceprefix(u);
if (prefix != NULL) {
static char lbuf[80];
char *bufp = lbuf;
size_t size = sizeof(lbuf) - 1;
int ch, bytes;
bytes = (int)strlcpy(bufp, LOC(loc, mkname("prefix", prefix)), size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
bytes = (int)strlcpy(bufp, LOC(loc, rc_name(rc, u->number != 1)), size);
assert(~bufp[0] & 0x80 || !"unicode/not implemented");
ch = tolower(*(unsigned char *)bufp);
bufp[0] = (char)ch;
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
*bufp = 0;
return lbuf;
}
return LOC(loc, rc_name(rc, u->number != 1));
}
示例2: LOC
void CPagePlugins::OnLbnSelchangePluginList()
{
CString Info;
int Index = m_PluginList.GetCurSel();
if(Index>=0 && Index<m_Game->m_PluginMgr->m_Plugins.GetSize())
{
CBPlugin* Plugin = m_Game->m_PluginMgr->m_Plugins[Index];
Info = LOC("/str1119/Description:") + CString(" ") + Plugin->m_PluginInfo.Description;
Info += "\r\n";
Info += LOC("/str1120/Version:") + CString(" ") + Plugin->m_PluginInfo.PluginVersion;
Info += "\r\n";
Info += LOC("/str1121/WME version:") + CString(" ") + Plugin->m_PluginInfo.WmeVersion;
Info += "\r\n";
Info += LOC("/str1122/Full path:") + CString(" ") + Plugin->m_DllPath;
Info += "\r\n";
Info += LOC("/str1123/Supported classes:") + CString(" ");
for(int i=0; i<Plugin->m_Classes.GetSize(); i++)
{
Info += CString(Plugin->m_Classes[i]);
if(i < Plugin->m_Classes.GetSize()-1) Info += ", ";
}
}
else Info = "";
m_PluginInfo.SetWindowText(Info);
}
示例3: sizeof
ship *new_ship(const ship_type * stype, region * r, const struct locale *lang)
{
static char buffer[32];
ship *sh = (ship *)calloc(1, sizeof(ship));
const char *sname = 0;
if (!sh) abort();
assert(stype);
sh->no = newcontainerid();
sh->coast = NODIRECTION;
sh->type = stype;
sh->region = r;
if (lang) {
sname = LOC(lang, stype->_name);
if (!sname) {
sname = LOC(lang, parameters[P_SHIP]);
}
}
if (!sname) {
sname = parameters[P_SHIP];
}
assert(sname);
snprintf(buffer, sizeof(buffer), "%s %s", sname, itoa36(sh->no));
sh->name = str_strdup(buffer);
shash(sh);
if (r) {
addlist(&r->ships, sh);
}
return sh;
}
示例4: wxMenu
wxMenu* ApplicationTrayIcon::CreatePopupMenu() {
wxMenu* menu = new wxMenu();
menu->Append(ID_MENU_HideShow, gMainFrame->IsVisible() ? LOC(_T("TrayIcon.Hide")) : LOC(_T("TrayIcon.Show")));
menu->AppendSeparator();
menu->Append(ID_MENU_Exit, LOC(_T("TrayIcon.Close")));
return menu;
}
示例5: ErrorCallback
void CFilterScript::ErrorCallback(int Line, char *Text, void *Data)
{
CFilterScript* _this = (CFilterScript*)Data;
if(_this){
if(_this->m_CurrentFile!="") _this->m_Document->AddInfo(CString(LOC("/str0100/Compiling file")) + " '" + _this->m_CurrentFile + "'...", _this->m_CurrentFile);
CString Error;
Error.Format(CString(LOC("/str0101/Line")) + " %d: %s", Line, Text);
_this->m_Document->AddError(Error, _this->m_CurrentFile);
}
}
示例6: asksave
void asksave(void){
/*
15 21 84 15
****************************************************************
** You haven't save your contact yet, if you still **#
** exit, you may lost all your changes, Sure? **#
****************************************************************#
** 1. Save & Exit ** 2. Main Menu ** 3. Discard Exit ** **#
****************************************************************#
################################################################
20 21
*/
printf(BLUEB); /* set background blue */
FFOUT; /* set display immediately */
CLEARSCR; /* paint display blue */
printf(LOC(15,21)); /* set pointer at 15,21 */
printf(REDB); /* set background red */
print64(28);
printf(LOC(16,21));
print64(25);
printf(LOC(17,21));
print64(26);
printf(LOC(18,21));
print64(28);
printf(LOC(19,21));
print64(27);
printf(LOC(20,21));
print64(28);
printf(LOC(21,21)); /* shadow line */
print64(16);
printf(LOC(15,85));
printf(BLUEB" "); /* fix shadow */
printf(LOC(19,82)); /* Location of enter */
}
示例7: sum_spiral_diags
int sum_spiral_diags(int* spiral) {
int i;
int c = 0;
for(i = 0; i < SIZE; i++) {
c += spiral[LOC(i, i)];
if (i != (SIZE - 1 - i)) {
c += spiral[LOC((SIZE - 1 - i), i)];
}
}
return c;
}
示例8: unused_arg
static const char *b_namefogwall(const connection * b, const region * r,
const struct faction *f, int gflags)
{
unused_arg(f);
unused_arg(b);
unused_arg(r);
if (gflags & GF_PURE)
return "fogwall";
if (gflags & GF_ARTICLE)
return LOC(f->locale, mkname("border", "a_fogwall"));
return LOC(f->locale, mkname("border", "fogwall"));
}
示例9: get_gamedate
static char *gamedate2(const struct locale *lang)
{
static char buf[256];
gamedate gd;
get_gamedate(turn, &gd);
sprintf(buf, "in %s des Monats %s im Jahre %d %s.",
LOC(lang, weeknames2[gd.week]),
LOC(lang, monthnames[gd.month]),
gd.year, agename ? LOC(lang, agename) : "");
return buf;
}
示例10: outputimgyuv
void outputimgyuv(char *fname,unsigned char *img,int ny,int nx)
{
FILE *fimg;
int iy,ix,i,j,imagesize,loc1,loc2,loc3,loc0;
unsigned char *tmp;
rgb2yuv(img,ny*nx*3);
imagesize = ny*nx;
tmp=(unsigned char *)malloc(imagesize*sizeof(unsigned char));
fimg=fopen(fname,"wb");
for (i=0,j=0;i<imagesize;i++,j+=3) tmp[i] = img[j];
fwrite(tmp, sizeof(unsigned char), imagesize, fimg);
i=0;
for (iy=0;iy<ny;iy+=2)
{
for (ix=0;ix<nx;ix+=2)
{
loc0 = LOC(iy,ix,1,nx,3);
loc1 = loc0+3;
loc2 = loc0+3*nx;
loc3 = loc2+3;
tmp[i] = (unsigned char) round2int(( ((float) img[loc0]) +
img[loc1]+img[loc2]+img[loc3]) /4);
i++;
}
}
fwrite(tmp, sizeof(unsigned char), imagesize/4, fimg);
i=0;
for (iy=0;iy<ny;iy+=2)
{
for (ix=0;ix<nx;ix+=2)
{
loc0 = LOC(iy,ix,2,nx,3);
loc1 = loc0+3;
loc2 = loc0+3*nx;
loc3 = loc2+3;
tmp[i] = (unsigned char) round2int(( ((float) img[loc0]) +
img[loc1]+img[loc2]+img[loc3]) /4);
i++;
}
}
fwrite(tmp, sizeof(unsigned char), imagesize/4, fimg);
free(tmp);
fclose (fimg);
}
示例11: inputimgyuv
void inputimgyuv(char *fname,unsigned char *img,int ny,int nx)
{
FILE *fimg;
int iy,ix,i,j,imagesize,loc;
unsigned char *tmp;
imagesize = ny*nx;
tmp=(unsigned char *)malloc(imagesize*sizeof(unsigned char));
fimg=fopen(fname,"rb");
if (!fimg)
{
printf("unable to read %s\n",fname);
exit(-1);
}
fread(tmp, sizeof(unsigned char), imagesize, fimg);
for (i=0,j=0;i<imagesize;i++,j+=3) img[j] = tmp[i];
fread(tmp, sizeof(unsigned char), imagesize/4, fimg);
i = 0;
for (iy=0;iy<ny;iy+=2)
{
for (ix=0;ix<nx;ix+=2)
{
loc = LOC(iy,ix,1,nx,3);
img[loc] = tmp[i]; img[loc+3] = tmp[i];
loc += 3*nx;
img[loc] = tmp[i]; img[loc+3] = tmp[i];
i++;
}
}
fread(tmp, sizeof(unsigned char), imagesize/4, fimg);
i=0;
for (iy=0;iy<ny;iy+=2)
{
for (ix=0;ix<nx;ix+=2)
{
loc = LOC(iy,ix,2,nx,3);
img[loc] = tmp[i]; img[loc+3] = tmp[i];
loc += 3*nx;
img[loc] = tmp[i]; img[loc+3] = tmp[i];
i++;
}
}
free(tmp);
fclose (fimg);
yuv2rgb(img,ny*nx*3);
}
示例12: out_faction
static void out_faction(FILE * file, const struct faction *f)
{
if (alliances != NULL) {
fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
f->name, itoa36(f->no), f_get_alliance(f) ? f->alliance->id : 0,
LOC(default_locale, rc_name(f->race, NAME_SINGULAR)), magic_school[f->magiegebiet],
count_units(f), f->num_total, f->money, turn - f->lastorders);
} else {
fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
factionname(f), LOC(default_locale, rc_name(f->race, NAME_SINGULAR)),
magic_school[f->magiegebiet], count_units(f), f->num_total, f->money,
turn - f->lastorders);
}
}
示例13: plus
void plus(VM* vm, VAL* oldbase) {
INITFRAME;
RESERVE(2);
ADDTOP(2);
switch(TAG(LOC(0))) {
case 0:
PROJECT(vm, LOC(0), 2, 0);
RVAL = LOC(1);
TOPBASE(0);
REBASE;
break;
case 1:
PROJECT(vm, LOC(0), 2, 1);
RESERVE(2);
TOP(0) = LOC(2);
TOP(1) = LOC(1);
STOREOLD;
BASETOP(0);
ADDTOP(2);
CALL(plus);
LOC(3) = RVAL;
RVAL = MKCON(vm, 1, 1, LOC(3));
TOPBASE(0);
REBASE;
break;
}
}
示例14: name_unit
void name_unit(unit * u)
{
if (u_race(u)->generate_name) {
const char *gen_name = u_race(u)->generate_name(u);
if (gen_name) {
unit_setname(u, gen_name);
} else {
unit_setname(u, racename(u->faction->locale, u, u_race(u)));
}
} else {
char name[32];
const char * result;
const struct locale * lang = u->faction ? u->faction->locale : default_locale;
if (lang) {
static const char * prefix[MAXLOCALES];
int i = locale_index(lang);
if (!prefix[i]) {
prefix[i] = LOC(lang, "unitdefault");
if (!prefix[i]) {
prefix[i] = parameters[P_UNIT];
}
}
result = prefix[i];
} else {
result = parameters[P_UNIT];
}
strlcpy(name, result, sizeof(name));
strlcat(name, " ", sizeof(name));
strlcat(name, itoa36(u->no), sizeof(name));
unit_setname(u, name);
}
}
示例15: LOC
const char *rname(const region * r, const struct locale *lang)
{
if (r->land && r->land->name) {
return r->land->name;
}
return LOC(lang, terrain_name(r));
}