44 strlcpy(buf, partyname,
sizeof(buf));
61 "You have formed party: %s",
66 lastparty->
next = party;
67 lastparty = lastparty->
next;
90 "You are already a member of party: %s",
99 "You have joined party: %s\n",
110 if (pl->party == party)
132 "You leave party %s.",
134 snprintf(buf,
sizeof(buf),
"%s leaves party %s.", op->
name, party->
partyname);
151 for (party = firstparty; party; party = party->
next) {
152 if (strcmp(party->
partyname, partyname) == 0)
169 previousparty = NULL;
170 for (walk = &firstparty; *walk != NULL; walk = &(*walk)->
next) {
171 if (*walk == party) {
172 if (party == lastparty)
173 lastparty = previousparty;
176 if (pl->
party == party)
184 previousparty = *walk;
186 LOG(
llevError,
"party_remove: I was asked to remove party %s, but it could not be found.\n",
218 for (party = firstparty; party != NULL; party = next) {
260 return strcmp(party->
passwd, password) == 0;
279 if (pl->party == party && pl !=
self)
296 #ifdef PARTY_KILL_LOG 309 void party_add_kill(
partylist *party,
const char *killer,
const char *dead,
long exp) {
312 if (party->kills >= PARTY_KILL_LOG) {
313 pos = PARTY_KILL_LOG-1;
314 for (i = 0; i < PARTY_KILL_LOG-1; i++)
315 memcpy(&(party->party_kills[i]), &(party->party_kills[i+1]),
sizeof(party->party_kills[0]));
319 party->total_exp += exp;
320 party->party_kills[pos].exp = exp;
321 strncpy(party->party_kills[pos].killer, killer,
MAX_NAME);
322 strncpy(party->party_kills[pos].dead, dead,
MAX_NAME);
323 party->party_kills[pos].killer[
MAX_NAME] = 0;
324 party->party_kills[pos].dead[
MAX_NAME] = 0;
const char * party_get_leader(const partylist *party)
Returns the name of the party's leader.
partylist * next
Next party in list.
void party_leave(object *op)
Makes a player leave his party.
void party_join(object *op, partylist *party)
Makes a player join a party.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
player * first_player
First player.
partylist * party
Party this player is part of.
static partylist * lastparty
Keeps track of last party in list.
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
player * next
Pointer to next player, NULL if this is last.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
#define MSG_TYPE_COMMAND_SUCCESS
Successful result from command.
#define MSG_TYPE_COMMAND_ERROR
Bad syntax/can't use command.
char * partyleader
Who is the leader.
char passwd[9]
Party password.
#define MSG_TYPE_COMMUNICATION
Communication between players.
char * partyname
Party name.
partylist * party_form(object *op, const char *partyname)
Forms the party struct for a party called 'partyname'.
partylist * party_get_first(void)
Returns the first party from the list of all parties.
static partylist * firstparty
Keeps track of first party in list.
#define MAX_BUF
Used for all kinds of things.
void replace_unprintable_chars(char *buf)
Replaces any unprintable character in the given buffer with a space.
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
void party_send_message(object *op, const char *message)
Send a message to all party members except the speaker.
partylist * party_find(const char *partyname)
Find a party by name.
static void remove_if_unused(partylist *party)
Remove party if it has no players.
sstring name
The name of the object, obviously...
void party_obsolete_parties(void)
Remove unused parties (no players).
void party_remove(partylist *party)
Removes and frees a party.
#define NDI_UNIQUE
Print immediately, don't buffer.
partylist * party_get_next(const partylist *party)
Returns the next party from the list of all parties.
const char * party_get_password(const partylist *party)
Returns the party's password.
void party_set_password(partylist *party, const char *password)
Sets a party's password.
int party_confirm_password(const partylist *party, const char *password)
Checks whether a given password matches the party's password.
#define MSG_TYPE_COMMUNICATION_PARTY
Party message.