Crossfire Server, Trunk  1.75.0
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)
 Add a new friendly object to the list of friendly objects. More...
 
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) More...
 
void clear_friendly_list (void)
 Totally clear the friendly list. More...
 
void dump_friendly_objects (void)
 Dumps all friendly objects. More...
 
objectlinkget_friends_of (const object *owner)
 Get a list of friendly objects for the specified owner. More...
 
objectget_next_friend (object *current)
 Get the next object on the friendly list. More...
 
int is_friendly (const object *op)
 Checks if the given object is already in the friendly list or not. More...
 
void remove_friendly_object (object *op)
 Removes the specified object from the linked list of friendly objects. More...
 

Variables

static std::vector< std::pair< object *, tag_t > > friends
 List of all friendly objects, object and its count. More...
 

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 object::count, friends, is_friendly(), llevError, LOG(), and object::name.

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(), 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 FLAG_FREED, FLAG_FRIENDLY, friends, llevDebug, LOG(), and QUERY_FLAG.

Referenced by do_specials().

+ 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().

+ 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 list.

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

+ 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 friends.

Referenced by cfapi_friendlylist_get_next(), and cfapi_system_get_object_vector().

+ 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(), and cfapi_object_set_property().

+ 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, object::count, FLAG_FRIENDLY, friends, llevError, LOG(), and object::name.

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(), 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