Welcome to the Builder Academy

Question New Group System: Version 1.1

More
13 Jun 2012 02:17 #59 by Vatiken

CHANGELOG FROM 1.0 -> 1.1:
1) Fixed Memory Leak in free_group()
2) Moved from SimpleList to Iterated List for safety reason
3) Summoned Creatures now automatically join your group if you are the leader
4) Groups started by NPCs or inhabited by NPCS no longer appear on the group list
5) NPC and PC groups are identified when looking at the room.

Group System 1.1 Download

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
13 Jun 2012 02:44 - 13 Jun 2012 03:21 #60 by Halenbane
This is much appreciated. I had the prior group version working just fine, but a few errors im still tracking down while doing this.

act.other.c:362: error: expected identifier or '(' before 'if'
act.other.c:369: error: expected identifier or '(' before 'else'
act.other.c:372: error: expected identifier or '(' before '}' token

Code:
static void display_group_list(struct char_data * ch) { struct group_data * group; int count = 0; if (group_list->iSize) { send_to_char(ch, "# Group Leader # of Members In Zone\r\n" "---------------------------------------------------\r\n"); while ((group = (struct group_data *) simple_list(group_list)) != NULL) if (IS_SET(GROUP_FLAGS(group), GROUP_NPC)) continue; if (GROUP_LEADER(group) && !IS_SET(GROUP_FLAGS(group), GROUP_ANON)) send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n", ++count, IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM), GET_NAME(GROUP_LEADER(group)), group->members->iSize, zone_table[world[IN_ROOM(G$ CCNRM(ch, C_NRM)); else send_to_char(ch, "%-2d) Hidden\r\n", ++count); } } if (count) send_to_char(ch, "\r\n" "%sSeeking Members%s\r\n" "%sClosed%s\r\n", CCGRN(ch, C_NRM), CCNRM(ch, C_NRM), CCRED(ch, C_NRM), CCNRM(ch, C_NRM)); else send_to_char(ch, "\r\n" "Currently no groups formed.\r\n"); }



Also, weird thing is , the snip you have for spells.c , I don't seem to have

load_mtrigger(undead);
add_follower(undead, ch);

or

for (tobj = obj->contains; tobj; tobj = next_obj) {
next_obj = tobj->next_content;
obj_from_obj(tobj);

I don't recall deleting any portion of that code. My spells.c is only 451 lines..

Is this something maybe you have added to the source you are working on?
Last edit: 13 Jun 2012 03:21 by Vatiken. Reason: Code Tags

Please Log in or Create an account to join the conversation.

More
13 Jun 2012 02:57 #61 by Halenbane
Also I have noticed you reference to -528,6 +528,9 in the update, but spells.c sits around 450 lines or so. I double checked the one on SVN to make sure I wasn't just missing something in mine, and its around the same , 450 some.

Please Log in or Create an account to join the conversation.

More
13 Jun 2012 03:37 #62 by Vatiken
Code:
while ((group = (struct group_data *) simple_list(group_list)) != NULL)
Should be:
Code:
while ((group = (struct group_data *) simple_list(group_list)) != NULL) {
Thanks for pointing out the spells.c things, I just removed that from the file. It's unnecessary. The "update" is just an svn diff from my own MUD, and I have a custom animate dead spell in spells.c that uses that code. I also apologize if some of the formatting is a little weird, Geany (IDE) likes to hide tabs in the code, and I apparently missed removing a couple.

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
13 Jun 2012 03:42 #63 by Halenbane
Not tearing apart your code, just figured I would show what is coming up from a manual patch.

handler.c:1443: error: 'tch' undeclared (first use in this function)
handler.c:1443: error: (Each undeclared identifier is reported only once
handler.c:1443: error: for each function it appears in.)
handler.c:1443: error: 'Iterator' undeclared (first use in this function)
handler.c:1446: error: 'found_pc' undeclared (first use in this function)

Please Log in or Create an account to join the conversation.

More
13 Jun 2012 04:38 #64 by Vatiken
Looks like you forgot to add the top part:
Code:
@@ -1513,6 +1518,9 @@ void leave_group(struct char_data *ch) { struct group_data *group; + struct char_data *tch; + struct iterator_data Iterator; + bool found_pc = FALSE; if ((group = ch->group) == NULL) return; @@ -1522,6 +1530,14 @@ remove_from_list(ch, group->members); ch->group = NULL; + if (group->members->iSize) + for (tch = (struct char_data *) merge_iterator(&Iterator, group->members); + tch; + tch = next_in_list(&Iterator)) + if (!IS_NPC(tch)) found_pc = TRUE; + + remove_iterator(&Iterator); + + if (!found_pc) + SET_BIT(GROUP_FLAGS(group), GROUP_NPC);

tbaMUD developer/programmer
The following user(s) said Thank You: Halenbane

Please Log in or Create an account to join the conversation.

Time to create page: 0.207 seconds