Mapper ezigt jetzt an, was man ausgesetzt hat, bzw. wieviel noch zu tun ist.

Highlighting von Dropout-Regionen.
This commit is contained in:
Enno Rehling 2002-03-17 12:31:54 +00:00
parent 9aa123c946
commit 5f5b5e1f09
5 changed files with 74 additions and 33 deletions

View File

@ -181,6 +181,8 @@ recalc(seed_t * seeds, int nseeds, int nplayers)
return quality + q; return quality + q;
} }
extern int numnewbies;
void void
autoseed(struct regionlist * rlist) autoseed(struct regionlist * rlist)
{ {
@ -252,6 +254,7 @@ autoseed(struct regionlist * rlist)
newfaction ** nfp = &newfactions; newfaction ** nfp = &newfactions;
while (*nfp!=nf) nfp=&(*nfp)->next; while (*nfp!=nf) nfp=&(*nfp)->next;
addplayer(seeds[i].region, nf->email, nf->race, nf->lang); addplayer(seeds[i].region, nf->email, nf->race, nf->lang);
++numnewbies;
*nfp = nf->next; *nfp = nf->next;
free(nf); free(nf);
} }

View File

@ -155,13 +155,7 @@ give_latestart_bonus(region *r, unit *u, int b)
} }
} }
typedef struct dropout { dropout * dropouts = NULL;
struct dropout * next;
const struct race * race;
int x, y, fno;
} dropout;
static dropout * dropouts;
void void
read_orders(const char * filename) read_orders(const char * filename)
@ -195,6 +189,8 @@ read_orders(const char * filename)
ursprung * ur = f->ursprung; ursprung * ur = f->ursprung;
while (ur && ur->id!=0) ur=ur->next; while (ur && ur->id!=0) ur=ur->next;
if (ur) { if (ur) {
region * r = findregion(ur->x, ur->y);
if (r) {
dropout * drop = calloc(sizeof(dropout), 1); dropout * drop = calloc(sizeof(dropout), 1);
drop->x = ur->x; drop->x = ur->x;
drop->y = ur->y; drop->y = ur->y;
@ -204,6 +200,7 @@ read_orders(const char * filename)
dropouts = drop; dropouts = drop;
} }
} }
}
freset(f, FL_MARK); freset(f, FL_MARK);
} }
} }
@ -216,10 +213,11 @@ read_dropouts(const char * filename)
for (;;) { for (;;) {
char email[64], race[20]; char email[64], race[20];
int age, x, y; int age, x, y;
dropout * drop;
if (fscanf(F, "%s %s %d %d %d", email, race, &age, &x, &y)<=0) break; if (fscanf(F, "%s %s %d %d %d", email, race, &age, &x, &y)<=0) break;
if (age<=1) { if (age<=1) {
drop = calloc(sizeof(dropout), 1); region * r = findregion(x, y);
if (r) {
dropout * drop = calloc(sizeof(dropout), 1);
drop->race = rc_find(race); drop->race = rc_find(race);
if (drop->race==NULL) drop->race = findrace(race, default_locale); if (drop->race==NULL) drop->race = findrace(race, default_locale);
drop->x = x; drop->x = x;
@ -229,6 +227,7 @@ read_dropouts(const char * filename)
dropouts = drop; dropouts = drop;
} }
} }
}
fclose(F); fclose(F);
} }
@ -248,6 +247,7 @@ seed_dropouts(void)
newfaction * nf = *nfp; newfaction * nf = *nfp;
if (nf->race==drop->race && !nf->bonus) { if (nf->race==drop->race && !nf->bonus) {
unit * u = addplayer(r, nf->email, nf->race, nf->lang); unit * u = addplayer(r, nf->email, nf->race, nf->lang);
++numnewbies;
if (nf->bonus) give_latestart_bonus(r, u, nf->bonus); if (nf->bonus) give_latestart_bonus(r, u, nf->bonus);
found=true; found=true;
*dropp = drop->next; *dropp = drop->next;
@ -447,6 +447,7 @@ NeuePartei(region * r)
} }
modified = 1; modified = 1;
u = addplayer(r, email, frace, lang); u = addplayer(r, email, frace, lang);
++numnewbies;
if(late) give_latestart_bonus(r, u, late); if(late) give_latestart_bonus(r, u, late);

