Crossfire Server, Trunk
lightable.cpp File Reference
#include "global.h"
#include "ob_methods.h"
#include "sproto.h"
+ Include dependency graph for lightable.cpp:

Go to the source code of this file.

Functions

void init_type_lightable (void)
 
static uint8_t is_better_lighter (object *current, object *old)
 
static method_ret lightable_type_apply (object *lightable, object *applier, int aflags)
 

Detailed Description

Implementation of the Lightable class of objects.

This allows us to make lightable objects be lit by simply applying them, rather than by marking the lightable item, then applying the lighter.

Definition in file lightable.cpp.

Function Documentation

◆ init_type_lightable()

void init_type_lightable ( void  )

Initializer for the LIGHTABLE object type.

Definition at line 32 of file lightable.cpp.

References LIGHTABLE, lightable_type_apply(), and register_apply().

Referenced by register_all_ob_types().

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

◆ is_better_lighter()

static uint8_t is_better_lighter ( object current,
object old 
)
static

Method to clean up priority calculations

Priority goes in this order: WEAPON -> highest priority, use first encountered SKILL -> flame touch or clawing only LIGHTER -> next priority, prioritize ones with speed, as they will decay on their own. SPELL -> next priority, lower mana cost is better (ignores level scaling, since we are using that spell in a careful, low-energy way) SKILL, SKILL_TOOL -> fire magic skills only. Uses 10 mana.

Parameters
currentThe item we are checking to see if it's better.
oldThe previous best tool we found. Can be NULL.
Returns
1 if new_tool is better than old_tool, else 0 returns 2 for debugging purposes if something slips through the logic

Definition at line 56 of file lightable.cpp.

References replace::current, liv::grace, LIGHTER, SK_CLAWING, SK_FLAME_TOUCH, SKILL, SKILL_TOOL, liv::sp, obj::speed, SPELL, obj::stats, obj::subtype, obj::type, and WEAPON.

Referenced by lightable_type_apply().

+ Here is the caller graph for this function:

◆ lightable_type_apply()

static method_ret lightable_type_apply ( object lightable,
object applier,
int  aflags 
)
static

Attempt to find a lighter, wielded fire weapon, or fire spell to light with.

Parameters
lightableThe lightable object we applied.
applierThe object applying the lightable object. Usually will be a player, but not guaranteed.
aflagsspecial flags (always apply/unapply)
Returns
METHOD_OK. Even when we fail to light the object, we did handle the apply, so it would not be unhandled.

Definition at line 106 of file lightable.cpp.

References apply_manual(), AT_FIRE, obj::attacktype, obj::contr, obj::count, obj::current_weapon, do_light(), draw_ext_info_format(), find_marked_object(), FLAG_CURSED, FLAG_DAMNED, FOR_INV_FINISH, FOR_INV_PREPARE, liv::grace, is_better_lighter(), LIGHTER, pl::mark, pl::mark_count, METHOD_OK, MSG_TYPE_APPLY, MSG_TYPE_APPLY_FAILURE, obj::name, NDI_UNIQUE, PLAYER, QUERY_FLAG, SK_CLAWING, SK_FIRE_MAGIC, SK_FLAME_TOUCH, SK_PYROMANCY, SKILL, SKILL_TOOL, liv::sp, SPELL, obj::stats, obj::subtype, Ice::tmp, obj::type, and WEAPON.

Referenced by init_type_lightable().

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