Crossfire Server, Branches 1.12  R18729
c_party.c File Reference
#include <global.h>
#include <sproto.h>
#include <spells.h>
+ Include dependency graph for c_party.c:

Go to the source code of this file.

Functions

int command_gsay (object *op, char *params)
 
int command_party (object *op, char *params)
 
int command_party_rejoin (object *op, char *params)
 
int confirm_party_password (object *op)
 
partylistform_party (object *op, const char *params)
 
partylistget_firstparty (void)
 
void obsolete_parties (void)
 
static void party_help (object *op)
 
void receive_party_password (object *op)
 
void remove_party (partylist *target_party)
 
void send_party_message (object *op, char *msg)
 

Variables

static partylistfirstparty = NULL
 
static partylistlastparty = NULL
 
static const char * rejoin_modes []
 

Detailed Description

Party-related functions and variables.

Definition in file c_party.c.

Function Documentation

int command_gsay ( object op,
char *  params 
)

'gsay' command, talks to party.

Parameters
opplayer.
paramsmessage.
Returns
0.

Definition at line 304 of file c_party.c.

References command_party(), draw_ext_info(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, and NDI_UNIQUE.

+ Here is the call graph for this function:

int command_party ( object op,
char *  params 
)

'party' command, subdivided in different sub commands.

Parameters
opplayer.
paramsadditional parameters. 1.
Todo:
split in different functions. clean the 'form' mess.

Definition at line 350 of file c_party.c.

References obj::contr, draw_ext_info(), draw_ext_info_format(), first_player, firstparty, form_party(), get_party_password(), party_struct::kills, list_players(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, MSG_TYPE_COMMUNICATION, MSG_TYPE_COMMUNICATION_PARTY, obj::name, NDI_UNIQUE, NDI_WHITE, party_struct::next, pl::next, pl::party, party_help(), party_struct::partyleader, party_struct::partyname, party_struct::passwd, remove_party(), replace_unprintable_chars(), send_party_message(), snprintf(), and party_struct::total_exp.

Referenced by command_gsay().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int command_party_rejoin ( object op,
char *  params 
)

Handles the 'party_rejoin' command.

Parameters
opplayer.
paramsoptional parameters.
Returns
1.

Definition at line 688 of file c_party.c.

References obj::contr, draw_ext_info_format(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, and pl::rejoin_party.

+ Here is the call graph for this function:

int confirm_party_password ( object op)

Is the password the player entered to join a party the right one?

Parameters
opplayer. Must have party_to_join correctly set.
Return values
0password is correct.
1invalid password or party not found.

Definition at line 228 of file c_party.c.

References obj::contr, party_struct::next, pl::party_to_join, party_struct::partyname, party_struct::passwd, and pl::write_buf.

Referenced by receive_party_password().

+ Here is the caller graph for this function:

partylist* form_party ( object op,
const char *  params 
)

Forms the party struct for a party called 'params'. it is the responsibility of the caller to ensure that the name is unique. New item is placed on the party list.

Parameters
opparty creator.
paramsparty name.
Returns
new party.

Definition at line 65 of file c_party.c.

References obj::contr, draw_ext_info_format(), firstparty, party_struct::kills, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, obj::name, NDI_UNIQUE, party_struct::next, pl::party, party_struct::partyleader, party_struct::partyname, party_struct::passwd, replace_unprintable_chars(), send_party_message(), snprintf(), strdup_local(), and party_struct::total_exp.

Referenced by check_login(), command_party(), and START_TEST().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

partylist* get_firstparty ( void  )

Simple wrapper to get firstparty.

Returns
firstparty.

Definition at line 48 of file c_party.c.

References firstparty.

Referenced by cfapi_party_get_property(), check_login(), and START_TEST().

+ Here is the caller graph for this function:

void obsolete_parties ( void  )

Remove unused parties (no players), this could be made to scale a lot better.

Definition at line 165 of file c_party.c.

References first_player, party_struct::next, pl::next, pl::party, and remove_party().

Referenced by do_specials(), and START_TEST().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void party_help ( object op)
static

Give help for party commands.

Parameters
opplayer.

Definition at line 323 of file c_party.c.

References draw_ext_info(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_HELP, and NDI_UNIQUE.

Referenced by command_party().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void receive_party_password ( object op)

Player entered a party password.

Parameters
opplayer.

Definition at line 248 of file c_party.c.

References confirm_party_password(), obj::contr, draw_ext_info(), draw_ext_info_format(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, obj::name, NDI_UNIQUE, pl::party, pl::party_to_join, party_struct::partyname, send_party_message(), snprintf(), ST_PLAYING, and pl::state.

Referenced by reply_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void remove_party ( partylist target_party)

Remove and free party.

Parameters
target_partyparty to remove.
Todo:
clean/simplify the mess.

Definition at line 106 of file c_party.c.

References first_player, llevError, LOG(), party_struct::next, pl::next, pl::party, party_struct::partyleader, and party_struct::partyname.

Referenced by command_party(), obsolete_parties(), and START_TEST().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void send_party_message ( object op,
char *  msg 
)

Send a message to all party members except the speaker.

Parameters
opplayer talking.
msgmessage to send.

Definition at line 285 of file c_party.c.

References obj::contr, draw_ext_info(), first_player, MSG_TYPE_COMMUNICATION, MSG_TYPE_COMMUNICATION_PARTY, NDI_WHITE, pl::next, pl::ob, and pl::party.

Referenced by check_login(), command_party(), form_party(), and receive_party_password().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

partylist* firstparty = NULL
static

Keeps track of first party in list

Definition at line 40 of file c_party.c.

Referenced by command_party(), form_party(), and get_firstparty().

partylist* lastparty = NULL
static

Keeps track of last party in list

Definition at line 41 of file c_party.c.

const char* rejoin_modes[]
static
Initial value:
= {
"no",
"if_exists",
"always",
NULL
}

Valid modes for 'party_rejoin'.

Todo:
document that

Definition at line 672 of file c_party.c.