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; send_to_group(NULL, group, "%s has left the group.\r\n", GET_NAME(ch)); 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); if (GROUP_LEADER(group) == ch && group->members->iSize) { group->leader = (struct char_data *) random_from_list(group->members); send_to_group(NULL, group, "%s has assumed leadership of the group.\r\n", GET_NAME(GROUP_LEADER(group))); } else if (group->members->iSize == 0) free_group(group); }
inline void Sled_map::send_end_of_map() const { const size_t pkg_size = sizeof(protocol_t); uint8_t pkg[pkg_size]; // init protcol pkg init_proto_head(pkg, end_of_map, pkg_size); send_to_group( m_gamegrp, pkg, pkg_size ); }
void join_group(struct char_data *ch, struct group_data *group) { add_to_list(ch, group->members); if (group->leader == NULL) group->leader = ch; ch->group = group; if (IS_SET(group->group_flags, GROUP_NPC) && !IS_NPC(ch)) REMOVE_BIT(GROUP_FLAGS(group), GROUP_NPC); if (group->leader == ch) send_to_group(NULL, group, "%s becomes leader of the group.\r\n", GET_NAME(ch)); else send_to_group(NULL, group, "%s joins the group.\r\n", GET_NAME(ch)); }
void CheerSquadShow::new_rsp_cheer_squad_show_ok(game_group_t* grp) { uint8_t buf[256]; int len = sizeof(protocol_t); int flag = rand() % 2; PKG_UINT32(buf, flag, len); init_proto_head(buf, PROTO_cheer_squad_show_new_OK, len); if (!(grp->players[0])->tiles) return; send_to_group(grp, buf, len); }