![]() |
Crossfire Server, Trunk
1.75.0
|
#include "global.h"
#include <ctype.h>
#include <stdlib.h>
#include "loader.h"
#include <map>
#include "assets.h"
#include "AssetsManager.h"
Go to the source code of this file.
Functions | |
object * | arch_to_object (archetype *at) |
Creates and returns a new object which is a copy of the given archetype. More... | |
object * | create_archetype (const char *name) |
Finds which archetype matches the given name, and returns a new object containing a copy of the archetype. More... | |
object * | create_archetype_by_object_name (const char *name) |
Creates an object given the name that appears during the game (for example, "writing pen" instead of "stylus"). More... | |
object * | create_singularity (const char *name) |
Creates a dummy object. More... | |
void | dump_all_archetypes (void) |
Dumps all archetypes to debug-level output. More... | |
void | dump_arch (archetype *at, StringBuffer *sb) |
Dumps an archetype to buffer. More... | |
archetype * | find_archetype_by_object_name (const char *name) |
This function retrieves an archetype given the name that appears during the game (for example, "writing pen" instead of "stylus"). More... | |
archetype * | find_archetype_by_object_type_name (int type, const char *name) |
This function retrieves an archetype by type and name that appears during the game. More... | |
void | free_arch (archetype *at) |
Frees archetype. More... | |
archetype * | get_archetype_by_skill_name (const char *skill, int type) |
Retrieves an archetype by skill name and type. More... | |
archetype * | get_archetype_by_type_subtype (int type, int subtype) |
Retrieves an archetype by type and subtype. More... | |
archetype * | get_archetype_struct (void) |
Allocates, initialises and returns the pointer to an archetype structure. More... | |
object * | object_create_arch (archetype *at) |
Create a full object using the given archetype. More... | |
All archetype-related functions.
Definition in file arch.cpp.
Creates and returns a new object which is a copy of the given archetype.
This function returns NULL if given a NULL pointer, else an object.
at | archetype from which to get an object. |
Definition at line 227 of file arch.cpp.
References object::arch, archetype::clone, llevError, LOG(), object_copy_with_inv(), and object_new().
Referenced by add_abilities(), add_one_item(), animate_bomb(), animate_weapon(), apply_builder_floor(), apply_builder_window(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_cone(), cast_consecrate(), cast_curse(), cast_destruction(), cast_detection(), cast_heal(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), change_luck(), change_object(), command_create(), cone_drop(), create_archetype(), create_archetype_by_object_name(), create_aura(), create_bomb(), create_player_cmd(), do_single_item(), do_turn(), dragon_ability_gain(), drain_specific_stat(), eat_special_food(), explode_bullet(), fire_arch_from_position(), fire_bolt(), fire_swarm(), fix_container_multipart(), fix_summon_pet(), fix_walls(), get_npc(), get_player(), get_spell_by_name(), give_skill_by_name(), god_gives_present(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), magic_wall(), make_map_floor(), make_map_walls(), mood_change(), move_aura(), move_ball_spell(), move_symptom(), object_create_arch(), object_fix_multipart(), object_replace_insert_in_map(), pets_summon_object(), pick_joined_wall(), place_exits(), poison_living(), potion_type_apply(), print_monsters(), put_a_monster(), put_decor(), put_doors(), put_floor(), put_in_icecube(), recipe_get_face(), remove_door(), remove_locked_door(), retrofit_joined_wall(), save_object_in_sb(), slow_living_by(), spell_effect(), spring_trap(), town_portal_find_force(), write_mark(), and write_rune().
object* create_archetype | ( | const char * | name | ) |
Finds which archetype matches the given name, and returns a new object containing a copy of the archetype.
name | archetype name |
Definition at line 276 of file arch.cpp.
References arch_to_object(), create_singularity(), name, and try_find_archetype().
Referenced by add_force(), alchemy_failure_effect(), apply_handle_yield(), become_follower(), blind_living(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_create_missile(), cast_create_town_portal(), cast_curse(), cast_spell(), cast_word_of_recall(), change_book(), charge_mana_effect(), command_use(), confuse_living(), converter_type_move_on(), create_aura(), dialog_preparse(), do_item_conversion(), do_symptoms(), eat_special_food(), examine_monster(), find_or_create_connection_for_map(), find_transmution_ob(), fire_swarm(), fix_generated_item(), get_npc(), god_examines_priest(), god_intervention(), grant_immunity(), keyplace(), kill_player_not_permadeath(), locate_recipe_artifact(), lock_and_hide_doors(), make_object_glow(), object_handle_death_animation(), place_alchemy_objects(), place_chest(), place_exits(), potion_type_apply(), pray_at_altar(), prayer_failure(), put_a_monster(), recharge(), save_throw_object(), scroll_failure(), spell_failure(), surround_by_doors(), swap_random_stats(), town_portal_destroy_existing(), transmute_item_to_flower(), trap_show(), and write_rune().
object* create_archetype_by_object_name | ( | const char * | name | ) |
Creates an object given the name that appears during the game (for example, "writing pen" instead of "stylus").
name | the name we're searching for (ex: "writing pen"), must not be null |
Definition at line 114 of file arch.cpp.
References arch_to_object(), AssetsManager::archetypes(), create_singularity(), Archetypes::findByObjectName(), getManager(), MAX_BUF, and name.
Referenced by check_loaded_object(), and god_intervention().
object* create_singularity | ( | const char * | name | ) |
Creates a dummy object.
This function is called by get_archetype() if it fails to find the appropriate archetype. Thus get_archetype() will be guaranteed to always return an object, and never NULL.
name | name to give the dummy object. |
Definition at line 253 of file arch.cpp.
References add_string(), object::arch, ARCH_SINGULARITY, buf, empty_archetype, FLAG_NO_PICK, MAX_BUF, name, object::name, object::name_pl, object_new(), and SET_FLAG.
Referenced by create_archetype(), and create_archetype_by_object_name().
void dump_all_archetypes | ( | void | ) |
Dumps all archetypes to debug-level output.
If you run crossfire with debug, and enter DM-mode, you can trigger this with the "dumpallarchetypes" command.
Definition at line 148 of file arch.cpp.
References AssetsManager::archetypes(), dump_arch(), AssetsCollection< T, Key >::each(), getManager(), llevDebug, LOG(), stringbuffer_finish(), and stringbuffer_new().
Referenced by command_dumpallarchetypes().
void dump_arch | ( | archetype * | at, |
StringBuffer * | sb | ||
) |
Dumps an archetype to buffer.
at | archetype to dump. Must not be NULL. |
sb | buffer that will contain dumped information. |
Definition at line 139 of file arch.cpp.
References archetype::clone, and object_dump().
Referenced by dump_all_archetypes().
archetype* find_archetype_by_object_name | ( | const char * | name | ) |
This function retrieves an archetype given the name that appears during the game (for example, "writing pen" instead of "stylus").
It does not use the hashtable system, but browse the whole archlist each time. I suggest not to use it unless you really need it because of performance issue. It is currently used by scripting extensions (create-object). Params:
name | the name we're searching for (ex: "writing pen") |
Definition at line 51 of file arch.cpp.
References AssetsManager::archetypes(), Archetypes::findByObjectName(), getManager(), and name.
Referenced by artifact_describe(), artifact_get_face(), cfapi_object_create(), command_create(), knowledge_god_detail(), and knowledge_god_validate().
archetype* find_archetype_by_object_type_name | ( | int | type, |
const char * | name | ||
) |
This function retrieves an archetype by type and name that appears during the game.
It is basically the same as find_archetype_by_object_name() except that it considers only items of the given type.
type | item type we're searching |
name | the name we're searching for (ex: "writing pen") |
Definition at line 64 of file arch.cpp.
References AssetsManager::archetypes(), Archetypes::findByObjectTypeName(), getManager(), name, and is_valid_types_gen::type.
Referenced by cast_create_food().
void free_arch | ( | archetype * | at | ) |
Frees archetype.
at | archetype to free. Pointer becomes invalid after the call. |
Definition at line 167 of file arch.cpp.
References archetype::clone, free_string(), object::msg, object::name, archetype::name, object::name_pl, object_free_key_values(), object::race, object::slaying, and object::title.
Referenced by asset_destroy(), object_free(), and Archetypes::replace().
archetype* get_archetype_by_skill_name | ( | const char * | skill, |
int | type | ||
) |
Retrieves an archetype by skill name and type.
This is a lot like the other get_archetype_ functions, with different options.
skill | skill to search for. Must not be NULL. |
type | item type to search for. -1 means that it doesn't matter. |
Definition at line 78 of file arch.cpp.
References AssetsManager::archetypes(), Archetypes::findBySkillNameAndType(), getManager(), skill, and is_valid_types_gen::type.
Referenced by examine_fluff(), and give_skill_by_name().
archetype* get_archetype_by_type_subtype | ( | int | type, |
int | subtype | ||
) |
Retrieves an archetype by type and subtype.
Similiar to other get_archetype_ functions. This returns the first archetype that matches both the type and subtype. type and subtype can be -1 to say ignore, but in this case, the match it does may not be very useful. This function is most useful when subtypes are known to be unique for a particular type (eg, skills)
type | object type to search for. -1 means any |
subtype | object subtype to search for. -1 means any |
Definition at line 97 of file arch.cpp.
References AssetsManager::archetypes(), Archetypes::findByTypeSubtype(), getManager(), and is_valid_types_gen::type.
Referenced by become_follower(), create_player_cmd(), init_dynamic(), and write_on_item().
archetype* get_archetype_struct | ( | void | ) |
Allocates, initialises and returns the pointer to an archetype structure.
Definition at line 193 of file arch.cpp.
References object::arch, CALLOC, CLEAR_FLAG, archetype::clone, fatal(), FLAG_FREED, FLAG_REMOVED, archetype::head, archetype::more, object::msg, object::name, archetype::name, object::name_pl, object_clear(), object::other_arch, OUT_OF_MEMORY, object::race, SET_FLAG, object::slaying, and object::title.
Referenced by asset_create(), check_loaded_object(), and ArchetypeLoader::load().
Create a full object using the given archetype.
This instanciate not only the archetype but also all linked archetypes in case of multisquare archetype.
at | archetype to instanciate. Must not be NULL. |
Definition at line 296 of file arch.cpp.
References arch_to_object(), archetype::clone, object::head, object::more, archetype::more, object::x, and object::y.
Referenced by apply_map_builder(), cast_detection(), cfapi_object_create(), command_create(), do_harvest(), do_item_conversion(), include_map_in_map(), move_creator(), msgfile_msg(), place_monsters(), and polymorph_living().