Actually ue typedefs for obj_data, char_data and descriptor_data.
Some linting in a couple of files. Massive commit...
This commit is contained in:
+63
-63
@@ -51,37 +51,37 @@ const char *shop_bits[] = {
|
||||
static void push(struct stack_data *stack, int pushval); /**< @todo Move to utils.c */
|
||||
static int top(struct stack_data *stack); /**< @todo Move to utils.c */
|
||||
static int pop(struct stack_data *stack); /**< @todo Move to utils.c */
|
||||
static char *list_object(struct obj_data *obj, int cnt, int oindex, int shop_nr, struct char_data *keeper, struct char_data *seller);
|
||||
static void sort_keeper_objs(struct char_data *keeper, int shop_nr);
|
||||
static char *list_object(obj_data *obj, int cnt, int oindex, int shop_nr, char_data *keeper, char_data *seller);
|
||||
static void sort_keeper_objs(char_data *keeper, int shop_nr);
|
||||
static char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why);
|
||||
static int read_type_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max);
|
||||
static int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max, int type);
|
||||
static void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
||||
static bool shopping_identify(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
||||
static void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
||||
static void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
||||
static struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg);
|
||||
static struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr);
|
||||
static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
||||
static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg);
|
||||
static struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list);
|
||||
static struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list);
|
||||
static void shopping_list(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||
static bool shopping_identify(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||
static void shopping_value(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||
static void shopping_sell(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||
static obj_data *get_selling_obj(char_data *ch, char *name, char_data *keeper, int shop_nr, int msg);
|
||||
static obj_data *slide_obj(obj_data *obj, char_data *keeper, int shop_nr);
|
||||
static void shopping_buy(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||
static obj_data *get_purchase_obj(char_data *ch, char *arg, char_data *keeper, int shop_nr, int msg);
|
||||
static obj_data *get_hash_obj_vis(char_data *ch, char *name, obj_data *list);
|
||||
static obj_data *get_slide_obj_vis(char_data *ch, char *name, obj_data *list);
|
||||
static char *customer_string(int shop_nr, int detailed);
|
||||
static void list_all_shops(struct char_data *ch);
|
||||
static void list_detailed_shop(struct char_data *ch, int shop_nr);
|
||||
static int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr);
|
||||
static int is_open(struct char_data *keeper, int shop_nr, int msg);
|
||||
static int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr);
|
||||
static void list_all_shops(char_data *ch);
|
||||
static void list_detailed_shop(char_data *ch, int shop_nr);
|
||||
static int is_ok_char(char_data *keeper, char_data *ch, int shop_nr);
|
||||
static int is_open(char_data *keeper, int shop_nr, int msg);
|
||||
static int is_ok(char_data *keeper, char_data *ch, int shop_nr);
|
||||
static void evaluate_operation(struct stack_data *ops, struct stack_data *vals);
|
||||
static int find_oper_num(char token);
|
||||
static int evaluate_expression(struct obj_data *obj, char *expr);
|
||||
static int trade_with(struct obj_data *item, int shop_nr);
|
||||
static int same_obj(struct obj_data *obj1, struct obj_data *obj2);
|
||||
static int shop_producing(struct obj_data *item, int shop_nr);
|
||||
static int evaluate_expression(obj_data *obj, char *expr);
|
||||
static int trade_with(obj_data *item, int shop_nr);
|
||||
static int same_obj(obj_data *obj1, obj_data *obj2);
|
||||
static int shop_producing(obj_data *item, int shop_nr);
|
||||
static int transaction_amt(char *arg);
|
||||
static char *times_message(struct obj_data *obj, char *name, int num);
|
||||
static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer);
|
||||
static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller);
|
||||
static char *times_message(obj_data *obj, char *name, int num);
|
||||
static int buy_price(obj_data *obj, int shop_nr, char_data *keeper, char_data *buyer);
|
||||
static int sell_price(obj_data *obj, int shop_nr, char_data *keeper, char_data *seller);
|
||||
static int ok_shop_room(int shop_nr, room_vnum room);
|
||||
static int add_to_shop_list(struct shop_buy_data *list, int type, int *len, int *val);
|
||||
static int end_read_list(struct shop_buy_data *list, int len, int error);
|
||||
@@ -104,7 +104,7 @@ static const char *operator_str[] = {
|
||||
} ;
|
||||
|
||||
|
||||
static int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr)
|
||||
static int is_ok_char(char_data *keeper, char_data *ch, int shop_nr)
|
||||
{
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
@@ -137,7 +137,7 @@ static int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_n
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static int is_open(struct char_data *keeper, int shop_nr, int msg)
|
||||
static int is_open(char_data *keeper, int shop_nr, int msg)
|
||||
{
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
@@ -157,7 +157,7 @@ static int is_open(struct char_data *keeper, int shop_nr, int msg)
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
static int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr)
|
||||
static int is_ok(char_data *keeper, char_data *ch, int shop_nr)
|
||||
{
|
||||
if (is_open(keeper, shop_nr, TRUE))
|
||||
return (is_ok_char(keeper, ch, shop_nr));
|
||||
@@ -216,7 +216,7 @@ static int find_oper_num(char token)
|
||||
return (NOTHING);
|
||||
}
|
||||
|
||||
static int evaluate_expression(struct obj_data *obj, char *expr)
|
||||
static int evaluate_expression(obj_data *obj, char *expr)
|
||||
{
|
||||
struct stack_data ops, vals;
|
||||
char *ptr, *end, name[MAX_STRING_LENGTH];
|
||||
@@ -270,7 +270,7 @@ static int evaluate_expression(struct obj_data *obj, char *expr)
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static int trade_with(struct obj_data *item, int shop_nr)
|
||||
static int trade_with(obj_data *item, int shop_nr)
|
||||
{
|
||||
int counter;
|
||||
|
||||
@@ -292,7 +292,7 @@ static int trade_with(struct obj_data *item, int shop_nr)
|
||||
return (OBJECT_NOTOK);
|
||||
}
|
||||
|
||||
static int same_obj(struct obj_data *obj1, struct obj_data *obj2)
|
||||
static int same_obj(obj_data *obj1, obj_data *obj2)
|
||||
{
|
||||
int aindex;
|
||||
|
||||
@@ -313,7 +313,7 @@ static int same_obj(struct obj_data *obj1, struct obj_data *obj2)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static int shop_producing(struct obj_data *item, int shop_nr)
|
||||
static int shop_producing(obj_data *item, int shop_nr)
|
||||
{
|
||||
int counter;
|
||||
|
||||
@@ -342,7 +342,7 @@ static int transaction_amt(char *arg)
|
||||
return (1);
|
||||
}
|
||||
|
||||
static char *times_message(struct obj_data *obj, char *name, int num)
|
||||
static char *times_message(obj_data *obj, char *name, int num)
|
||||
{
|
||||
static char buf[256];
|
||||
size_t len;
|
||||
@@ -364,9 +364,9 @@ static char *times_message(struct obj_data *obj, char *name, int num)
|
||||
return (buf);
|
||||
}
|
||||
|
||||
static struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list)
|
||||
static obj_data *get_slide_obj_vis(char_data *ch, char *name, obj_data *list)
|
||||
{
|
||||
struct obj_data *i, *last_match = NULL;
|
||||
obj_data *i, *last_match = NULL;
|
||||
int j, number;
|
||||
char tmpname[MAX_INPUT_LENGTH];
|
||||
char *tmp;
|
||||
@@ -387,9 +387,9 @@ static struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, stru
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list)
|
||||
static obj_data *get_hash_obj_vis(char_data *ch, char *name, obj_data *list)
|
||||
{
|
||||
struct obj_data *loop, *last_obj = NULL;
|
||||
obj_data *loop, *last_obj = NULL;
|
||||
int qindex;
|
||||
|
||||
if (is_number(name))
|
||||
@@ -409,10 +409,10 @@ static struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struc
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg)
|
||||
static obj_data *get_purchase_obj(char_data *ch, char *arg, char_data *keeper, int shop_nr, int msg)
|
||||
{
|
||||
char name[MAX_INPUT_LENGTH];
|
||||
struct obj_data *obj;
|
||||
obj_data *obj;
|
||||
|
||||
one_argument(arg, name);
|
||||
do {
|
||||
@@ -453,7 +453,7 @@ static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct
|
||||
discount beyond the basic price. That assumes they put a lot of points
|
||||
into charisma, because on the flip side they'd get 11% inflation by
|
||||
having a 3. */
|
||||
static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer)
|
||||
static int buy_price(obj_data *obj, int shop_nr, char_data *keeper, char_data *buyer)
|
||||
{
|
||||
return (int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr)
|
||||
* (1 + (GET_CHA(keeper) - GET_CHA(buyer)) / (float)70));
|
||||
@@ -461,7 +461,7 @@ static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper
|
||||
|
||||
/* When the shopkeeper is buying, we reverse the discount. Also make sure
|
||||
we don't buy for more than we sell for, to prevent infinite money-making. */
|
||||
static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller)
|
||||
static int sell_price(obj_data *obj, int shop_nr, char_data *keeper, char_data *seller)
|
||||
{
|
||||
float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / 70.0);
|
||||
float buy_cost_modifier = SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(seller)) / 70.0);
|
||||
@@ -472,10 +472,10 @@ static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keepe
|
||||
return (int) (GET_OBJ_COST(obj) * sell_cost_modifier);
|
||||
}
|
||||
|
||||
static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
||||
static void shopping_buy(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||
{
|
||||
char tempstr[MAX_INPUT_LENGTH - 10], tempbuf[MAX_INPUT_LENGTH];
|
||||
struct obj_data *obj, *last_obj = NULL;
|
||||
obj_data *obj, *last_obj = NULL;
|
||||
int goldamt = 0, buynum, bought = 0;
|
||||
|
||||
if (!is_ok(keeper, ch, shop_nr))
|
||||
@@ -638,10 +638,10 @@ static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keep
|
||||
|
||||
}
|
||||
|
||||
static struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg)
|
||||
static obj_data *get_selling_obj(char_data *ch, char *name, char_data *keeper, int shop_nr, int msg)
|
||||
{
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
struct obj_data *obj;
|
||||
obj_data *obj;
|
||||
int result;
|
||||
|
||||
if (!(obj = get_obj_in_list_vis(ch, name, NULL, ch->carrying))) {
|
||||
@@ -684,9 +684,9 @@ static struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct
|
||||
* is put together, and manipulating the order of the objects on the list. (But
|
||||
* since most of DIKU is not encapsulated, and information hiding is almost
|
||||
* never used, it isn't that big a deal). -JF */
|
||||
static struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr)
|
||||
static obj_data *slide_obj(obj_data *obj, char_data *keeper, int shop_nr)
|
||||
{
|
||||
struct obj_data *loop;
|
||||
obj_data *loop;
|
||||
int temp;
|
||||
|
||||
if (SHOP_SORT(shop_nr) < IS_CARRYING_N(keeper))
|
||||
@@ -714,9 +714,9 @@ static struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper
|
||||
return (obj);
|
||||
}
|
||||
|
||||
static void sort_keeper_objs(struct char_data *keeper, int shop_nr)
|
||||
static void sort_keeper_objs(char_data *keeper, int shop_nr)
|
||||
{
|
||||
struct obj_data *list = NULL, *temp;
|
||||
obj_data *list = NULL, *temp;
|
||||
|
||||
while (SHOP_SORT(shop_nr) < IS_CARRYING_N(keeper)) {
|
||||
temp = keeper->carrying;
|
||||
@@ -737,10 +737,10 @@ static void sort_keeper_objs(struct char_data *keeper, int shop_nr)
|
||||
}
|
||||
}
|
||||
|
||||
static void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
||||
static void shopping_sell(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||
{
|
||||
char tempstr[MAX_INPUT_LENGTH - 10], name[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH]; // - 10 to make room for constants in format
|
||||
struct obj_data *obj;
|
||||
obj_data *obj;
|
||||
int sellnum, sold = 0, goldamt = 0;
|
||||
|
||||
if (!(is_ok(keeper, ch, shop_nr)))
|
||||
@@ -814,10 +814,10 @@ static void shopping_sell(char *arg, struct char_data *ch, struct char_data *kee
|
||||
}
|
||||
}
|
||||
|
||||
static void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
||||
static void shopping_value(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||
{
|
||||
char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH];
|
||||
struct obj_data *obj;
|
||||
obj_data *obj;
|
||||
|
||||
if (!is_ok(keeper, ch, shop_nr))
|
||||
return;
|
||||
@@ -835,7 +835,7 @@ static void shopping_value(char *arg, struct char_data *ch, struct char_data *ke
|
||||
do_tell(keeper, buf, cmd_tell, 0);
|
||||
}
|
||||
|
||||
static char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr, struct char_data *keeper, struct char_data *ch)
|
||||
static char *list_object(obj_data *obj, int cnt, int aindex, int shop_nr, char_data *keeper, char_data *ch)
|
||||
{
|
||||
static char result[256];
|
||||
char itemname[128],
|
||||
@@ -873,10 +873,10 @@ static char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr,
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
||||
static void shopping_list(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||
{
|
||||
char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH];
|
||||
struct obj_data *obj, *last_obj = NULL;
|
||||
obj_data *obj, *last_obj = NULL;
|
||||
int cnt = 0, lindex = 0, found = FALSE, has_quest = FALSE;
|
||||
size_t len;
|
||||
/* cnt is the number of that particular object available */
|
||||
@@ -942,7 +942,7 @@ static int ok_shop_room(int shop_nr, room_vnum room)
|
||||
|
||||
SPECIAL(shop_keeper)
|
||||
{
|
||||
struct char_data *keeper = (struct char_data *)me;
|
||||
char_data *keeper = (char_data *)me;
|
||||
int shop_nr;
|
||||
|
||||
for (shop_nr = 0; shop_nr <= top_shop; shop_nr++)
|
||||
@@ -995,7 +995,7 @@ SPECIAL(shop_keeper)
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim)
|
||||
int ok_damage_shopkeeper(char_data *ch, char_data *victim)
|
||||
{
|
||||
int sindex;
|
||||
|
||||
@@ -1302,7 +1302,7 @@ static char *customer_string(int shop_nr, int detailed)
|
||||
}
|
||||
|
||||
/* END_OF inefficient */
|
||||
static void list_all_shops(struct char_data *ch)
|
||||
static void list_all_shops(char_data *ch)
|
||||
{
|
||||
const char *list_all_shops_header =
|
||||
" ## Virtual Where Keeper Buy Sell Customers\r\n"
|
||||
@@ -1340,9 +1340,9 @@ static void list_all_shops(struct char_data *ch)
|
||||
page_string(ch->desc, buf, TRUE);
|
||||
}
|
||||
|
||||
static void list_detailed_shop(struct char_data *ch, int shop_nr)
|
||||
static void list_detailed_shop(char_data *ch, int shop_nr)
|
||||
{
|
||||
struct char_data *k;
|
||||
char_data *k;
|
||||
int sindex, column, flag = 1, found = 0;
|
||||
/* char *ptrsave; */
|
||||
|
||||
@@ -1489,7 +1489,7 @@ static void list_detailed_shop(struct char_data *ch, int shop_nr)
|
||||
}
|
||||
}
|
||||
|
||||
void show_shops(struct char_data *ch, char *arg)
|
||||
void show_shops(char_data *ch, char *arg)
|
||||
{
|
||||
int shop_nr;
|
||||
|
||||
@@ -1558,10 +1558,10 @@ void destroy_shops(void)
|
||||
top_shop = -1;
|
||||
}
|
||||
|
||||
bool shopping_identify(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
||||
bool shopping_identify(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||
{
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
struct obj_data *obj;
|
||||
obj_data *obj;
|
||||
int i, found;
|
||||
|
||||
if (!is_ok(keeper, ch, shop_nr))
|
||||
|
||||
Reference in New Issue
Block a user