Bugfix Ebenenkräuter

This commit is contained in:
Enno Rehling 2002-04-02 23:42:07 +00:00
parent bb3b1bd8bb
commit 2247002746
3 changed files with 37 additions and 4 deletions

View File

@ -913,9 +913,11 @@ terraform(region * r, terrain_t t)
if (landregion(t)) { if (landregion(t)) {
const char *name = NULL; const char *name = NULL;
if (terrain[r->terrain].herbs) {
if (terrain[r->terrain].herbs) name = terrain[r->terrain].herbs[rand()%3]; int len=0;
while (terrain[r->terrain].herbs[len]) ++len;
if (len) name = terrain[r->terrain].herbs[rand()%len];
}
if (name != NULL) { if (name != NULL) {
const item_type * itype = finditemtype(name, locale_de); const item_type * itype = finditemtype(name, locale_de);
const herb_type * htype = resource2herb(itype->rtype); const herb_type * htype = resource2herb(itype->rtype);

View File

@ -1334,6 +1334,33 @@ fix_herbtypes(void)
} }
#endif #endif
static int
fix_plainherbs(void)
{
region *r, *lastr;
for (r=regions;r;r=r->next) {
int i;
const char * name;
terrain_t t = rterrain(r);
if (t!=T_PLAIN) continue;
name = LOC(default_locale, rherbtype(r)->itype->rtype->_name[0]);
for (i=0;i!=3;++i) if (strcmp(terrain[t].herbs[i], name)==0) break;
if (i!=3) lastr=r->next;
r=r->next;
}
for (r=lastr;r;r=r->next) {
terrain_t t = rterrain(r);
if (t!=T_PLAIN) continue;
if (rand()%2) {
const char * name = terrain[t].herbs[3+rand()%3];
const item_type * itype = finditemtype(name, default_locale);
const herb_type * htype = resource2herb(itype->rtype);
rsetherbtype(r, htype);
}
}
return 0;
}
#ifdef SKILLFIX_SAVE #ifdef SKILLFIX_SAVE
typedef struct skillfix_data { typedef struct skillfix_data {
unit * u; unit * u;
@ -2685,6 +2712,7 @@ korrektur(void)
stats(); stats();
do_once("sql2", dump_sql()); do_once("sql2", dump_sql());
do_once("fw01", fix_watchers()); do_once("fw01", fix_watchers());
do_once("fixh", fix_plainherbs());
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
/* do not remove do_once calls - old datafiles need them! */ /* do not remove do_once calls - old datafiles need them! */
do_once("rgrw", convert_resources()); do_once("rgrw", convert_resources());

View File

@ -46,7 +46,10 @@ log_read(const char * filename)
fscanf(log, "%s %d %d", buf, &x, &y); fscanf(log, "%s %d %d", buf, &x, &y);
u = readunit(log); u = readunit(log);
r = findregion(x, y); r = findregion(x, y);
assert(r); if (r==NULL) {
r = new_region(x, y);
terraform(r, T_PLAIN);
}
if (u->region!=r) move_unit(u, r, NULL); if (u->region!=r) move_unit(u, r, NULL);
} else if (strcmp(buf, "REGION")==0) { } else if (strcmp(buf, "REGION")==0) {
int x, y; int x, y;