Esempio n. 1
0
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));
}
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);
}
Esempio n. 3
0
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;
}
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;
}
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);
	}
}
Esempio n. 6
0
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 */
}
Esempio n. 7
0
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;
}
Esempio n. 8
0
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"));
}
Esempio n. 9
0
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;
}
Esempio n. 10
0
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);
}
Esempio n. 11
0
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);
}
Esempio n. 12
0
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);
  }
}
Esempio n. 13
0
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;
    }
}
Esempio n. 14
0
static const char *b_nameillusionwall(const connection * b, const region * r,
    const struct faction *f, int gflags)
{
    int fno = b->data.i;
    unused_arg(b);
    unused_arg(r);
    if (gflags & GF_PURE)
        return (f && fno == f->no) ? "illusionwall" : "wall";
    if (gflags & GF_ARTICLE) {
        return LOC(f->locale, mkname("border", (f
            && fno == f->subscription) ? "an_illusionwall" : "a_wall"));
    }
    return LOC(f->locale, mkname("border", (f
        && fno == f->no) ? "illusionwall" : "wall"));
}
Esempio n. 15
0
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);
  }
}
Esempio n. 16
0
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));
}
Esempio n. 17
0
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 );
}
Esempio n. 18
0
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]));
}
Esempio n. 19
0
/* 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;
}
Esempio n. 20
0
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");
    }
}
Esempio n. 21
0
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]);
                }
            }
        }
    }
}
Esempio n. 22
0
const ship_type *findshiptype(const char *name, const struct locale *lang)
{
    local_names *sn = snames;
    variant var;

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

        sn = (local_names *)calloc(sizeof(local_names), 1);
        sn->next = snames;
        sn->lang = lang;

        for (qi = 0, ql = shiptypes; ql; ql_advance(&ql, &qi, 1)) {
            ship_type *stype = (ship_type *)ql_get(ql, qi);
            variant var2;
            const char *n = LOC(lang, stype->_name);
            var2.v = (void *)stype;
            addtoken(&sn->names, n, var2);
        }
        snames = sn;
    }
    if (findtoken(sn->names, name, &var) == E_TOK_NOMATCH)
        return NULL;
    return (const ship_type *)var.v;
}
Esempio n. 23
0
static const char *b_namequestportal(const connection * b, const region * r,
    const struct faction *f, int gflags)
{
    const char *bname;
    int lock = b->data.i;
    unused_arg(b);
    unused_arg(r);

    if (gflags & GF_ARTICLE) {
        if (lock > 0) {
            bname = "a_gate_locked";
        }
        else {
            bname = "a_gate_open";
        }
    }
    else {
        if (lock > 0) {
            bname = "gate_locked";
        }
        else {
            bname = "gate_open";
        }
    }
    if (gflags & GF_PURE)
        return bname;
    return LOC(f->locale, mkname("border", bname));
}
Esempio n. 24
0
const ship_type *findshiptype(const char *name, const struct locale *lang)
{
    local_names *sn = snames;
    variant var;

    while (sn && sn->lang != lang) {
        sn = sn->next;
    }
    if (!sn) {
        selist *ql;
        int qi;

        sn = (local_names *)calloc(1, sizeof(local_names));
        if (!sn) abort();
        sn->next = snames;
        sn->lang = lang;

        for (qi = 0, ql = shiptypes; ql; selist_advance(&ql, &qi, 1)) {
            ship_type *stype = (ship_type *)selist_get(ql, qi);
            variant var2;
            const char *n = LOC(lang, stype->_name);
            var2.v = (void *)stype;
            addtoken((struct tnode **)&sn->names, n, var2);
        }
        snames = sn;
    }
    if (findtoken(sn->names, name, &var) == E_TOK_NOMATCH)
        return NULL;
    return (const ship_type *)var.v;
}
Esempio n. 25
0
static void
do_gen(circuitstruct * wp)
{
	int         i, j, k;
	unsigned char *z;
	int         count;

#define LOC(X, Y) (*(wp->oldcells + (X) + ((Y) * wp->bncols)))
#define ADD(X, Y) if (LOC((X), (Y)) == HEAD) count++

	for (j = wp->minrow; j <= wp->maxrow; j++) {
		for (i = wp->mincol; i <= wp->maxcol; i++) {
			z = wp->newcells + i + j * wp->bncols;
			switch (LOC(i, j)) {
				case SPACE:
					*z = SPACE;
					break;
				case TAIL:
					*z = WIRE;
					break;
				case HEAD:
					*z = TAIL;
					break;
				case WIRE:
					count = 0;
					for (k = 0; k < wp->neighbors; k++) {
						int         newi = i, newj = j;

						positionOfNeighbor(wp, k * ANGLES / wp->neighbors, &newi, &newj);
						ADD(newi, newj);
					}
					if (count == 1 || count == 2)
						*z = HEAD;
					else
						*z = WIRE;
					break;
				default:
					{
						(void) fprintf(stderr,
							       "bad internal character %d at %d,%d\n",
						      (int) LOC(i, j), i, j);
					}
			}
		}
	}
}
void CMainFrame::OnToolsOptions() 
{
	CPropSheetEx dlgPropertySheet(LOC("/str0107/Shared tools settings"));
	CPageGeneral PageGeneral;

	dlgPropertySheet.AddPage(&PageGeneral);
	dlgPropertySheet.DoModal();	
}
bool CViewProps::OnButtonSaveLoad(CButton* Button, CPLPropertyEditEx *Prop, CPLCategory *Cat)
{
	if(!m_View) return false;
	CProjectDoc* Doc = m_View->GetDocument();
	if(!Doc || !Doc->Game) return false;

	CSaveLoadDlg dlg;
	dlg.m_SaveX = Doc->m_Settings->m_EdGame->m_SaveImageX;
	dlg.m_SaveY = Doc->m_Settings->m_EdGame->m_SaveImageY;

	dlg.m_LoadX = Doc->m_Settings->m_EdGame->m_LoadImageX;
	dlg.m_LoadY = Doc->m_Settings->m_EdGame->m_LoadImageY;

	if(Doc->m_Settings->m_EdGame->m_SaveImageName) dlg.m_SaveFile = Doc->m_Settings->m_EdGame->m_SaveImageName;
	if(Doc->m_Settings->m_EdGame->m_LoadImageName) dlg.m_LoadFile = Doc->m_Settings->m_EdGame->m_LoadImageName;

	dlg.Game = Doc->Game;

	if(dlg.DoModal()==IDOK){
		Doc->m_Settings->m_EdGame->m_SaveImageX = dlg.m_SaveX;
		Doc->m_Settings->m_EdGame->m_SaveImageY = dlg.m_SaveY;

		Doc->m_Settings->m_EdGame->m_LoadImageX = dlg.m_LoadX;
		Doc->m_Settings->m_EdGame->m_LoadImageY = dlg.m_LoadY;

		if(dlg.m_SaveFile.Trim()!="") CBUtils::SetString(&Doc->m_Settings->m_EdGame->m_SaveImageName, (char*)LPCSTR(dlg.m_SaveFile.Trim()));
		else SAFE_DELETE_ARRAY(Doc->m_Settings->m_EdGame->m_SaveImageName);

		if(dlg.m_LoadFile.Trim()!="") CBUtils::SetString(&Doc->m_Settings->m_EdGame->m_LoadImageName, (char*)LPCSTR(dlg.m_LoadFile.Trim()));
		else SAFE_DELETE_ARRAY(Doc->m_Settings->m_EdGame->m_LoadImageName);


		CString str;
		if(Doc->m_Settings->m_EdGame->m_SaveImageName || Doc->m_Settings->m_EdGame->m_LoadImageName)
			str = LOC("/str1105/<set>");
		else
			str = LOC("/str1106/<not set>");

		Prop->SetValue(str);
		m_PropList.Redraw();
		Doc->SetModifiedFlag(TRUE);
	}

	return false;
}
Esempio n. 28
0
static const char *b_nameroad(const connection * b, const region * r,
  const struct faction *f, int gflags)
{
  region *r2 = (r == b->to) ? b->from : b->to;
  int local = (r == b->from) ? b->data.sa[0] : b->data.sa[1];
  static char buffer[64];

  unused_arg(f);
  if (gflags & GF_PURE)
    return "road";
  if (gflags & GF_ARTICLE) {
    if (!(gflags & GF_DETAILED))
      return LOC(f->locale, mkname("border", "a_road"));
    else if (r->terrain->max_road <= local) {
      int remote = (r2 == b->from) ? b->data.sa[0] : b->data.sa[1];
      if (r2->terrain->max_road <= remote) {
        return LOC(f->locale, mkname("border", "a_road"));
      } else {
        return LOC(f->locale, mkname("border", "an_incomplete_road"));
      }
    } else {
      int percent = _max(1, 100 * local / r->terrain->max_road);
      if (local) {
        slprintf(buffer, sizeof(buffer), LOC(f->locale, mkname("border",
              "a_road_percent")), percent);
      } else {
        return LOC(f->locale, mkname("border", "a_road_connection"));
      }
    }
  } else if (gflags & GF_PLURAL)
    return LOC(f->locale, mkname("border", "roads"));
  else
    return LOC(f->locale, mkname("border", "road"));
  return buffer;
}
HRESULT CMainFrame::CheckForUpdates(bool Silent)
{
	// check if internet connection is active
	if(Silent)
	{
		DWORD nFlags = 0;
		if(!InternetGetConnectedState(&nFlags, 0) || (nFlags & INTERNET_CONNECTION_OFFLINE))
		{
			return S_OK;
		}
	}


	CWaitCursor wait;
	
	CString WMEVersion;
	HRESULT Ret = GetWMEVersionHttp(WMEVersion);
	if(FAILED(Ret)){
		if(!Silent) MessageBox(LOC("/str0145/Error querying latest available version."), NULL, MB_OK|MB_ICONERROR);
		return Ret;
	}
	else{
		DWORD VerMajor = atoi(Entry(1, WMEVersion, '.'));
		DWORD VerMinor = atoi(Entry(2, WMEVersion, '.'));
		DWORD VerBuild = atoi(Entry(3, WMEVersion, '.'));

		bool UpdateAvailable = false;
		
		if(VerMajor > DCGF_VER_MAJOR) UpdateAvailable = true;
		else if(VerMajor == DCGF_VER_MAJOR && VerMinor > DCGF_VER_MINOR) UpdateAvailable = true;
		else if(VerMajor == DCGF_VER_MAJOR && VerMinor == DCGF_VER_MINOR && VerBuild > DCGF_VER_BUILD) UpdateAvailable = true;
		
		if(!UpdateAvailable){
			if(!Silent) MessageBox(LOC("/str0146/Your WME version is up to date."), NULL, MB_OK|MB_ICONINFORMATION);
		}
		else{
			if(IDYES==MessageBox(LOC("/str0147/There is an updated version of WME available. Do you want to display the download page now?"), "", MB_OK|MB_ICONQUESTION|MB_YESNO)){
				ShellExecute(NULL, "open", LOC("/str1085/http://dead-code.org/redir.php?target=updates"), NULL, NULL, SW_SHOWMAXIMIZED);
			}
		}
	}


	return Ret;
}
Esempio n. 30
0
static char *gamedate2(const struct locale *lang)
{
    static char buf[256];
    gamedate gd;
    const char *week = "a_week", *month = "a_month";

    get_gamedate(turn, &gd);
    if (weeknames2) {
        week = weeknames2[gd.week];
    }
    month = calendar_month(gd.month);
    sprintf(buf, "in %s des Monats %s im Jahre %d %s.",
        LOC(lang, mkname("calendar", week)),
        LOC(lang, mkname("calendar", month)),
        gd.year,
        LOC(lang, mkname("calendar", calendar_era())));
    return buf;
}