add note to zero out new mextra and oextra fields

Closes #375
This commit is contained in:
nhmall
2020-07-31 08:31:09 -04:00
parent 67bc0a78ce
commit 6b7979fa72
2 changed files with 17 additions and 15 deletions
+9 -9
View File
@@ -19,7 +19,9 @@
* file. * file.
* 3. Add a referencing macro at bottom of this file after the mextra * 3. Add a referencing macro at bottom of this file after the mextra
* struct (see MNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples). * struct (see MNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples).
* 4. Create a newXX(mtmp) function and possibly a free_XX(mtmp) * 4. Zero out the pointer to your struct in newmextra() in
* src/makemon.c.
* 5. Create a newXX(mtmp) function and possibly a free_XX(mtmp)
* function in an appropriate new or existing source file and add * function in an appropriate new or existing source file and add
* a prototype for it to include/extern.h. * a prototype for it to include/extern.h.
* *
@@ -39,7 +41,7 @@
* } * }
* } * }
* *
* 5. Consider adding a new makemon flag MM_XX flag to include/hack.h * 6. Consider adding a new makemon flag MM_XX flag to include/hack.h
* and a corresponding change to makemon() if you require your * and a corresponding change to makemon() if you require your
* structure to be added at monster creation time. Initialize your * structure to be added at monster creation time. Initialize your
* struct after a successful return from makemon(). * struct after a successful return from makemon().
@@ -47,17 +49,15 @@
* src/makemon.c: if (mmflags & MM_XX) newXX(mtmp); * src/makemon.c: if (mmflags & MM_XX) newXX(mtmp);
* your new code: mon = makemon(&mons[mnum], x, y, MM_XX); * your new code: mon = makemon(&mons[mnum], x, y, MM_XX);
* *
* 6. Adjust size_monst() in src/cmd.c appropriately. * 7. Adjust size_monst() in src/cmd.c appropriately.
* 7. Adjust dealloc_mextra() in src/mon.c to clean up * 8. Adjust dealloc_mextra() in src/mon.c to clean up
* properly during monst deallocation. * properly during monst deallocation.
* 8. Adjust copy_mextra() in src/mon.c to make duplicate * 9. Adjust copy_mextra() in src/mon.c to make duplicate
* copies of your struct or data on another monst struct. * copies of your struct or data on another monst struct.
* 9. Adjust restmon() in src/restore.c to deal with your * 10. Adjust restmon() in src/restore.c to deal with your
* struct or data during a restore. * struct or data during a restore.
* 10. Adjust savemon() in src/save.c to deal with your * 11. Adjust savemon() in src/save.c to deal with your
* struct or data during a save. * struct or data during a save.
* 11. Zero out the pointer to your struct in newmextra() in
* src/makemon.c.
*/ */
/*** /***
+8 -6
View File
@@ -389,7 +389,9 @@ struct obj {
* 4. Add a testing macro after the set of referencing macros * 4. Add a testing macro after the set of referencing macros
* (see has_oname(), has_omonst(), has_omailcmd(), and has_omin(), * (see has_oname(), has_omonst(), has_omailcmd(), and has_omin(),
* for examples). * for examples).
* 5. Create newXX(otmp) function and possibly free_XX(otmp) function * 5. Zero out the pointer to your struct in newmoextra() in
* src/mkobj.c.
* 6. Create newXX(otmp) function and possibly free_XX(otmp) function
* in an appropriate new or existing source file and add a prototype * in an appropriate new or existing source file and add a prototype
* for it to include/extern.h. The majority of these are currently * for it to include/extern.h. The majority of these are currently
* located in mkobj.c for convenience. * located in mkobj.c for convenience.
@@ -410,14 +412,14 @@ struct obj {
* } * }
* } * }
* *
* 6. Adjust size_obj() in src/cmd.c appropriately. * 7. Adjust size_obj() in src/cmd.c appropriately.
* 7. Adjust dealloc_oextra() in src/mkobj.c to clean up * 8. Adjust dealloc_oextra() in src/mkobj.c to clean up
* properly during obj deallocation. * properly during obj deallocation.
* 8. Adjust copy_oextra() in src/mkobj.c to make duplicate * 9. Adjust copy_oextra() in src/mkobj.c to make duplicate
* copies of your struct or data onto another obj struct. * copies of your struct or data onto another obj struct.
* 9. Adjust restobj() in src/restore.c to deal with your * 10. Adjust restobj() in src/restore.c to deal with your
* struct or data during a restore. * struct or data during a restore.
* 10. Adjust saveobj() in src/save.c to deal with your * 11. Adjust saveobj() in src/save.c to deal with your
* struct or data during a save. * struct or data during a save.
*/ */