From 2171245196cafc813bf7bf7a84ebd32d009f63a9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 1 May 2002 23:47:32 +0000 Subject: [PATCH] kleinere fixes am autoseeding. aber cih glaube irgendwie nicht, dem ganzen auf den grund gekommen zu sein... --- src/common/kernel/eressea.c | 10 ++++----- src/common/kernel/eressea.h | 2 +- src/common/kernel/save.c | 2 +- src/eressea/main.c | 2 +- src/mapper/map_partei.c | 14 +++++++------ src/mapper/mapper.c | 10 +++++---- src/res/de/strings.xml | 42 +++++++++++++++++++++---------------- 7 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 64666297d..ffc34afb1 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -2348,14 +2348,14 @@ strdup(const char *s) #endif void -remove_empty_factions(void) +remove_empty_factions(boolean writedropouts) { faction **fp, *f3; - FILE *dofp; + FILE *dofp = NULL; char zText[MAX_PATH]; sprintf(zText, "%s/dropouts.%d", basepath(), turn); - dofp = fopen(zText, "w"); + if (writedropouts) dofp = fopen(zText, "w"); for (fp = &factions; *fp;) { faction * f = *fp; @@ -2370,7 +2370,7 @@ remove_empty_factions(void) /* 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)); for (f3 = factions; f3; f3 = f3->next) { @@ -2409,7 +2409,7 @@ remove_empty_factions(void) else fp = &(*fp)->next; } - fclose(dofp); + if (dofp) fclose(dofp); } void diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 30db8afe5..dab51c63c 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -844,7 +844,7 @@ typedef struct ally { void remove_empty_units_in_region(struct region *r); void remove_empty_units(void); -void remove_empty_factions(void); +void remove_empty_factions(boolean writedropouts); typedef struct strlist { struct strlist *next; diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index eb5739e69..6a1717a4d 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1042,7 +1042,7 @@ readgame(boolean backup) findfaction(0)->alive = 1; } if (maxregions>=0) { - remove_empty_factions(); + remove_empty_factions(false); } /* Regionen */ diff --git a/src/eressea/main.c b/src/eressea/main.c index 706cd264e..5788fc229 100644 --- a/src/eressea/main.c +++ b/src/eressea/main.c @@ -283,7 +283,7 @@ processturn(char *filename) if (!noreports) reports(); free_units(); puts(" - Beseitige leere Parteien"); - remove_empty_factions(); + remove_empty_factions(true); end = make_summary(true); report_summary(end, begin, false); report_summary(end, begin, true); diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index e757186e2..5c95f1ccf 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -163,7 +163,7 @@ give_latestart_bonus(region *r, unit *u, int b) dropout * dropouts = NULL; -void +int read_orders_file(const char * filename) { faction * f = NULL; @@ -171,7 +171,7 @@ read_orders_file(const char * filename) char buffer[16]; FILE * F = fopen(filename, "r"); - if (F==NULL) return; + if (F==NULL) return -1; b = getbuf(F); @@ -191,12 +191,14 @@ read_orders_file(const char * filename) b = getbuf(F); } fclose(F); + return 0; } void read_orders(const char * filename) { faction *f; + boolean loaded = false; #ifdef __USE_POSIX /* if filename points to a directory, read all files it contains. */ @@ -213,14 +215,14 @@ read_orders(const char * filename) } closedir(dir); } else { - read_orders_file(filename); + if (read_orders_file(filename)==0) loaded = true; } } #else /* we do not have this functionality */ - read_orders_file(filename); + if (read_orders_file(filename)==0) loaded=true; #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) { ursprung * ur = f->ursprung; while (ur && ur->id!=0) ur=ur->next; @@ -250,7 +252,7 @@ read_dropouts(const char * filename) char email[64], race[20]; int age, x, y; 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); if (r) { dropout * drop = calloc(sizeof(dropout), 1); diff --git a/src/mapper/mapper.c b/src/mapper/mapper.c index 7e08ea888..a3c35bea4 100644 --- a/src/mapper/mapper.c +++ b/src/mapper/mapper.c @@ -1072,7 +1072,7 @@ movearound(int rx, int ry) { ch = -9; break; case 'P': - NeuePartei(r); + if (r) NeuePartei(r); ch = -9; break; case 'X': @@ -1096,7 +1096,7 @@ movearound(int rx, int ry) { break; case 'u': case 'e': - while (showunits(r)); + while (r && showunits(r)); ch = -9; break; case 'U': @@ -1573,8 +1573,10 @@ main(int argc, char *argv[]) read_newfactions(buf); sprintf(buf, "%s/dropouts.%d", basepath(), turn); read_dropouts(buf); - sprintf(buf, "%s/%s", basepath(), orderfile); - read_orders(buf); + if (orderfile) { + sprintf(buf, "%s/%s", basepath(), orderfile); + read_orders(buf); + } if (findfaction(MONSTER_FACTION)==NULL) { makemonsters(); diff --git a/src/res/de/strings.xml b/src/res/de/strings.xml index ab41b9f81..7b548c8be 100644 --- a/src/res/de/strings.xml +++ b/src/res/de/strings.xml @@ -3433,31 +3433,37 @@ Dieses Ernteritual verbessert die - Erträge der arbeitenden Bauern in der Region um ein - Silberstück. Je mehr Kraft der Druide investiert, - desto länger wirkt der Zauber. + Erträge der arbeitenden Bauern in der Region + um ein Silberstück. Je mehr Kraft der Druide + investiert, desto länger wirkt der + Zauber. This harvest ritual increases the - income of each working peasant by one silver piece. - The more power the druid invests, the longer the spell - lasts. + income of each working peasant by one silver + piece. The more power the druid invests, the + longer the spell lasts. Die Fähigkeiten der Gwyrrd-Magier in - der Viehzucht und Heilung sind bei den Bauern sehr - begehrt. Grade auf Märkten sind ihre Dienste häufig - sehr gefragt. Manch einer mag auch sein Talent dazu - nutzen, ein Tier für einen besseren Preis zu - verkaufen. Pro Stufe kann der Magier so 50 Silber - verdienen. + der Viehzucht und Heilung sind bei den Bauern + sehr begehrt. Grade auf Märkten sind ihre + Dienste häufig sehr gefragt. Manch einer mag + auch sein Talent dazu nutzen, ein Tier für + einen besseren Preis zu verkaufen. Pro Stufe + kann der Magier so 50 Silber verdienen. The abilities of the mages of Gwyrrd - concerning the breeding and healing of cattle are - highly appreciated among the peasants. Especially at - the markets, their services are demanded frequently. - Some of them also use their talents to sell an animal - at a higher price. A mage can earn 50 silver pieces - per level in this way. + concerning the breeding and healing of cattle + are highly appreciated among the peasants. + Especially at the markets, their services are + demanded frequently. Some of them also use + their talents to sell an animal at a higher + price. A mage can earn 50 silver pieces per + level in this way. + + + +