On Tue, 11 Dec 2001, Artovil wrote:
> Perhaps lazy, but it has a point, since the utils.h file is included
> in every large file in the mud, and on some puters that takes ages to
> compile [...]
structs.h is included in every C file in the Mud, except for random.c,
which also does not include utils.h. Therefore, if you add/remove/change
a class, the Mud needs to be recompiled in full anyway.
> The first version requires a macro for every class, which is kind of
> redundant.
It's shorter and easier to read. The second version has no benefit over
simply using GET_CLASS.
> I have about 10 different magic classes in my MUD, which "forced" me
> to make a macro, IS_MAGI(ch) ...
You should really have made a table in class.c or constants.c with the
desired information, etc., in it. You could consolidate the
pc_class_names[], etc., arrays as well into your class table. Then
instead of IS_MAGI you could do:
if (class_table[((int) GET_CLASS(ch))].is_magi) {
/* ... */
}
or, even,
if (CLASS_FLAGGED(GET_CLASS(ch), CF_MAGI)) {
/* ... */
}
That seems ultimately more useful and maintainable than a macro.
-dak
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/24/03 PDT