forked from github/server
Bugfix Ebenenkräuter
This commit is contained in:
parent
bb3b1bd8bb
commit
2247002746
|
@ -913,9 +913,11 @@ terraform(region * r, terrain_t t)
|
|||
|
||||
if (landregion(t)) {
|
||||
const char *name = NULL;
|
||||
|
||||
if (terrain[r->terrain].herbs) name = terrain[r->terrain].herbs[rand()%3];
|
||||
|
||||
if (terrain[r->terrain].herbs) {
|
||||
int len=0;
|
||||
while (terrain[r->terrain].herbs[len]) ++len;
|
||||
if (len) name = terrain[r->terrain].herbs[rand()%len];
|
||||
}
|
||||
if (name != NULL) {
|
||||
const item_type * itype = finditemtype(name, locale_de);
|
||||
const herb_type * htype = resource2herb(itype->rtype);
|
||||
|
|
|
@ -1334,6 +1334,33 @@ fix_herbtypes(void)
|
|||
}
|
||||
#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
|
||||
typedef struct skillfix_data {
|
||||
unit * u;
|
||||
|
@ -2685,6 +2712,7 @@ korrektur(void)
|
|||
stats();
|
||||
do_once("sql2", dump_sql());
|
||||
do_once("fw01", fix_watchers());
|
||||
do_once("fixh", fix_plainherbs());
|
||||
#if NEW_RESOURCEGROWTH
|
||||
/* do not remove do_once calls - old datafiles need them! */
|
||||
do_once("rgrw", convert_resources());
|
||||
|
|
|
@ -46,7 +46,10 @@ log_read(const char * filename)
|
|||
fscanf(log, "%s %d %d", buf, &x, &y);
|
||||
u = readunit(log);
|
||||
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);
|
||||
} else if (strcmp(buf, "REGION")==0) {
|
||||
int x, y;
|
||||
|
|
Loading…
Reference in New Issue