#include "cell.h"#include "main.h"#include "genmacro.h"

Data Structures | |
| struct | item |
| Structure for storing items in the game. More... | |
| struct | item_container |
| Container of items. More... | |
Defines | |
| #define | ITEM 3 |
| #define | WEAPONS 0 |
| #define | ARMOR 1 |
| #define | TOOLS 2 |
| #define | FOOD 3 |
| #define | COINS 4 |
| #define | KEYS 5 |
| #define | SUPPLIES 6 |
| #define | POTIONS 7 |
| #define | NO_SUBCLASS -1 |
| #define | KNIVES 0 |
| #define | SWORDS 1 |
| #define | BOWS_AND_CROSSBOWS 5 |
| #define | LEATHER 2 |
| #define | MAIL_ARMOR 3 |
| #define | PLATE_ARMOR 4 |
| #define | SUBSTANCES 6 |
| #define | ARROWS 7 |
| #define | ONE_COLOR_POTION 1 |
| #define | TWO_COLORS_POTION 2 |
| #define | WHITE_POTION 3 |
| #define | BLACK_POTION 4 |
| #define | DA_BRACE 0 |
| #define | DIGGER 1 |
| #define | BOW 2 |
| #define | DA_ARMOR 0 |
| #define | LEATHER_ARMOR 1 |
| #define | STUDDED_LEATHER 2 |
| #define | ENCHANTED_LEATHER 3 |
| #define | RING_MAIL 4 |
| #define | CHAIN_MAIL 5 |
| #define | STEEL_CHAIN_MAIL 6 |
| #define | DAGGER 0 |
| #define | LONG_DAGGER 1 |
| #define | LONG_SWORD 2 |
| #define | BROAD_SWORD 3 |
| #define | PROTOBLOOD_VIAL 0 |
| #define | FOOD_RATION 1 |
| #define | MOLD_CORPSE 2 |
| #define | HM_PROTOBLOOD 3 |
| #define | ORC_CORPSE 4 |
| #define | TROLL_LEG 5 |
| #define | COPPER 0 |
| #define | SILVER 1 |
| #define | GOLD 2 |
| #define | ARROW 0 |
| #define | VIAL 1 |
| #define | RED_SUBSTANCE 2 |
| #define | BLUE_SUBSTANCE 3 |
| #define | YELLOW_SUBSTANCE 4 |
| #define | YELLOW 0 |
| #define | RED 1 |
| #define | BLUE 2 |
| #define | PURPLE 3 |
| #define | ORANGE 4 |
| #define | GREEN 5 |
| #define | GEN_ITEMS(macro_ld_arg,...) {int quantity; float r; struct leveldata macro_ld = macro_ld_arg; __VA_ARGS__} |
| #define | SET_QUANTITY(...) r = (float)(rand())/(float)(RAND_MAX); __VA_ARGS__ |
| #define | BIND_QUANTITY_PROBABILITY(min, max, num) if ((r>min) && (r<max)) quantity = num; |
| #define | ADD_ITEM_TO_LEVEL_MACRO(...) |
| #define | NO_KEY_CMP 0 |
| #define | KEY_CMP 1 |
Functions | |
| void | generate_items (struct leveldata ld) |
| Generates items on level. | |
| void | place_random (struct leveldata ld, struct item it) |
| Puts an item onto random free cell on level. | |
| char | get_key (struct item *inv, int n, struct item itm) |
| Returns/generates struct item::key value for item. | |
| int | compare_items (struct item i1, struct item i2, int mode) |
| Compares 2 items. | |
| char * | makesuggestion (struct item *inv, int n, int class) |
| Retuns keys of items with current class. | |
| int | find_item (struct item *inv, int n, struct item itm) |
| Finds an item. | |
| int | remove_item (struct item *inv, int *n, struct item itm) |
| Removes an item from inventory. | |
| void | add_item (struct item *inv, int *n, struct item itm) |
| Adds an item to inventory. | |
| #define ADD_ITEM_TO_LEVEL_MACRO | ( | ... | ) |
{struct item it; \
__VA_ARGS__ int counter; for (counter=0; counter<quantity; counter++) place_random (macro_ld, it);}
| #define ARMOR 1 |
| #define ARROW 0 |
| #define ARROWS 7 |
| #define BIND_QUANTITY_PROBABILITY | ( | min, | |||
| max, | |||||
| num | ) | if ((r>min) && (r<max)) quantity = num; |
| #define BLACK_POTION 4 |
| #define BLUE 2 |
| #define BLUE_SUBSTANCE 3 |
| #define BOW 2 |
| #define BOWS_AND_CROSSBOWS 5 |
| #define BROAD_SWORD 3 |
| #define CHAIN_MAIL 5 |
| #define COINS 4 |
| #define COPPER 0 |
| #define DA_ARMOR 0 |
| #define DA_BRACE 0 |
| #define DAGGER 0 |
| #define DIGGER 1 |
| #define ENCHANTED_LEATHER 3 |
| #define FOOD 3 |
| #define FOOD_RATION 1 |
| #define GEN_ITEMS | ( | macro_ld_arg, | |||
| ... | ) | {int quantity; float r; struct leveldata macro_ld = macro_ld_arg; __VA_ARGS__} |
| #define GOLD 2 |
| #define GREEN 5 |
| #define HM_PROTOBLOOD 3 |
| #define ITEM 3 |
| #define KEY_CMP 1 |
| #define KEYS 5 |
| #define KNIVES 0 |
| #define LEATHER 2 |
| #define LEATHER_ARMOR 1 |
| #define LONG_DAGGER 1 |
| #define LONG_SWORD 2 |
| #define MAIL_ARMOR 3 |
| #define MOLD_CORPSE 2 |
| #define NO_KEY_CMP 0 |
| #define NO_SUBCLASS -1 |
| #define ONE_COLOR_POTION 1 |
| #define ORANGE 4 |
| #define ORC_CORPSE 4 |
| #define PLATE_ARMOR 4 |
| #define POTIONS 7 |
| #define PROTOBLOOD_VIAL 0 |
| #define PURPLE 3 |
| #define RED 1 |
| #define RED_SUBSTANCE 2 |
| #define RING_MAIL 4 |
| #define SET_QUANTITY | ( | ... | ) | r = (float)(rand())/(float)(RAND_MAX); __VA_ARGS__ |
| #define SILVER 1 |
| #define STEEL_CHAIN_MAIL 6 |
| #define STUDDED_LEATHER 2 |
| #define SUBSTANCES 6 |
| #define SUPPLIES 6 |
| #define SWORDS 1 |
| #define TOOLS 2 |
| #define TROLL_LEG 5 |
| #define TWO_COLORS_POTION 2 |
| #define VIAL 1 |
| #define WEAPONS 0 |
| #define WHITE_POTION 3 |
| #define YELLOW 0 |
| #define YELLOW_SUBSTANCE 4 |
Adds an item to inventory.
Arguments as for get_key

Compares 2 items.
Use KEY_CMP mode to make this function be key-sensitive
Finds an item.
Arguments as for get_key

| void generate_items | ( | struct leveldata | ld | ) |
Generates items on level.
| ld | - Level structure |
Returns/generates struct item::key value for item.
Use this function every time you want to place new item in inventory
| inv | - player's inventory | |
| n | - number of items in inventory | |
| itm | - new item |

| char* makesuggestion | ( | struct item * | inv, | |
| int | n, | |||
| int | class | |||
| ) |
Retuns keys of items with current class.
| inv | - inventory | |
| n | - number of items in inventory | |
| class | - class of items |
Puts an item onto random free cell on level.
| ld | - Level structure | |
| it | - Item to work with |
1.6.3