>Just make sure you don't put anything extraneous in the same bitvector, >because that will be counted too. Yes. I created the bitvector with the express purpose of using it only for guilds (up to 32) and also defined a NUM_GUILDS (presently 18). >You could probably replace GUILD_FLAGS(ch) & (1 << i) with >IS_SET(GUILD_FLAGS(ch), (1 << i)) for better readability. Based on the suggestions from you and Welcor I have done the following: int count_guilds(struct char_data *ch) { int i, count = 0; for (i = 0;i < NUM_GUILD;i++) if (IS_SET(GUILD_FLAGS(ch), (1<<i))) count++; return count; } Is there a reason that using NUM_GUILD vs. a static 32 would be bad? (Assuming that NUM_GUILD is increased when new guilds are added.) I also added this to the score info for my testing/debuging: send_to_char(ch, "You belong to %d guilds.\r\n", count_guilds(ch)); And it seems to be working most excellently. I'll be working out the formula based xp and using count_guilds to modify that base. Thanks to you both! --Ziz _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- +---------------------------------------------------------------+ | 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/25/03 PDT