Crossfire Server, Trunk
friend.cpp File Reference
#include "global.h"
#include <stdlib.h>
+ Include dependency graph for friend.cpp:

Go to the source code of this file.

Functions

void add_friendly_object (object *op)
 
void clean_friendly_list (void)
 
void clear_friendly_list (void)
 
void dump_friendly_objects (void)
 
objectlinkget_friends_of (const object *owner)
 
objectget_next_friend (object *current)
 
int is_friendly (const object *op)
 
void remove_friendly_object (object *op)
 

Variables

static std::vector< std::pair< object *, tag_t > > friends
 

Detailed Description

Functions related to relationship management.

Definition in file friend.cpp.

Function Documentation

◆ add_friendly_object()

void add_friendly_object ( object op)

Add a new friendly object to the list of friendly objects. Will log an error if the object is already on that list.

Parameters
opobject to add to the list.

Definition at line 32 of file friend.cpp.

References friends, is_friendly(), llevError, LOG(), and give::op.

Referenced by add_player(), animate_weapon(), cfapi_object_set_property(), change_object(), do_mood_floor(), fix_summon_pet(), mood_change(), pets_summon_golem(), pets_summon_object(), polymorph_living(), receive_play_again(), START_TEST(), use_oratory(), and while().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clean_friendly_list()

void clean_friendly_list ( void  )

It traverses the friendly list removing objects that should not be here (ie, do not have friendly flag set, freed, etc)

Definition at line 80 of file friend.cpp.

References disinfect::count, FLAG_FREED, FLAG_FRIENDLY, friends, say::item, llevDebug, LOG(), and QUERY_FLAG.

Referenced by do_specials(), and START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear_friendly_list()

void clear_friendly_list ( void  )

Totally clear the friendly list.

Definition at line 134 of file friend.cpp.

References friends.

Referenced by free_globals(), and teardown().

+ Here is the caller graph for this function:

◆ dump_friendly_objects()

void dump_friendly_objects ( void  )

Dumps all friendly objects. Invoked in DM-mode with dumpfriendlyobjects command.

Note
logs at the error level.

Definition at line 70 of file friend.cpp.

References friends.

Referenced by command_dumpfriendlyobjects().

+ Here is the caller graph for this function:

◆ get_friends_of()

objectlink* get_friends_of ( const object owner)

Get a list of friendly objects for the specified owner.

Parameters
ownerwho to get objects of, may be NULL to get all friendly objects.
Returns
list of objects that must be freed with free_objectlink(), may be NULL.

Definition at line 117 of file friend.cpp.

References friends, and guildoracle::list.

Referenced by command_kill_pets(), command_showpets(), get_nearest_player(), pets_attempt_follow(), pets_terminate_all(), and START_TEST().

+ Here is the caller graph for this function:

◆ get_next_friend()

object* get_next_friend ( object current)

Get the next object on the friendly list.

Parameters
currentcurrent object, NULL to get the first item on the list.
Returns
next item, NULL if no more items or current isn't on the list.

Definition at line 143 of file friend.cpp.

References replace::current, and friends.

Referenced by cfapi_friendlylist_get_next(), cfapi_system_get_object_vector(), and START_TEST().

+ Here is the caller graph for this function:

◆ is_friendly()

int is_friendly ( const object op)

Checks if the given object is already in the friendly list or not

Parameters
opitem to check
Returns
1 if on friendly list, 0 else

Definition at line 108 of file friend.cpp.

References friends.

Referenced by add_friendly_object(), cfapi_object_get_property(), cfapi_object_set_property(), and START_TEST().

+ Here is the caller graph for this function:

◆ remove_friendly_object()

void remove_friendly_object ( object op)

Removes the specified object from the linked list of friendly objects.

Parameters
opobject to remove from list.

Definition at line 52 of file friend.cpp.

References CLEAR_FLAG, FLAG_FRIENDLY, friends, llevError, LOG(), and give::op.

Referenced by cfapi_object_set_property(), change_object(), command_cast_spell(), command_kill_pets(), do_mood_floor(), enter_map(), hit_player(), kill_object(), kill_player_permadeath(), monster_move(), mood_change(), object_clear(), object_free(), pets_attempt_follow(), pets_get_enemy(), pets_move(), pets_move_golem(), pets_terminate_all(), polymorph_living(), receive_play_again(), START_TEST(), and use_oratory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ friends

std::vector<std::pair<object *, tag_t> > friends
static