mextra follow up bit 2
<Someone> noticed the leftover zeromextra, this removes it. Using memset() on a possibly failed mextra allocation was inapprorpriate, so replace the newmextra() macro with a function. Prevent a crash in christen_monst() if mextra was not initialized.
This commit is contained in:
@@ -969,6 +969,7 @@ E boolean FDECL(is_home_elemental, (struct permonst *));
|
||||
E struct monst *FDECL(clone_mon, (struct monst *,XCHAR_P,XCHAR_P));
|
||||
E int FDECL(monhp_per_lvl, (struct monst *));
|
||||
E void FDECL(newmonhp, (struct monst *,int));
|
||||
E struct mextra *NDECL(newmextra);
|
||||
E struct monst *FDECL(makemon, (struct permonst *,int,int,int));
|
||||
E boolean FDECL(create_critters, (int,struct permonst *));
|
||||
E struct permonst *NDECL(rndmonst);
|
||||
|
||||
@@ -110,10 +110,6 @@ struct mextra {
|
||||
struct edog *edog;
|
||||
};
|
||||
|
||||
#define newmextra() \
|
||||
(struct mextra *) memset((genericptr_t)alloc(sizeof(struct mextra)), \
|
||||
0, sizeof(struct mextra))
|
||||
|
||||
#define MNAME(mon) ((mon)->mextra->mname)
|
||||
#define EGD(mon) ((mon)->mextra->egd)
|
||||
#define EPRI(mon) ((mon)->mextra->epri)
|
||||
|
||||
Reference in New Issue
Block a user