File shop.c

* The entire shop rewrite for Circle 3.0 was done by Jeff Fink. Thanks Jeff!


Included Files

  • #include "conf.h"
  • #include "sysdep.h"
  • #include <stdio.h>
  • #include <ctype.h>
  • #include <stdlib.h>
  • #include <string.h>
  • #include <sys/types.h>
  • #include <unistd.h>
  • #include <limits.h>
  • #include <sys/time.h>
  • #include <assert.h>
  • #include "structs.h"
  • #include "comm.h"
  • #include "handler.h"
  • #include "db.h"
  • #include "interpreter.h"
  • #include "utils.h"
  • #include "shop.h"

  • Global Variable shop_index

    struct shop_data* shop_index
    Visible in:
  • shop.c
  • Used in:
  • assign_the_shopkeepers() : shop.c
  • boot_the_shops() : shop.c
  • buy_price() : shop.c
  • customer_string() : shop.c
  • get_purchase_obj() : shop.c
  • get_selling_obj() : shop.c
  • is_ok_char() : shop.c
  • is_open() : shop.c
  • list_all_shops() : shop.c
  • list_detailed_shop() : shop.c
  • ok_damage_shopkeeper() : shop.c
  • ok_shop_room() : shop.c
  • read_line() : shop.c
  • sell_price() : shop.c
  • shop_keeper() : shop.c
  • shop_producing() : shop.c
  • shopping_buy() : shop.c
  • shopping_list() : shop.c
  • shopping_sell() : shop.c
  • slide_obj() : shop.c
  • sort_keeper_objs() : shop.c
  • trade_with() : shop.c

  • Global Variable top_shop

    int top_shop
    Visible in:
  • shop.c
  • Used in:
  • assign_the_shopkeepers() : shop.c
  • boot_the_shops() : shop.c
  • list_all_shops() : shop.c
  • ok_damage_shopkeeper() : shop.c
  • read_line() : shop.c
  • shop_keeper() : shop.c
  • show_shops() : shop.c

  • Global Variable cmd_say

    int cmd_say
    Visible in:
  • shop.c
  • Used in:
  • assign_the_shopkeepers() : shop.c
  • is_ok_char() : shop.c

  • Global Variable cmd_tell

    int cmd_tell
    Visible in:
  • shop.c
  • Used in:
  • assign_the_shopkeepers() : shop.c
  • get_purchase_obj() : shop.c
  • get_selling_obj() : shop.c
  • is_ok_char() : shop.c
  • is_open() : shop.c
  • ok_damage_shopkeeper() : shop.c
  • shopping_buy() : shop.c
  • shopping_sell() : shop.c
  • shopping_value() : shop.c

  • Global Variable cmd_emote

    int cmd_emote
    Visible in:
  • shop.c
  • Used in:
  • assign_the_shopkeepers() : shop.c
  • shopping_buy() : shop.c

  • Global Variable cmd_slap

    int cmd_slap
    Visible in:
  • shop.c
  • Used in:
  • assign_the_shopkeepers() : shop.c
  • ok_damage_shopkeeper() : shop.c
  • shop_keeper() : shop.c

  • Global Variable cmd_puke

    int cmd_puke
    Visible in:
  • shop.c
  • Used in:
  • assign_the_shopkeepers() : shop.c
  • shopping_buy() : shop.c

  • External Variables

    str_app
    extern struct str_app_type str_app[]
    Defined in:
  • constants.c
  • mob_index
    extern struct index_data* mob_index

    Defined in:
  • db.c
  • obj_index
    extern struct index_data* obj_index

    Defined in:
  • db.c
  • mob_proto
    extern struct char_data* mob_proto

    Defined in:
  • db.c
  • obj_proto
    extern struct obj_data* obj_proto

    Defined in:
  • db.c
  • world
    extern struct room_data* world

    Defined in:
  • db.c
  • time_info
    extern struct time_info_data time_info

    Defined in:
  • db.c
  • item_types
    extern char* item_types[]

    Defined in:
  • constants.c
  • extra_bits
    extern char* extra_bits[]

    Defined in:
  • constants.c
  • drinks
    extern char* drinks[]

    Defined in:
  • constants.c

  • Global Function add_to_list()

    int add_to_list ( struct shop_buy_data* list, int type, int* len, int* val )
    Calls:
  • real_object() : db.c
  • Called by:
  • read_list() : shop.c
  • read_type_list() : shop.c

  • Global Function assign_the_shopkeepers()

    void assign_the_shopkeepers ( void )
    Calls:
  • find_command() : interpreter.c
  • Called by:
  • boot_db() : db.c
  • References Functions:
  • shop_keeper() : shop.c
  • References Variables:
  • cmd_emote : shop.c
  • cmd_puke : shop.c
  • cmd_say : shop.c
  • cmd_slap : shop.c
  • cmd_tell : shop.c
  • mob_index : db.c
  • shop_index : shop.c
  • top_shop : shop.c

  • Global Function boot_the_shops()

    void boot_the_shops ( FILE* shop_f, char* filename, int rec_count )
    Calls:
  • fread_string() : db.c
  • read_line() : shop.c
  • read_list() : shop.c
  • read_type_list() : shop.c
  • real_mobile() : db.c
  • __gnu_calloc(), abort(), free(), perror(), sprintf(), sscanf(), strstr()
  • Called by:
  • index_boot() : db.c
  • References Variables:
  • shop_index : shop.c
  • top_shop : shop.c

  • Global Function buy_price()

    int buy_price ( struct obj_data* obj, int shop_nr )
    Called by:
  • list_object() : shop.c
  • shopping_buy() : shop.c
  • References Variables:
  • shop_index : shop.c

  • Global Function customer_string()

    char* customer_string ( int shop_nr, int detailed )
    Calls:
  • sprintf(), strcat(), strlen()
  • Called by:
  • list_all_shops() : shop.c
  • list_detailed_shop() : shop.c
  • References Variables:
  • shop_index : shop.c

  • Global Function end_read_list()

    int end_read_list ( struct shop_buy_data* list, int len, int error )
    Calls:
  • basic_mud_log() : utils.c
  • sprintf()
  • Called by:
  • read_list() : shop.c
  • read_type_list() : shop.c
  • References Variables:
  • buf

  • Global Function evaluate_expression()

    int evaluate_expression ( struct obj_data* obj, char* expr )
    Calls:
  • basic_mud_log() : utils.c
  • evaluate_operation() : shop.c
  • find_oper_num() : shop.c
  • isname() : handler.c
  • pop() : shop.c
  • push() : shop.c
  • str_cmp() : utils.c
  • top() : shop.c
  • strncpy()
  • Called by:
  • trade_with() : shop.c
  • References Variables:
  • extra_bits : constants.c

  • Global Function evaluate_operation()

    void evaluate_operation ( struct stack_data* ops, struct stack_data* vals )
    Calls:
  • pop() : shop.c
  • push() : shop.c
  • Called by:
  • evaluate_expression() : shop.c

  • Global Function find_oper_num()

    int find_oper_num ( char token )
    Calls:
  • strchr()
  • Called by:
  • evaluate_expression() : shop.c

  • Global Function get_hash_obj_vis()

    struct obj_data* get_hash_obj_vis ( struct char_data* ch, char* name, struct obj_data* list )
    Calls:
  • is_number() : interpreter.c
  • same_obj() : shop.c
  • atoi()
  • Called by:
  • get_purchase_obj() : shop.c
  • References Variables:
  • weather_info : db.c
  • world : db.c

  • Global Function get_purchase_obj()

    struct obj_data* get_purchase_obj ( struct char_data* ch, char* arg, struct char_data* keeper, int shop_nr, int msg )
    Calls:
  • do_tell() : act.comm.c
  • extract_obj() : handler.c
  • get_hash_obj_vis() : shop.c
  • get_slide_obj_vis() : shop.c
  • one_argument() : interpreter.c
  • sprintf()
  • Called by:
  • shopping_buy() : shop.c
  • References Variables:
  • cmd_tell : shop.c
  • shop_index : shop.c

  • Global Function get_selling_obj()

    struct obj_data* get_selling_obj ( struct char_data* ch, char* name, struct char_data* keeper, int shop_nr, int msg )
    Calls:
  • basic_mud_log() : utils.c
  • do_tell() : act.comm.c
  • get_obj_in_list_vis() : handler.c
  • trade_with() : shop.c
  • sprintf()
  • Called by:
  • shopping_sell() : shop.c
  • shopping_value() : shop.c
  • References Variables:
  • cmd_tell : shop.c
  • shop_index : shop.c

  • Global Function get_slide_obj_vis()

    struct obj_data* get_slide_obj_vis ( struct char_data* ch, char* name, struct obj_data* list )
    Calls:
  • get_number() : handler.c
  • isname() : handler.c
  • same_obj() : shop.c
  • strcpy()
  • Called by:
  • get_purchase_obj() : shop.c
  • References Variables:
  • weather_info : db.c
  • world : db.c

  • Global Function handle_detailed_list()

    void handle_detailed_list ( char* buf, char* buf1, struct char_data* ch )
    Calls:
  • send_to_char() : comm.c
  • sprintf(), strcat(), strlen()
  • Called by:
  • list_detailed_shop() : shop.c

  • Global Function is_ok()

    int is_ok ( struct char_data* keeper, struct char_data* ch, int shop_nr )
    Calls:
  • is_ok_char() : shop.c
  • is_open() : shop.c
  • Called by:
  • shopping_buy() : shop.c
  • shopping_list() : shop.c
  • shopping_sell() : shop.c
  • shopping_value() : shop.c

  • Global Function is_ok_char()

    int is_ok_char ( struct char_data* keeper, struct char_data* ch, int shop_nr )
    Calls:
  • do_say() : act.comm.c
  • do_tell() : act.comm.c
  • sprintf()
  • Called by:
  • is_ok() : shop.c
  • References Variables:
  • cmd_say : shop.c
  • cmd_tell : shop.c
  • shop_index : shop.c
  • weather_info : db.c
  • world : db.c

  • Global Function is_open()

    int is_open ( struct char_data* keeper, int shop_nr, int msg )
    Calls:
  • do_say() : act.comm.c
  • strcpy()
  • Called by:
  • is_ok() : shop.c
  • References Variables:
  • cmd_tell : shop.c
  • shop_index : shop.c
  • time_info : db.c

  • Global Function list_all_shops()

    void list_all_shops ( struct char_data* ch )
    Calls:
  • customer_string() : shop.c
  • page_string() : modify.c
  • sprintf(), strcat(), strcpy(), strlen()
  • Called by:
  • show_shops() : shop.c
  • References Variables:
  • mob_index : db.c
  • shop_index : shop.c
  • top_shop : shop.c
  • buf, buf, buf

  • Global Function list_detailed_shop()

    void list_detailed_shop ( struct char_data* ch, int shop_nr )
    Calls:
  • customer_string() : shop.c
  • get_char_num() : handler.c
  • handle_detailed_list() : shop.c
  • real_room() : db.c
  • send_to_char() : comm.c
  • sprintbit() : utils.c
  • sprintf(), strcat(), strcpy(), strlen()
  • Called by:
  • show_shops() : shop.c
  • References Variables:
  • item_types : constants.c
  • mob_index : db.c
  • mob_proto : db.c
  • obj_index : db.c
  • obj_proto : db.c
  • shop_index : shop.c
  • world : db.c
  • buf, buf

  • Global Function list_object()

    char* list_object ( struct obj_data* obj, int cnt, int index, int shop_nr )
    Calls:
  • buy_price() : shop.c
  • shop_producing() : shop.c
  • sprintf(), strcat(), strcpy(), strlen()
  • Called by:
  • shopping_list() : shop.c
  • References Variables:
  • drinks : constants.c

  • Global Function ok_damage_shopkeeper()

    int ok_damage_shopkeeper ( struct char_data* ch, struct char_data* victim )
    Calls:
  • do_action() : act.social.c
  • do_tell() : act.comm.c
  • sprintf()
  • Called by:
  • damage() : fight.c
  • References Functions:
  • shop_keeper() : shop.c
  • References Variables:
  • cmd_slap : shop.c
  • cmd_tell : shop.c
  • mob_index : db.c
  • shop_index : shop.c
  • top_shop : shop.c

  • Global Function ok_shop_room()

    int ok_shop_room ( int shop_nr, int room )
    Called by:
  • shop_keeper() : shop.c
  • show_shops() : shop.c
  • References Variables:
  • shop_index : shop.c

  • Global Function pop()

    int pop ( struct stack_data* stack )
    Calls:
  • basic_mud_log() : utils.c
  • Called by:
  • evaluate_expression() : shop.c
  • evaluate_operation() : shop.c

  • Global Function push()

    void push ( struct stack_data* stack, int pushval )
    Called by:
  • evaluate_expression() : shop.c
  • evaluate_operation() : shop.c

  • Global Function read_line()

    void read_line ( FILE* shop_f, char* string, void* data )
    Calls:
  • get_line() : utils.c
  • exit(), fprintf(), sscanf()
  • Called by:
  • boot_the_shops() : shop.c
  • read_list() : shop.c
  • References Variables:
  • shop_index : shop.c
  • top_shop : shop.c
  • buf

  • Global Function read_list()

    int read_list ( FILE* shop_f, struct shop_buy_data* list, int new_format, int max, int type )
    Calls:
  • add_to_list() : shop.c
  • end_read_list() : shop.c
  • read_line() : shop.c
  • Called by:
  • boot_the_shops() : shop.c
  • read_type_list() : shop.c

  • Global Function read_type_list()

    int read_type_list ( FILE* shop_f, struct shop_buy_data* list, int new_format, int max )
    Calls:
  • add_to_list() : shop.c
  • end_read_list() : shop.c
  • read_list() : shop.c
  • str_dup() : utils.c
  • strn_cmp() : utils.c
  • fgets(), sscanf(), strchr(), strcpy(), strlen()
  • Called by:
  • boot_the_shops() : shop.c
  • References Variables:
  • item_types : constants.c
  • buf

  • Global Function same_obj()

    int same_obj ( struct obj_data* obj1, struct obj_data* obj2 )
    Called by:
  • get_hash_obj_vis() : shop.c
  • get_slide_obj_vis() : shop.c
  • shop_producing() : shop.c
  • shopping_buy() : shop.c
  • shopping_list() : shop.c
  • slide_obj() : shop.c

  • Global Function sell_price()

    int sell_price ( struct char_data* ch, struct obj_data* obj, int shop_nr )
    Called by:
  • shopping_sell() : shop.c
  • shopping_value() : shop.c
  • References Variables:
  • shop_index : shop.c

  • Global Function shop_keeper()

    int ( shop_keeper) ( struct char_data* ch, void* me, int cmd, char* argument )
    Calls:
  • act() : comm.c
  • do_action() : act.social.c
  • ok_shop_room() : shop.c
  • shopping_buy() : shop.c
  • shopping_list() : shop.c
  • shopping_sell() : shop.c
  • shopping_value() : shop.c
  • sprintf(), strcmp()
  • Used in:
  • assign_the_shopkeepers() : shop.c
  • ok_damage_shopkeeper() : shop.c
  • References Variables:
  • cmd_info : interpreter.c
  • cmd_slap : shop.c
  • shop_index : shop.c
  • top_shop : shop.c
  • world : db.c
  • arg

  • Global Function shop_producing()

    int shop_producing ( struct obj_data* item, int shop_nr )
    Calls:
  • same_obj() : shop.c
  • Called by:
  • list_object() : shop.c
  • shopping_buy() : shop.c
  • slide_obj() : shop.c
  • sort_keeper_objs() : shop.c
  • References Variables:
  • obj_proto : db.c
  • shop_index : shop.c

  • Global Function shopping_buy()

    void shopping_buy ( char* arg, struct char_data* ch, struct char_data* keeper, int shop_nr )
    Calls:
  • act() : comm.c
  • buy_price() : shop.c
  • do_action() : act.social.c
  • do_echo() : act.wizard.c
  • do_tell() : act.comm.c
  • fname() : handler.c
  • get_purchase_obj() : shop.c
  • is_ok() : shop.c
  • obj_from_char() : handler.c
  • obj_to_char() : handler.c
  • read_object() : db.c
  • same_obj() : shop.c
  • send_to_char() : comm.c
  • shop_producing() : shop.c
  • sort_keeper_objs() : shop.c
  • times_message() : shop.c
  • transaction_amt() : shop.c
  • sprintf()
  • Called by:
  • shop_keeper() : shop.c
  • References Variables:
  • cmd_emote : shop.c
  • cmd_puke : shop.c
  • cmd_tell : shop.c
  • shop_index : shop.c
  • str_app : constants.c

  • Global Function shopping_list()

    void shopping_list ( char* arg, struct char_data* ch, struct char_data* keeper, int shop_nr )
    Calls:
  • is_ok() : shop.c
  • isname() : handler.c
  • list_object() : shop.c
  • one_argument() : interpreter.c
  • page_string() : modify.c
  • same_obj() : shop.c
  • sort_keeper_objs() : shop.c
  • strcat(), strcpy()
  • Called by:
  • shop_keeper() : shop.c
  • References Variables:
  • shop_index : shop.c
  • weather_info : db.c
  • world : db.c

  • Global Function shopping_sell()

    void shopping_sell ( char* arg, struct char_data* ch, struct char_data* keeper, int shop_nr )
    Calls:
  • MIN() : utils.c
  • act() : comm.c
  • do_tell() : act.comm.c
  • get_selling_obj() : shop.c
  • is_ok() : shop.c
  • obj_from_char() : handler.c
  • one_argument() : interpreter.c
  • sell_price() : shop.c
  • send_to_char() : comm.c
  • slide_obj() : shop.c
  • times_message() : shop.c
  • transaction_amt() : shop.c
  • sprintf(), strcpy()
  • Called by:
  • shop_keeper() : shop.c
  • References Variables:
  • cmd_tell : shop.c
  • shop_index : shop.c

  • Global Function shopping_value()

    void shopping_value ( char* arg, struct char_data* ch, struct char_data* keeper, int shop_nr )
    Calls:
  • do_tell() : act.comm.c
  • get_selling_obj() : shop.c
  • is_ok() : shop.c
  • one_argument() : interpreter.c
  • sell_price() : shop.c
  • sprintf()
  • Called by:
  • shop_keeper() : shop.c
  • References Variables:
  • cmd_tell : shop.c

  • Global Function show_shops()

    void show_shops ( struct char_data* ch, char* arg )
    Calls:
  • is_number() : interpreter.c
  • list_all_shops() : shop.c
  • list_detailed_shop() : shop.c
  • ok_shop_room() : shop.c
  • send_to_char() : comm.c
  • str_cmp() : utils.c
  • atoi()
  • References Variables:
  • top_shop : shop.c
  • world : db.c

  • Global Function slide_obj()

    struct obj_data* slide_obj ( struct obj_data* obj, struct char_data* keeper, int shop_nr )
    Calls:
  • extract_obj() : handler.c
  • obj_to_char() : handler.c
  • same_obj() : shop.c
  • shop_producing() : shop.c
  • sort_keeper_objs() : shop.c
  • Called by:
  • shopping_sell() : shop.c
  • sort_keeper_objs() : shop.c
  • References Variables:
  • obj_proto : db.c
  • shop_index : shop.c

  • Global Function sort_keeper_objs()

    void sort_keeper_objs ( struct char_data* keeper, int shop_nr )
    Prototyped in:
  • shop.c
  • Calls:
  • get_obj_in_list_num() : handler.c
  • obj_from_char() : handler.c
  • obj_to_char() : handler.c
  • shop_producing() : shop.c
  • slide_obj() : shop.c
  • Called by:
  • shopping_buy() : shop.c
  • shopping_list() : shop.c
  • slide_obj() : shop.c
  • References Variables:
  • shop_index : shop.c

  • Global Function times_message()

    char* times_message ( struct obj_data* obj, char* name, int num )
    Calls:
  • sprintf(), strchr(), strcpy(), strlen()
  • Called by:
  • shopping_buy() : shop.c
  • shopping_sell() : shop.c

  • Global Function top()

    int top ( struct stack_data* stack )
    Called by:
  • evaluate_expression() : shop.c

  • Global Function trade_with()

    int trade_with ( struct obj_data* item, int shop_nr )
    Calls:
  • evaluate_expression() : shop.c
  • Called by:
  • get_selling_obj() : shop.c
  • References Variables:
  • shop_index : shop.c

  • Global Function transaction_amt()

    int transaction_amt ( char* arg )
    Calls:
  • is_number() : interpreter.c
  • one_argument() : interpreter.c
  • atoi(), strcpy(), strlen()
  • Called by:
  • shopping_buy() : shop.c
  • shopping_sell() : shop.c
  • References Variables:
  • buf