View File

@ -48,7 +48,7 @@ incat(char *buf, const int n, const size_t bufsize)
int rbottom; int rbottom;
dbllist *reglist = NULL; dbllist *reglist = NULL;
static dbllist *runten = NULL, *roben = NULL; static dbllist *runten = NULL, *roben = NULL;
#define LASTLINE SY-2 #define LASTLINE SY-3
/* Letzte Zeile, in der Regionsinfo bei der Karte kommt */ /* Letzte Zeile, in der Regionsinfo bei der Karte kommt */

View File

@ -69,6 +69,7 @@ char datafile[256];
/* -------------------- resizeterm ------------------------------------- */ /* -------------------- resizeterm ------------------------------------- */
short Signals = 0; short Signals = 0;
int numnewbies = 0;
unit *clipunit; unit *clipunit;
struct ship *clipship; struct ship *clipship;
region *clipregion; region *clipregion;
@ -342,6 +343,7 @@ readfactions(void)
lang = find_locale(langname); lang = find_locale(langname);
assert(rc && r && lang); assert(rc && r && lang);
u = addplayer(r, email, rc, lang); u = addplayer(r, email, rc, lang);
++numnewbies;
assert(u); assert(u);
i_change(&u->items, finditemtype("stein", german), 30); i_change(&u->items, finditemtype("stein", german), 30);
i_change(&u->items, finditemtype("holz", german), 30); i_change(&u->items, finditemtype("holz", german), 30);
@ -362,6 +364,17 @@ newbie_region(region * r)
return 0; return 0;
} }
int
dropout_region(region * r)
{
dropout * drop = dropouts;
if (r!=NULL) while (drop) {
if (drop->x==r->x && drop->y==r->y) return 1;
drop=drop->next;
}
return 0;
}
void void
drawmap(boolean maponly) { drawmap(boolean maponly) {
int x, x1, y1, y2, s, q; int x, x1, y1, y2, s, q;
@ -370,12 +383,15 @@ drawmap(boolean maponly) {
x1=left; y1=top; x1=left; y1=top;
if(maponly == false) { if(maponly == false) {
movexy(SX-36,SY-2);
sprintf(buf, "%d gesetzt, %d Rest, %d Dropouts", numnewbies, listlen(newfactions), listlen(dropouts));
addstr(buf);
movexy(SX-39, 0); movexy(SX-39, 0);
vline(ACS_VLINE, SY+1); vline(ACS_VLINE, SY+1);
movexy(SX-38, SY-2); movexy(SX-38, SY-3);
hline(ACS_HLINE, 39); hline(ACS_HLINE, 39);
if (hl != -1) { if (hl != -1) {
movexy(SX-36,SY-2); movexy(SX-36,SY-3);
addstr(" High: "); addstr(" High: ");
switch (hl) { switch (hl) {
case -2: case -2:
@ -402,29 +418,32 @@ drawmap(boolean maponly) {
case -9: case -9:
addstr("Anfänger "); addstr("Anfänger ");
break; break;
case -10:
addstr("Dropouts ");
break;
default: default:
printw((NCURSES_CONST char*)"Partei %d ", hl); printw((NCURSES_CONST char*)"Partei %d ", hl);
} }
} }
switch(politkarte) { switch(politkarte) {
case 0: case 0:
movexy(SX-14,SY-2); movexy(SX-14,SY-3);
addstr(" Geol.Karte "); addstr(" Geol.Karte ");
break; break;
case 1: case 1:
movexy(SX-14,SY-2); movexy(SX-14,SY-3);
addstr(" Politkarte "); addstr(" Politkarte ");
break; break;
case 2: case 2:
movexy(SX-14,SY-2); movexy(SX-14,SY-3);
addstr(" Handelskar "); addstr(" Handelskar ");
break; break;
case 3: case 3:
movexy(SX-14,SY-2); movexy(SX-14,SY-3);
addstr(" Botanik "); addstr(" Botanik ");
break; break;
case 4: case 4:
movexy(SX-14,SY-2); movexy(SX-14,SY-3);
addstr(" Demand "); addstr(" Demand ");
break; break;
} }
@ -455,6 +474,7 @@ drawmap(boolean maponly) {
(hl == -7 && fval(r, RF_CHAOTIC)) || (hl == -7 && fval(r, RF_CHAOTIC)) ||
(hl == -8 && is_cursed_internal(r->attribs, C_CURSED_BY_THE_GODS, 0)) || (hl == -8 && is_cursed_internal(r->attribs, C_CURSED_BY_THE_GODS, 0)) ||
(hl == -9 && newbie_region(r)) || (hl == -9 && newbie_region(r)) ||
(hl == -10 && dropout_region(r)) ||
(hl >= 0 && factionhere(r, hl)) || (hl >= 0 && factionhere(r, hl)) ||
(x==tx && y1==ty)) (x==tx && y1==ty))
addch(rs | A_REVERSE); addch(rs | A_REVERSE);
@ -664,11 +684,13 @@ SetHighlight(void)
WINDOW *win; WINDOW *win;
char *fac_nr36; char *fac_nr36;
int c; int c;
win = openwin(60, 5, "< Highlighting >"); win = openwin(60, 6, "< Highlighting >");
wmove(win, 1, 2); wmove(win, 1, 2);
wAddstr("Regionen mit P)artei, E)inheiten, B)urgen, S)chiffen,"); wAddstr("Regionen mit P)artei, E)inheiten, B)urgen, S)chiffen,");
wmove(win, 2, 2); wmove(win, 2, 2);
wAddstr(" A)nfängern, L)aen, C)haos, G)odcurse oder N)ichts?"); wAddstr(" A)nfängern, L)aen, C)haos, G)odcurse");
wmove(win, 3, 2);
wAddstr(" D)ropouts oder N)ichts?");
wrefresh(win); wrefresh(win);
c = tolower(getch()); c = tolower(getch());
switch (c) { switch (c) {
@ -700,6 +722,9 @@ SetHighlight(void)
case 'a': case 'a':
hl = -9; hl = -9;
break; break;
case 'd':
hl = -10;
break;
case 'n': case 'n':
default: default:
hl = -1; hl = -1;
@ -1447,6 +1472,7 @@ main(int argc, char *argv[])
{ {
int x = 0, y = 0, i; int x = 0, y = 0, i;
char *s; char *s;
faction * f;
boolean backup = true; boolean backup = true;
boolean logging = false; boolean logging = false;
boolean readlog = false; boolean readlog = false;
@ -1560,6 +1586,9 @@ main(int argc, char *argv[])
sprintf(datafile, "%s/%d", datapath(), turn); sprintf(datafile, "%s/%d", datapath(), turn);
readgame(backup); readgame(backup);
for (f=factions;f;f=f->next) if (f->age==0) {
++numnewbies;
}
sprintf(buf, "%s/newfactions.%d", basepath(), turn); sprintf(buf, "%s/newfactions.%d", basepath(), turn);
read_newfactions(buf); read_newfactions(buf);

View File

@ -126,7 +126,15 @@ extern void read_newfactions(const char * filename);
extern void read_orders(const char * filename); extern void read_orders(const char * filename);
extern void read_dropouts(const char *filename); extern void read_dropouts(const char *filename);
extern void seed_dropouts(void); extern void seed_dropouts(void);
extern int numnewbies;
#define sncat(b, s, size) strncat ((b), s, size - strlen (b)) #define sncat(b, s, size) strncat ((b), s, size - strlen (b))
typedef struct dropout {
struct dropout * next;
const struct race * race;
int x, y, fno;
} dropout;
extern dropout * dropouts;
#endif /* MAPPER_H */ #endif /* MAPPER_H */