• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LOC函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LOC函数的典型用法代码示例。如果您正苦于以下问题:C++ LOC函数的具体用法?C++ LOC怎么用?C++ LOC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LOC函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:TomBraun,项目名称:server,代码行数:26,代码来源:race.c


示例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);
}
开发者ID:segafan,项目名称:wme1_jankavan_tlc_edition-repo,代码行数:26,代码来源:PagePlugins.cpp


示例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;
}
开发者ID:ennorehling,项目名称:eressea,代码行数:31,代码来源:ship.c


示例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;
}
开发者ID:DocWhoChat,项目名称:appetizer,代码行数:9,代码来源:ApplicationTrayIcon.cpp


示例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);
	}
}
开发者ID:segafan,项目名称:wme1_jankavan_tlc_edition-repo,代码行数:10,代码来源:FilterScript.cpp


示例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 */
}
开发者ID:anlory,项目名称:Senior-middle-school,代码行数:34,代码来源:menu.c


示例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;
}
开发者ID:cvpcs,项目名称:project_euler,代码行数:11,代码来源:main.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"));
}
开发者ID:CTD1,项目名称:eressea-server-bugfixing,代码行数:12,代码来源:connection.c


示例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;
}
开发者ID:hochl,项目名称:server,代码行数:12,代码来源:summary.c


示例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);
}
开发者ID:guptask,项目名称:neuron_project_cchmc,代码行数:50,代码来源:ioutil.c


示例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);
}
开发者ID:guptask,项目名称:neuron_project_cchmc,代码行数:50,代码来源:ioutil.c


示例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);
  }
}
开发者ID:hochl,项目名称:server,代码行数:14,代码来源:summary.c


示例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;
    }
}
开发者ID:AshleyMoni,项目名称:Idris-dev,代码行数:28,代码来源:ctest.c


示例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);
  }
}
开发者ID:UweKopf,项目名称:server,代码行数:32,代码来源:unit.c


示例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));
}
开发者ID:Xolgrim,项目名称:server,代码行数:7,代码来源:region.c


示例16: write_stat

void write_stat ( const hydroparam_t H, const TIMINGS T,
                  int nstates, double tmax, double tmin ) {
    
    LOC ( H.rank );

    char name[160];
    FILE* fic;

    sprintf ( name, "stats_%04i.txt", H.rank );

    fic = fopen ( name, "w" );
    
    fprintf ( fic, "stats\n" );
    fprintf ( fic, "nsteps: %ld\n", H.nstep );
    fprintf ( fic, "nstates_written: %ld\n", nstates );

    fprintf ( fic, "tot_time: %e\n", T.MP[3] - T.MP[0] );
    fprintf ( fic, "init_time: %e\n", T.MP[1] - T.MP[0]);
    fprintf ( fic, "tot_loop_time: %e\n", T.MP[2] - T.MP[1]);
    fprintf ( fic, "outro_time: %e\n", T.MP[3] - T.MP[2]);

    fprintf ( fic, "wall_time: %e\n", T.MP[2] - T.MP[0]);
    fprintf ( fic, "global_min_wall_time: %e\n", tmin );
    fprintf ( fic, "global_max_wall_time: %e\n", tmax );

    fclose ( fic );
}
开发者ID:RafiKueng,项目名称:HPC_HYDRO,代码行数:27,代码来源:vtkfile.c


示例17: switch

static order *monster_move(region * r, unit * u)
{
    direction_t d = NODIRECTION;

    if (monster_is_waiting(u)) {
        return NULL;
    }
    switch (old_race(u_race(u))) {
    case RC_FIREDRAGON:
    case RC_DRAGON:
    case RC_WYRM:
        d = richest_neighbour(r, u->faction, 1);
        break;
    case RC_TREEMAN:
        d = treeman_neighbour(r);
        break;
    default:
        d = random_neighbour(r, u);
        break;
    }

    /* falls kein geld gefunden wird, zufaellig verreisen, aber nicht in
     * den ozean */

    if (d == NODIRECTION)
        return NULL;

    reduce_weight(u);
    return create_order(K_MOVE, u->faction->locale, "%s",
        LOC(u->faction->locale, directions[d]));
}
开发者ID:philbooth,项目名称:server,代码行数:31,代码来源:monsters.c


示例18: while

