nachbesserung zu den letzten 2 commits

This commit is contained in:
Enno Rehling 2005-10-25 08:45:59 +00:00
parent 1b4aa36874
commit 00fab33aaf
3 changed files with 11 additions and 9 deletions

View File

@ -620,7 +620,6 @@ give_horses(const unit * s, const unit * d, const item_type * itype, int n, stru
item_type * olditemtype[MAXITEMS+1];
resource_type * oldresourcetype[MAXRESOURCES+1];
herb_type * oldherbtype[MAXHERBS+1];
luxury_type * oldluxurytype[MAXLUXURIES+1];
potion_type * oldpotiontype[MAXPOTIONS+1];
@ -1327,7 +1326,6 @@ init_oldherbs(void)
for (h=0;h!=MAXHERBS;++h) {
item_type * itype;
terrain_t t;
resource_type * rtype;
names[0] = NULL;
@ -1348,13 +1346,17 @@ init_oldherbs(void)
rtype = new_resourcetype(names, appearance, RTF_ITEM|RTF_POOLED);
itype = new_itemtype(rtype, ITF_HERB, 0, 0);
t = (terrain_t)(h/3+1);
if (t>T_PLAIN) --t;
oldherbtype[h] = new_herbtype(itype, t);
oldresourcetype[herb2res(h)] = rtype;
}
}
const resource_type *
newherbtype(herb_t h)
{
return oldresourcetype[herb2res(h)];
}
static const char *potionnames[3][MAXPOTIONS] =
{
{
@ -1787,7 +1789,7 @@ init_oldpotions(void)
con->materials = calloc(sizeof(requirement), i + 1);
for (i=0;i!=MAXHERBSPERPOTION && potionherbs[p][i]!=NOHERB;++i) {
#ifdef NO_OLD_ITEMS
con->materials[i].rtype = oldherbtype[potionherbs[p][i]]->itype->rtype;
con->materials[i].rtype = oldresourcetype[herb2res(potionherbs[p][i])];
#else
con->materials[i].type = herb2res(potionherbs[p][i]);
#endif

View File

@ -139,6 +139,7 @@ typedef struct herb_type {
terrain_t terrain;
} herb_type;
extern herb_type * herbtypes;
extern const resource_type * newherbtype(herb_t h);
typedef struct potion_type {
struct potion_type * next;
@ -451,7 +452,6 @@ extern struct luxury_type * oldluxurytype[];
extern struct potion_type * oldpotiontype[];
extern struct item_type * olditemtype[];
extern struct resource_type * oldresourcetype[];
extern struct herb_type * oldherbtype[];
int get_item(const struct unit *, item_t);
int set_item(struct unit *, item_t, int);

View File

@ -1199,7 +1199,7 @@ readunit(FILE * F)
}
while ((herb = (herb_t) ri(F)) >= 0) {
i_change(&u->items, oldherbtype[herb]->itype, ri(F));
i_change(&u->items, newherbtype(herb)->itype, ri(F));
}
}
u->hp = ri(F);
@ -1440,7 +1440,7 @@ readregion(FILE * F, short x, short y)
if (ter > T_GLACIER || ter == T_OCEAN)
rsetherbtype(r, NULL);
else
rsetherbtype(r, oldherbtype[(i-1)+3*(ter-1)]);
rsetherbtype(r, newherbtype((i-1)+3*(ter-1))->htype);
rsetherbs(r, (short)ri(F));
}
rsetpeasants(r, ri(F));