- Locale kann bei Erschaffen der Partei im Mapper angegeben werden.

This commit is contained in:
Christian Schlittchen 2001-05-28 18:24:44 +00:00
parent b05d1c898c
commit 52667dc453
5 changed files with 43 additions and 11 deletions

View file

@ -224,10 +224,9 @@ destroyfaction(faction * f)
void void
restart(unit *u, int race) 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->magiegebiet = u->faction->magiegebiet;
f->options = u->faction->options; f->options = u->faction->options;
f->locale = u->faction->locale;
destroyfaction(u->faction); destroyfaction(u->faction);
} }

View file

@ -1113,6 +1113,8 @@ extern void kernel_done(void);
extern void reorder_owners(struct region * r); extern void reorder_owners(struct region * r);
extern const char *locales[];
#define FIRST_TURN 184 #define FIRST_TURN 184
#include <log.h> #include <log.h>

View file

@ -64,7 +64,7 @@ unused_faction_id(void)
} }
unit * unit *
addplayer(region *r, char *email, race_t frace) addplayer(region *r, char *email, race_t frace, locale *loc)
{ {
int i; int i;
unit *u; unit *u;
@ -81,6 +81,7 @@ addplayer(region *r, char *email, race_t frace)
f->age = 0; f->age = 0;
f->race = frace; f->race = frace;
f->magiegebiet = 0; f->magiegebiet = 0;
f->locale = loc;
set_ursprung(f, 0, r->x, r->y); set_ursprung(f, 0, r->x, r->y);
f->options = Pow(O_REPORT) | Pow(O_ZUGVORLAGE) | Pow(O_SILBERPOOL); f->options = Pow(O_REPORT) | Pow(O_ZUGVORLAGE) | Pow(O_SILBERPOOL);

View file

@ -72,6 +72,6 @@ typedef struct faction {
extern const char * factionname(const struct faction * f); extern const char * factionname(const struct faction * f);
extern void * resolve_faction(void * data); 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 #endif

View file

@ -28,6 +28,7 @@
/* util includes */ /* util includes */
#include <base36.h> #include <base36.h>
#include <language.h>
/* libc includes */ /* libc includes */
#include <ctype.h> #include <ctype.h>
@ -291,12 +292,13 @@ NeuePartei(region * r)
race_t frace; race_t frace;
int late; int late;
unit *u; unit *u;
int locale_nr;
if (!r->land) { if (!r->land) {
warnung(0, "Ungeeignete Region! <Taste>"); warnung(0, "Ungeeignete Region! <Taste>");
return; 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)); strcpy(buf, my_input(win, 2, 1, "EMail-Adresse (Leer->Ende): ", NULL));
if (!buf[0]) { if (!buf[0]) {
@ -313,28 +315,56 @@ NeuePartei(region * r)
sprintf(buf, "%d=%s; ", i, race[i].name[0]); sprintf(buf, "%d=%s; ", i, race[i].name[0]);
q += strlen(buf); q += strlen(buf);
if (q > SX - 20) { if (q > SX - 20) {
q = strlen(buf); q = strlen(buf);
y++; y++;
wmove(win, y, 4); wmove(win, y, 4);
} }
wAddstr(buf); wAddstr(buf);
} }
wrefresh(win); wrefresh(win);
y++;
do { 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); } while(race[frace].nonplayer);
if(frace == -1) { if(frace == -1) {
delwin(win); delwin(win);
return; 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); delwin(win);
modified = 1; 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); if(late) give_latestart_bonus(r, u, late);