version 1.14 | | version 1.15 |
---|
| | |
/* | | /* |
* static char *rcsid_c_party_c = | | * static char *rcsid_c_party_c = |
* "$Id: c_party.c,v 1.14 2005/09/25 02:15:45 cavesomething Exp $"; | | * "$Id: c_party.c,v 1.15 2005/09/25 09:47:23 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
static partylist * firstparty=NULL; /* Keeps track of first party in list */ | | static partylist * firstparty=NULL; /* Keeps track of first party in list */ |
static partylist * lastparty=NULL; /*Keeps track of last party in list */ | | static partylist * lastparty=NULL; /*Keeps track of last party in list */ |
| | |
| | void remove_party(partylist *target_party); |
| | |
/* Forms the party struct for a party called 'params'. it is the responsibility | | /* Forms the party struct for a party called 'params'. it is the responsibility |
* of the caller to ensure that the name is unique, and that it is placed in the | | * of the caller to ensure that the name is unique, and that it is placed in the |
* main party list correctly */ | | * main party list correctly */ |
| | |
return newparty; | | return newparty; |
} | | } |
| | |
int remove_party(partylist *target_party) { | | void remove_party(partylist *target_party) { |
partylist *tmpparty; | | partylist *tmpparty; |
partylist *previousparty; | | partylist *previousparty; |
partylist *nextparty; | | partylist *nextparty; |
| | |
if (firstparty==NULL) { | | if (firstparty==NULL) { |
LOG(llevError, "remove_party(): I was asked to remove party %s, but no parties are defined", | | LOG(llevError, "remove_party(): I was asked to remove party %s, but no parties are defined", |
target_party->partyname); | | target_party->partyname); |
return 1; | | return; |
} | | } |
for (pl=first_player;pl!=NULL;pl=pl->next) | | for (pl=first_player;pl!=NULL;pl=pl->next) |
if (pl->party==target_party) pl->party=NULL; | | if (pl->party==target_party) pl->party=NULL; |
| | |
if (target_party->partyleader) free(target_party->partyleader); | | if (target_party->partyleader) free(target_party->partyleader); |
if (target_party->partyname) free(target_party->partyname); | | if (target_party->partyname) free(target_party->partyname); |
free(target_party); | | free(target_party); |
return 0; | | return; |
} | | } |
else if (target_party == lastparty) { | | else if (target_party == lastparty) { |
for (tmpparty=firstparty;tmpparty->next!=NULL;tmpparty->next) { | | for (tmpparty=firstparty;tmpparty->next!=NULL;tmpparty->next) { |
| | |
if (target_party->partyleader) free(target_party->partyleader); | | if (target_party->partyleader) free(target_party->partyleader); |
if (target_party->partyname) free(target_party->partyname); | | if (target_party->partyname) free(target_party->partyname); |
free(target_party); | | free(target_party); |
return 0; | | return; |
} | | } |
} | | } |
} | | } |
| | |
if (target_party->partyleader) free(target_party->partyleader); | | if (target_party->partyleader) free(target_party->partyleader); |
if (target_party->partyname) free(target_party->partyname); | | if (target_party->partyname) free(target_party->partyname); |
free(target_party); | | free(target_party); |
return 0; | | return; |
} | | } |
} | | } |
| | |
| | |
} /* form */ | | } /* form */ |
| | |
if(strcmp(params, "leave")==0) { | | if(strcmp(params, "leave")==0) { |
int player_count; | | |
player *pl; | | |
if(op->contr->party==NULL) | | if(op->contr->party==NULL) |
{ | | { |
new_draw_info(NDI_UNIQUE, 0,op,"You are not a member of any party."); | | new_draw_info(NDI_UNIQUE, 0,op,"You are not a member of any party."); |