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;
}
extern int numnewbies;
void
autoseed(struct regionlist * rlist)
{
@ -252,6 +254,7 @@ autoseed(struct regionlist * rlist)
newfaction ** nfp = &newfactions;
while (*nfp!=nf) nfp=&(*nfp)->next;
addplayer(seeds[i].region, nf->email, nf->race, nf->lang);
++numnewbies;
*nfp = nf->next;
free(nf);
}

View File

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

View File

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