/* Find the building type for a given localized name (as seen by the user). Useful for parsing
 * orders. The inverse of locale_string(lang, btype->_name), sort of. */
const building_type *findbuildingtype(const char *name,
    const struct locale *lang)
{
    variant type;
    local_names *bn = bnames;

    while (bn) {
        if (bn->lang == lang)
            break;
        bn = bn->next;
    }
    if (!bn) {
        quicklist *ql = buildingtypes;
        int qi;

        bn = (local_names *)calloc(sizeof(local_names), 1);
        bn->next = bnames;
        bn->lang = lang;

        for (qi = 0, ql = buildingtypes; ql; ql_advance(&ql, &qi, 1)) {
            building_type *btype = (building_type *)ql_get(ql, qi);

            const char *n = LOC(lang, btype->_name);
            type.v = (void *)btype;
            addtoken(&bn->names, n, type);
        }
        bnames = bn;
    }
    if (findtoken(bn->names, name, &type) == E_TOK_NOMATCH)
        return NULL;
    return (const building_type *)type.v;
}
开发者ID:CTD1,项目名称:eressea-server-bugfixing,代码行数:34,代码来源:building.c


示例19: vgaterm_draw_scrollback

static void vgaterm_draw_scrollback() {
    for (int y = 0; y < ROWS; y++) {
        uint16_t row = scrollback_start + (scrollback_top + y) * COLS;
        if (row >= scrollback_lines * COLS) row -= scrollback_lines * COLS;
        for (int x = 0; x < COLS; x++) {
            LOC(x, y) = COLOR | *(vga_scrollback_buffer + row + x);
        }
    }

    if (scrolling) {
        // draw a scrollbar.
        SPUTC(SCROLLBAR_X, EDGE_L);
        // buffer is [0, scrollback_max + ROWS). display port is [scrollback_top, scrollback_top + ROWS).
        float bottom = scrollback_max + ROWS;
        float start = (float) scrollback_top / bottom, end = (float) (scrollback_top + ROWS) / bottom;
        for (int x = 0; x < SCROLLBAR_WIDTH; x++) {
            float left = (float) x / (float) SCROLLBAR_WIDTH;
            float middle = ((float) x + 0.5) / (float) SCROLLBAR_WIDTH;
            float right = ((float) x + 1.0) / (float) SCROLLBAR_WIDTH;
            bool left_on = left >= start && middle < end;
            bool right_on = middle >= start && right < end;
            SPUTC(SCROLLBAR_X + x + 1, left_on ? (right_on ? BLOCK_LR : BLOCK_L) : (right_on ? BLOCK_R : ' '));
        }
        SPUTC(SCROLLBAR_X + SCROLLBAR_WIDTH + 1, EDGE_R);
    } else {
        for (int x = 0; x < SCROLLBAR_WIDTH + 2; x++) SPUTC(SCROLLBAR_X + x, ' ');
        STATUS_DISPLAY(SCROLLBAR_X, "Use \x19\x18 for scrollback");
    }
}
开发者ID:robey,项目名称:funos,代码行数:29,代码来源:vgaterm.c


示例20: summarize_races

static void summarize_races(const summary *s, FILE *F, bool full) {
    int i;
    for (i = 0; i < MAXRACES; i++) {
        if (s->poprace[i] > 0) {
            const char *pad = "      ";
            int lpad = (int)strlen(pad);
            const race *rc = get_race(i);
            const char *rcname = LOC(default_locale, rc_name_s(rc, NAME_PLURAL));
            lpad -= count_umlaut(rcname);
            assert(lpad >= 0);
            if (full) {
                fputs(pad + lpad, F);
                fprintf(F, "%20s: ", rcname);
                fprintf(F, "%8d\n", s->poprace[i]);
            }
            else if (i != RC_TEMPLATE && i != RC_CLONE) {
                if (playerrace(rc)) {
                    fputs(pad + lpad, F);
                    fprintf(F, "%16s: ", rcname);
                    fprintf(F, "%8d\n", s->poprace[i]);
                }
            }
        }
    }
}
开发者ID:ennorehling,项目名称:eressea,代码行数:25,代码来源:summary.c



注:本文中的LOC函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOCAL函数代码示例发布时间:2022-05-30
下一篇:
C++ LOBYTE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap