kleinere fixes am autoseeding. aber cih glaube irgendwie nicht, dem ganzen auf den grund gekommen zu sein...

This commit is contained in:
Enno Rehling 2002-05-01 23:47:32 +00:00
parent cefa3e61bb
commit 2171245196
7 changed files with 46 additions and 36 deletions

View File

@ -2348,14 +2348,14 @@ strdup(const char *s)
#endif #endif
void void
remove_empty_factions(void) remove_empty_factions(boolean writedropouts)
{ {
faction **fp, *f3; faction **fp, *f3;
FILE *dofp; FILE *dofp = NULL;
char zText[MAX_PATH]; char zText[MAX_PATH];
sprintf(zText, "%s/dropouts.%d", basepath(), turn); sprintf(zText, "%s/dropouts.%d", basepath(), turn);
dofp = fopen(zText, "w"); if (writedropouts) dofp = fopen(zText, "w");
for (fp = &factions; *fp;) { for (fp = &factions; *fp;) {
faction * f = *fp; faction * f = *fp;
@ -2370,7 +2370,7 @@ remove_empty_factions(void)
/* Einfach in eine Datei schreiben und später vermailen */ /* Einfach in eine Datei schreiben und später vermailen */
fprintf(dofp, "%s %s %d %d %d\n", f->email, rc_name(f->race, 0), f->age, ur?ur->x:0, ur?ur->y:0); if (dofp) fprintf(dofp, "%s %s %d %d %d\n", f->email, LOC(default_locale, rc_name(f->race, 0)), f->age, ur?ur->x:0, ur?ur->y:0);
if (updatelog) fprintf(updatelog, "dropout %s\n", itoa36(f->no)); if (updatelog) fprintf(updatelog, "dropout %s\n", itoa36(f->no));
for (f3 = factions; f3; f3 = f3->next) { for (f3 = factions; f3; f3 = f3->next) {
@ -2409,7 +2409,7 @@ remove_empty_factions(void)
else fp = &(*fp)->next; else fp = &(*fp)->next;
} }
fclose(dofp); if (dofp) fclose(dofp);
} }
void void

View File

@ -844,7 +844,7 @@ typedef struct ally {
void remove_empty_units_in_region(struct region *r); void remove_empty_units_in_region(struct region *r);
void remove_empty_units(void); void remove_empty_units(void);
void remove_empty_factions(void); void remove_empty_factions(boolean writedropouts);
typedef struct strlist { typedef struct strlist {
struct strlist *next; struct strlist *next;

View File

@ -1042,7 +1042,7 @@ readgame(boolean backup)
findfaction(0)->alive = 1; findfaction(0)->alive = 1;
} }
if (maxregions>=0) { if (maxregions>=0) {
remove_empty_factions(); remove_empty_factions(false);
} }
/* Regionen */ /* Regionen */

View File

@ -283,7 +283,7 @@ processturn(char *filename)
if (!noreports) reports(); if (!noreports) reports();
free_units(); free_units();
puts(" - Beseitige leere Parteien"); puts(" - Beseitige leere Parteien");
remove_empty_factions(); remove_empty_factions(true);
end = make_summary(true); end = make_summary(true);
report_summary(end, begin, false); report_summary(end, begin, false);
report_summary(end, begin, true); report_summary(end, begin, true);

View File

@ -163,7 +163,7 @@ give_latestart_bonus(region *r, unit *u, int b)
dropout * dropouts = NULL; dropout * dropouts = NULL;
void int
read_orders_file(const char * filename) read_orders_file(const char * filename)
{ {
faction * f = NULL; faction * f = NULL;
@ -171,7 +171,7 @@ read_orders_file(const char * filename)
char buffer[16]; char buffer[16];
FILE * F = fopen(filename, "r"); FILE * F = fopen(filename, "r");
if (F==NULL) return; if (F==NULL) return -1;
b = getbuf(F); b = getbuf(F);
@ -191,12 +191,14 @@ read_orders_file(const char * filename)
b = getbuf(F); b = getbuf(F);
} }
fclose(F); fclose(F);
return 0;
} }
void void
read_orders(const char * filename) read_orders(const char * filename)
{ {
faction *f; faction *f;
boolean loaded = false;
#ifdef __USE_POSIX /* if filename points to a directory, read #ifdef __USE_POSIX /* if filename points to a directory, read
all files it contains. */ all files it contains. */
@ -213,14 +215,14 @@ read_orders(const char * filename)
} }
closedir(dir); closedir(dir);
} else { } else {
read_orders_file(filename); if (read_orders_file(filename)==0) loaded = true;
} }
} }
#else /* we do not have this functionality */ #else /* we do not have this functionality */
read_orders_file(filename); if (read_orders_file(filename)==0) loaded=true;
#endif #endif
for (f=factions;f;f=f->next) { if (loaded) for (f=factions;f;f=f->next) {
if (!fval(f, FL_MARK) && f->age <=1) { if (!fval(f, FL_MARK) && f->age <=1) {
ursprung * ur = f->ursprung; ursprung * ur = f->ursprung;
while (ur && ur->id!=0) ur=ur->next; while (ur && ur->id!=0) ur=ur->next;
@ -250,7 +252,7 @@ read_dropouts(const char * filename)
char email[64], race[20]; char email[64], race[20];
int age, x, y; int age, x, y;
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<=2) {
region * r = findregion(x, y); region * r = findregion(x, y);
if (r) { if (r) {
dropout * drop = calloc(sizeof(dropout), 1); dropout * drop = calloc(sizeof(dropout), 1);

View File

@ -1072,7 +1072,7 @@ movearound(int rx, int ry) {
ch = -9; ch = -9;
break; break;
case 'P': case 'P':
NeuePartei(r); if (r) NeuePartei(r);
ch = -9; ch = -9;
break; break;
case 'X': case 'X':
@ -1096,7 +1096,7 @@ movearound(int rx, int ry) {
break; break;
case 'u': case 'u':
case 'e': case 'e':
while (showunits(r)); while (r && showunits(r));
ch = -9; ch = -9;
break; break;
case 'U': case 'U':
@ -1573,8 +1573,10 @@ main(int argc, char *argv[])
read_newfactions(buf); read_newfactions(buf);
sprintf(buf, "%s/dropouts.%d", basepath(), turn); sprintf(buf, "%s/dropouts.%d", basepath(), turn);
read_dropouts(buf); read_dropouts(buf);
if (orderfile) {
sprintf(buf, "%s/%s", basepath(), orderfile); sprintf(buf, "%s/%s", basepath(), orderfile);
read_orders(buf); read_orders(buf);
}
if (findfaction(MONSTER_FACTION)==NULL) { if (findfaction(MONSTER_FACTION)==NULL) {
makemonsters(); makemonsters();

View File

@ -3433,31 +3433,37 @@
<namespace name="spellinfo"> <namespace name="spellinfo">
<string name="blessedharvest"> <string name="blessedharvest">
<text locale="de">Dieses Ernteritual verbessert die <text locale="de">Dieses Ernteritual verbessert die
Erträge der arbeitenden Bauern in der Region um ein Erträge der arbeitenden Bauern in der Region
Silberstück. Je mehr Kraft der Druide investiert, um ein Silberstück. Je mehr Kraft der Druide
desto länger wirkt der Zauber.</text> investiert, desto länger wirkt der
Zauber.</text>
<text locale="en">This harvest ritual increases the <text locale="en">This harvest ritual increases the
income of each working peasant by one silver piece. income of each working peasant by one silver
The more power the druid invests, the longer the spell piece. The more power the druid invests, the
lasts.</text> longer the spell lasts.</text>
</string> </string>
<string name="veterinarian"> <string name="veterinarian">
<text locale="de">Die Fähigkeiten der Gwyrrd-Magier in <text locale="de">Die Fähigkeiten der Gwyrrd-Magier in
der Viehzucht und Heilung sind bei den Bauern sehr der Viehzucht und Heilung sind bei den Bauern
begehrt. Grade auf Märkten sind ihre Dienste häufig sehr begehrt. Grade auf Märkten sind ihre
sehr gefragt. Manch einer mag auch sein Talent dazu Dienste häufig sehr gefragt. Manch einer mag
nutzen, ein Tier für einen besseren Preis zu auch sein Talent dazu nutzen, ein Tier für
verkaufen. Pro Stufe kann der Magier so 50 Silber einen besseren Preis zu verkaufen. Pro Stufe
verdienen.</text> kann der Magier so 50 Silber verdienen.</text>
<text locale="en">The abilities of the mages of Gwyrrd <text locale="en">The abilities of the mages of Gwyrrd
concerning the breeding and healing of cattle are concerning the breeding and healing of cattle
highly appreciated among the peasants. Especially at are highly appreciated among the peasants.
the markets, their services are demanded frequently. Especially at the markets, their services are
Some of them also use their talents to sell an animal demanded frequently. Some of them also use
at a higher price. A mage can earn 50 silver pieces their talents to sell an animal at a higher
per level in this way.</text> price. A mage can earn 50 silver pieces per
level in this way.</text>
</string> </string>
</namespace> </namespace>
</strings> </strings>