diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-05-27 17:33:59 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-05-29 05:37:56 +0200 |
commit | 33f06d33cc2f4cd3d36a9616f7f9e9abc7287080 (patch) | |
tree | 97754986db36d5d3082cadc92bc6b85c7f30ca9d /src | |
parent | 3c6ca071045f3ab2153db833c2be2b500a43880c (diff) |
Lua: Add "device_allocation_type" to support moving spells
Diffstat (limited to 'src')
-rw-r--r-- | src/externs.h | 1 | ||||
-rw-r--r-- | src/spells4.c | 18 | ||||
-rw-r--r-- | src/types.h | 18 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/externs.h b/src/externs.h index f76709d0..e622ea4c 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1923,6 +1923,7 @@ bool_ school_book_contains_spell(int sval, s32b spell_idx); void lua_cast_school_spell(s32b spell_idx, bool_ no_cost); void spell_description_add_line(s32b spell_idx, cptr line); +void device_allocation_init(device_allocation *device_allocation, byte tval); /* range.c */ extern void range_init(range_type *range, s32b min, s32b max); diff --git a/src/spells4.c b/src/spells4.c index ba97e065..e94274a2 100644 --- a/src/spells4.c +++ b/src/spells4.c @@ -601,3 +601,21 @@ void spell_description_add_line(s32b spell_idx, cptr line) { string_list_append(&school_spells[spell_idx].description, line); } + +void device_allocation_init(device_allocation *device_allocation, byte tval) +{ + assert(device_allocation != NULL); + + device_allocation->tval = tval; + device_allocation->rarity = 0; + range_init(&device_allocation->base_level, 0, 0); + range_init(&device_allocation->max_level, 0, 0); + device_allocation->next = NULL; +} + +int compare_device_allocation(device_allocation *a, device_allocation *b) +{ + return SGLIB_NUMERIC_COMPARATOR(a->tval, b->tval); +} + +SGLIB_DEFINE_LIST_FUNCTIONS(device_allocation, compare_device_allocation, next); diff --git a/src/types.h b/src/types.h index 5b349174..23df8af5 100644 --- a/src/types.h +++ b/src/types.h @@ -2442,6 +2442,24 @@ struct range_type /* + * Device allocation for skill + */ +typedef struct device_allocation device_allocation; +struct device_allocation +{ + byte tval; + s32b rarity; + range_type base_level; + range_type max_level; + /* Next device allocation in the list */ + device_allocation *next; +}; + +int compare_device_allocation(device_allocation *a, device_allocation *b); +SGLIB_DEFINE_LIST_PROTOTYPES(device_allocation, compare_device_allocation, next); + + +/* * Skills ! */ typedef struct skill_type skill_type; |