I'm having a rough time with deleting clans because everytime I do, it
completely screws the player_table up (I think). After I issue the command
to delete a clan, I can't mail or do other happy things like that.
I've attached then entire function below. If anyone sees where this may be
getting stuffy, please gimme a holler (or if you need to see branching
functions).
void clan_destroy (struct char_data *ch, char *arg)
{
int i,j;
extern int top_of_p_table;
struct char_file_u chdata;
struct char_data *victim=NULL;
if (!*arg) {
send_clan_format(ch);
return;
}
i = atoi(arg);
if (i < 0 || i > num_of_clans - 1) {
send_to_char("Unknown clan.\r\n", ch);
return;
}
if(GET_LEVEL(ch)<LVL_CLAN_GOD) {
send_to_char("Your not mighty enough to destroy clans!\r\n", ch);
return;
}
if(i == 0) {
send_to_char("You can't delete the 0 placeholder!\r\n", ch);
return;
}
for (j = 0; j <= top_of_p_table; j++) {
if((victim=is_playing((player_table +j)->name))) {
if(GET_CLAN(victim)== i) {
GET_CLAN(victim)= -1;
GET_CLAN_RANK(victim)=-1;
save_char(victim, victim->in_room);
}
else if(GET_CLAN(victim) > i)
GET_CLAN(victim) -= 1;
}
else {
load_char((player_table + j)->name, &chdata);
if(chdata.player_specials_saved.clan== i) {
chdata.player_specials_saved.clan=-1;
chdata.player_specials_saved.clan_rank=-1;
save_char_file_u(chdata);
}
else if(chdata.player_specials_saved.clan > i) {
chdata.player_specials_saved.clan -= 1;
save_char_file_u(chdata);
}
}
}
memset(&clan[i], sizeof(struct clan_info), 0);
for (j = i; j < num_of_clans - 1; j++) {
clan[j] = clan[j + 1];
clan[j].number = j - 1;
}
num_of_clans--;
send_to_char("Clan deleted.\r\n", ch);
save_clans();
return;
}
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST