From 52667dc453d5d0614393f2aecead897d3c823bf6 Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Mon, 28 May 2001 18:24:44 +0000 Subject: [PATCH] - Locale kann bei Erschaffen der Partei im Mapper angegeben werden. --- src/common/gamecode/laws.c | 3 +-- src/common/kernel/eressea.h | 2 ++ src/common/kernel/faction.c | 3 ++- src/common/kernel/faction.h | 2 +- src/mapper/map_partei.c | 44 +++++++++++++++++++++++++++++++------ 5 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index d524f898c..c933725ab 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -224,10 +224,9 @@ destroyfaction(faction * f) void restart(unit *u, int race) { - faction *f = addplayer(u->region, u->faction->email, race)->faction; + faction *f = addplayer(u->region, u->faction->email, race, u->faction->locale)->faction; f->magiegebiet = u->faction->magiegebiet; f->options = u->faction->options; - f->locale = u->faction->locale; destroyfaction(u->faction); } diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 77a3c190a..1c08f1ea4 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -1113,6 +1113,8 @@ extern void kernel_done(void); extern void reorder_owners(struct region * r); +extern const char *locales[]; + #define FIRST_TURN 184 #include diff --git a/src/common/kernel/faction.c b/src/common/kernel/faction.c index ca62b14c4..ec699f542 100644 --- a/src/common/kernel/faction.c +++ b/src/common/kernel/faction.c @@ -64,7 +64,7 @@ unused_faction_id(void) } unit * -addplayer(region *r, char *email, race_t frace) +addplayer(region *r, char *email, race_t frace, locale *loc) { int i; unit *u; @@ -81,6 +81,7 @@ addplayer(region *r, char *email, race_t frace) f->age = 0; f->race = frace; f->magiegebiet = 0; + f->locale = loc; set_ursprung(f, 0, r->x, r->y); f->options = Pow(O_REPORT) | Pow(O_ZUGVORLAGE) | Pow(O_SILBERPOOL); diff --git a/src/common/kernel/faction.h b/src/common/kernel/faction.h index 43ff5787c..4a9ff94b0 100644 --- a/src/common/kernel/faction.h +++ b/src/common/kernel/faction.h @@ -72,6 +72,6 @@ typedef struct faction { extern const char * factionname(const struct faction * f); extern void * resolve_faction(void * data); -extern struct unit * addplayer(struct region *r, char *email, race_t frace); +extern struct unit * addplayer(struct region *r, char *email, race_t frace, struct locale *loc); #endif diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index 133dafb4b..c21907617 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -28,6 +28,7 @@ /* util includes */ #include +#include /* libc includes */ #include @@ -291,12 +292,13 @@ NeuePartei(region * r) race_t frace; int late; unit *u; + int locale_nr; if (!r->land) { warnung(0, "Ungeeignete Region! "); return; } - win = openwin(SX - 10, 9, "< Neue Partei einfügen >"); + win = openwin(SX - 10, 12, "< Neue Partei einfügen >"); strcpy(buf, my_input(win, 2, 1, "EMail-Adresse (Leer->Ende): ", NULL)); if (!buf[0]) { @@ -313,28 +315,56 @@ NeuePartei(region * r) sprintf(buf, "%d=%s; ", i, race[i].name[0]); q += strlen(buf); if (q > SX - 20) { - q = strlen(buf); - y++; - wmove(win, y, 4); + q = strlen(buf); + y++; + wmove(win, y, 4); } wAddstr(buf); } wrefresh(win); + y++; do { - frace = (char) map_input(win, 2, 2, "Rasse", -1, MAXRACES-1, 0); + frace = (char) map_input(win, 2, y, "Rasse", -1, MAXRACES-1, 0); } while(race[frace].nonplayer); if(frace == -1) { delwin(win); return; } - late = (int) map_input(win, 2, 5, "Startbonus", 0, 99, 0); + y++; + late = (int) map_input(win, 2, y, "Startbonus", -1, 99, 0); + if(late == -1) { + delwin(win); + return; + } + + i = 0; q = 0; y++; + wmove(win, y, 4); + while(locales[i] != NULL) { + sprintf(buf, "%d=%s; ", i, locales[i]); + q += strlen(buf); + if (q > SX - 20) { + q = strlen(buf); + y++; + wmove(win, y, 4); + } + wAddstr(buf); + i++; + } + wrefresh(win); + + y++; + locale_nr = map_input(win, 2, 8, "Locale", -1, i-1, 0); + if(locale_nr == -1) { + delwin(win); + return; + } delwin(win); modified = 1; - u = addplayer(r, email, frace); + u = addplayer(r, email, frace, find_locale(locales[locale_nr])); if(late) give_latestart_bonus(r, u, late);