forked from github/server
removing unused code for reading the dropouts-file.
This commit is contained in:
parent
9f97148163
commit
5edd84e47e
3 changed files with 1 additions and 92 deletions
|
@ -162,69 +162,6 @@ give_latestart_bonus(region *r, unit *u, int b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dropout * dropouts = NULL;
|
|
||||||
|
|
||||||
void
|
|
||||||
read_dropouts(const char * filename)
|
|
||||||
{
|
|
||||||
FILE * F = fopen(filename, "r");
|
|
||||||
if (F==NULL) return;
|
|
||||||
for (;;) {
|
|
||||||
char email[64], race[20];
|
|
||||||
int age;
|
|
||||||
short x, y;
|
|
||||||
if (fscanf(F, "%s %s %d %hd %hd", email, race, &age, &x, &y)<=0) break;
|
|
||||||
if (age<=2) {
|
|
||||||
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;
|
|
||||||
drop->y = y;
|
|
||||||
drop->fno = -1;
|
|
||||||
drop->next = dropouts;
|
|
||||||
dropouts = drop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(F);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
seed_dropouts(void)
|
|
||||||
{
|
|
||||||
dropout ** dropp = &dropouts;
|
|
||||||
while (*dropp) {
|
|
||||||
dropout *drop = *dropp;
|
|
||||||
region * r = findregion(drop->x, drop->y);
|
|
||||||
if (r) {
|
|
||||||
boolean found = false;
|
|
||||||
newfaction **nfp = &newfactions;
|
|
||||||
unit * u;
|
|
||||||
for (u=r->units;u;u=u->next) if (u->faction->no!=drop->fno) break;
|
|
||||||
if (u==NULL) while (*nfp) {
|
|
||||||
newfaction * nf = *nfp;
|
|
||||||
if (nf->race==drop->race && !nf->bonus) {
|
|
||||||
unit * u = addplayer(r, addfaction(nf->email, nf->password, nf->race, nf->lang,
|
|
||||||
nf->subscription));
|
|
||||||
u->faction->alliance = nf->allies;
|
|
||||||
++numnewbies;
|
|
||||||
if (nf->bonus) give_latestart_bonus(r, u, nf->bonus);
|
|
||||||
found=true;
|
|
||||||
*dropp = drop->next;
|
|
||||||
*nfp = nf->next;
|
|
||||||
free(nf);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
nfp = &nf->next;
|
|
||||||
}
|
|
||||||
if (!found) dropp=&drop->next;
|
|
||||||
} else {
|
|
||||||
*dropp = drop->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
newfaction *
|
newfaction *
|
||||||
select_newfaction(const struct race * rc)
|
select_newfaction(const struct race * rc)
|
||||||
|
|
|
@ -371,17 +371,6 @@ newbie_region(region * r)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
highlight_region(region *r)
|
highlight_region(region *r)
|
||||||
{
|
{
|
||||||
|
@ -393,7 +382,6 @@ highlight_region(region *r)
|
||||||
(hl == -7 && fval(r, RF_CHAOTIC)) ||
|
(hl == -7 && fval(r, RF_CHAOTIC)) ||
|
||||||
(hl == -8 && get_curse(r->attribs, ct_find("godcursezone"))) ||
|
(hl == -8 && get_curse(r->attribs, ct_find("godcursezone"))) ||
|
||||||
(hl == -9 && newbie_region(r)) ||
|
(hl == -9 && newbie_region(r)) ||
|
||||||
(hl == -10 && dropout_region(r)) ||
|
|
||||||
(hl == -11 && alliancehere(r, hl_alliance)) ||
|
(hl == -11 && alliancehere(r, hl_alliance)) ||
|
||||||
(hl >= 0 && factionhere(r, hl))) {
|
(hl >= 0 && factionhere(r, hl))) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -412,7 +400,7 @@ drawmap(boolean maponly) {
|
||||||
x1 = left; y1=top;
|
x1 = left; y1=top;
|
||||||
if(maponly == false) {
|
if(maponly == false) {
|
||||||
movexy(SX-36,SY-2);
|
movexy(SX-36,SY-2);
|
||||||
sprintf(buf, "%d gesetzt, %d Rest, %d Dropouts", numnewbies, listlen(newfactions), listlen(dropouts));
|
sprintf(buf, "%d gesetzt, %d Rest", numnewbies, listlen(newfactions));
|
||||||
addstr(buf);
|
addstr(buf);
|
||||||
movexy(SX-39, 0);
|
movexy(SX-39, 0);
|
||||||
vline(ACS_VLINE, SY+1);
|
vline(ACS_VLINE, SY+1);
|
||||||
|
@ -1172,10 +1160,6 @@ movearound(short rx, short ry) {
|
||||||
case 'a':
|
case 'a':
|
||||||
runautoseed();
|
runautoseed();
|
||||||
modified = 1;
|
modified = 1;
|
||||||
case 's':
|
|
||||||
seed_dropouts();
|
|
||||||
modified = 1;
|
|
||||||
break;
|
|
||||||
case 'S':
|
case 'S':
|
||||||
if (modified)
|
if (modified)
|
||||||
if (yes_no(0, "Daten abspeichern?", 'j')) {
|
if (yes_no(0, "Daten abspeichern?", 'j')) {
|
||||||
|
@ -1703,8 +1687,6 @@ main(int argc, char *argv[])
|
||||||
sprintf(buf, "%s/newfactions", basepath());
|
sprintf(buf, "%s/newfactions", basepath());
|
||||||
newfactions = read_newfactions(buf);
|
newfactions = read_newfactions(buf);
|
||||||
}
|
}
|
||||||
sprintf(buf, "%s/dropouts.%d", basepath(), turn);
|
|
||||||
read_dropouts(buf);
|
|
||||||
|
|
||||||
if (findfaction(MONSTER_FACTION)==NULL) {
|
if (findfaction(MONSTER_FACTION)==NULL) {
|
||||||
makemonsters();
|
makemonsters();
|
||||||
|
|
|
@ -118,20 +118,10 @@ void insert_selection(struct selection ** p_sel, struct selection * prev, char *
|
||||||
void block_create(short x1, short y1, int size, char chaotisch, int special, char terrain);
|
void block_create(short x1, short y1, int size, char chaotisch, int special, char terrain);
|
||||||
|
|
||||||
extern void read_orders(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;
|
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;
|
|
||||||
short x, y;
|
|
||||||
int fno;
|
|
||||||
} dropout;
|
|
||||||
|
|
||||||
extern dropout * dropouts;
|
|
||||||
extern struct newfaction * newfactions;
|
extern struct newfaction * newfactions;
|
||||||
|
|
||||||
#endif /* MAPPER_H */
|
#endif /* MAPPER_H */
|
||||||
|
|
Loading…
Reference in a new issue