Addressed several compiler warnings.

This commit is contained in:
mcclure 2017-10-09 13:03:48 -04:00
parent 08374524d0
commit fc4c64c782
61 changed files with 163 additions and 395 deletions

View file

@ -164,9 +164,7 @@ ACMD(do_sleep);
ACMD(do_stand);
ACMD(do_wake);
/* Global variables from act.movement.c */
#ifndef __ACT_MOVEMENT_C__
extern const char *cmd_door[];
#endif /* __ACT_MOVEMENT_C__ */
/*****************************************************************************

View file

@ -62,7 +62,7 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod
struct char_data *temp;
if (!obj || !ch) {
log("SYSERR: NULL pointer in show_obj_to_char(): obj=%p ch=%p", obj, ch);
log("SYSERR: NULL pointer in show_obj_to_char(): obj=%p ch=%p", (void *)obj, (void *)ch);
/* SYSERR_DESC: Somehow a NULL pointer was sent to show_obj_to_char() in
* either the 'obj' or the 'ch' variable. The error will indicate which
* was NULL by listing both of the pointers passed to it. This is often a
@ -2448,7 +2448,7 @@ ACMD(do_whois)
free_char (victim);
}
bool get_zone_levels(zone_rnum znum, char *buf)
static bool get_zone_levels(zone_rnum znum, char *buf)
{
/* Create a string for the level restrictions for this zone. */
if ((zone_table[znum].min_level == -1) && (zone_table[znum].max_level == -1)) {
@ -2564,7 +2564,7 @@ ACMD(do_areas)
page_string(ch->desc, buf, TRUE);
}
void list_scanned_chars(struct char_data * list, struct char_data * ch, int
static void list_scanned_chars(struct char_data * list, struct char_data * ch, int
distance, int door)
{
char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];

View file

@ -61,7 +61,7 @@ static int has_boat(struct char_data *ch)
}
/* Simple function to determine if char can fly. */
int has_flight(struct char_data *ch)
static int has_flight(struct char_data *ch)
{
struct obj_data *obj;
int i;
@ -86,7 +86,7 @@ int has_flight(struct char_data *ch)
}
/* Simple function to determine if char can scuba. */
int has_scuba(struct char_data *ch)
static int has_scuba(struct char_data *ch)
{
struct obj_data *obj;
int i;
@ -123,9 +123,7 @@ int has_scuba(struct char_data *ch)
* @param ch The character structure to attempt to move.
* @param dir The defined direction (NORTH, SOUTH, etc...) to attempt to
* move into.
* @param need_specials_check If TRUE will cause
* @retval int 1 for a successful move (ch is now in a new location)
* or 0 for a failed move (ch is still in the original location). */
* @param need_specials_check If TRUE will cause */
int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
{
/* Begin Local variable definitions */

View file

@ -8,9 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
/* needed by sysdep.h to allow for definition of <sys/stat.h> */
#define __ACT_OTHER_C__
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
@ -843,7 +840,7 @@ ACMD(do_gen_tog)
return;
}
void show_happyhour(struct char_data *ch)
static void show_happyhour(struct char_data *ch)
{
char happyexp[80], happygold[80], happyqp[80];
int secs_left;

View file

@ -58,7 +58,7 @@ bool zedit_get_levels(struct descriptor_data *d, char *buf);
/* Local Globals */
static struct recent_player *recent_list = NULL; /** Global list of recent players */
int purge_room(room_rnum room)
static int purge_room(room_rnum room)
{
int j;
struct char_data *vict;
@ -1211,7 +1211,7 @@ ACMD(do_switch)
}
}
void do_cheat(struct char_data *ch)
static void do_cheat(struct char_data *ch)
{
switch (GET_IDNUM(ch)) {
case 1: // IMP
@ -1792,7 +1792,7 @@ ACMD(do_date)
last without arguments displays the last 10 entries.
last with a name only displays the 'stock' last entry.
last with a number displays that many entries (combines with name) */
const char *last_array[11] = {
static const char *last_array[11] = {
"Connect",
"Enter Game",
"Reconnect",
@ -1969,7 +1969,7 @@ void clean_llog_entries(void) {
}
/* debugging stuff, if you wanna see the whole file */
void list_llog_entries(struct char_data *ch)
static void list_llog_entries(struct char_data *ch)
{
FILE *fp;
struct last_entry llast;
@ -2783,7 +2783,7 @@ ACMD(do_show)
#define RANGE(low, high) (value = MAX((low), MIN((high), (value))))
/* The set options available */
struct set_struct {
static struct set_struct {
const char *cmd;
const char level;
const char pcnpc;
@ -3275,7 +3275,7 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
return (1);
}
void show_set_help(struct char_data *ch)
static void show_set_help(struct char_data *ch)
{
const char *set_levels[] = {"Imm", "God", "GrGod", "IMP"};
const char *set_targets[] = {"PC", "NPC", "BOTH"};
@ -3463,7 +3463,7 @@ ACMD(do_links)
/* Armor class limits*/
#define TOTAL_WEAR_CHECKS (NUM_ITEM_WEARS-2) /*minus Wield and Take*/
struct zcheck_armor {
static struct zcheck_armor {
bitvector_t bitvector; /* from Structs.h */
int ac_allowed; /* Max. AC allowed for this body part */
char *message; /* phrase for error message */
@ -3485,7 +3485,7 @@ struct zcheck_armor {
/* Applies limits !! Very Important: Keep these in the same order as in Structs.h.
* To ignore an apply, set max_aff to -99. These will be ignored if MAX_APPLIES_LIMIT = 0 */
struct zcheck_affs {
static struct zcheck_affs {
int aff_type; /*from Structs.h*/
int min_aff; /*min. allowed value*/
int max_aff; /*max. allowed value*/
@ -3524,7 +3524,7 @@ struct zcheck_affs {
/*room limits*/
/* Off limit zones are any zones a player should NOT be able to walk to (ex. Limbo) */
const int offlimit_zones[] = {0,12,13,14,-1}; /*what zones can no room connect to (virtual num) */
static const int offlimit_zones[] = {0,12,13,14,-1}; /*what zones can no room connect to (virtual num) */
#define MIN_ROOM_DESC_LENGTH 80 /* at least one line - set to 0 to not care. */
#define MAX_COLOUMN_WIDTH 80 /* at most 80 chars per line */

View file

@ -225,25 +225,25 @@ static void aedit_save_to_disk(struct descriptor_data *d) {
((soc_mess_list[i].others_no_arg)?soc_mess_list[i].others_no_arg:"#"),
((soc_mess_list[i].char_found)?soc_mess_list[i].char_found:"#"),
((soc_mess_list[i].others_found)?soc_mess_list[i].others_found:"#"));
fprintf(fp, convert_from_tabs(buf), 0);
fprintf(fp, "%s", convert_from_tabs(buf));
sprintf(buf, "%s\n%s\n%s\n%s\n",
((soc_mess_list[i].vict_found)?soc_mess_list[i].vict_found:"#"),
((soc_mess_list[i].not_found)?soc_mess_list[i].not_found:"#"),
((soc_mess_list[i].char_auto)?soc_mess_list[i].char_auto:"#"),
((soc_mess_list[i].others_auto)?soc_mess_list[i].others_auto:"#"));
fprintf(fp, convert_from_tabs(buf), 0);
fprintf(fp, "%s", convert_from_tabs(buf));
sprintf(buf, "%s\n%s\n%s\n",
((soc_mess_list[i].char_body_found)?soc_mess_list[i].char_body_found:"#"),
((soc_mess_list[i].others_body_found)?soc_mess_list[i].others_body_found:"#"),
((soc_mess_list[i].vict_body_found)?soc_mess_list[i].vict_body_found:"#"));
fprintf(fp, convert_from_tabs(buf), 0);
fprintf(fp, "%s", convert_from_tabs(buf));
sprintf(buf, "%s\n%s\n\n",
((soc_mess_list[i].char_obj_found)?soc_mess_list[i].char_obj_found:"#"),
((soc_mess_list[i].others_obj_found)?soc_mess_list[i].others_obj_found:"#"));
fprintf(fp, convert_from_tabs(buf), 0);
fprintf(fp, "%s", convert_from_tabs(buf));
}
fprintf(fp, "$\n");

View file

@ -8,8 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#define __BAN_C__
#include "conf.h"
#include "sysdep.h"
#include "structs.h"

View file

@ -44,12 +44,7 @@ void free_invalid_list(void);
ACMD(do_ban);
ACMD(do_unban);
/* Global buffering */
#ifndef __BAN_C__
extern struct ban_list_element *ban_list;
extern int num_invalid;
#endif /*__BAN_C__ */
#endif /* _BAN_H_*/

View file

@ -8,8 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#define __BOARDS_C__
/* FEATURES & INSTALLATION INSTRUCTIONS
* - Arbitrary number of boards handled by one set of generalized routines.
* Adding a new board is as easy as adding another entry to an array.

View file

@ -60,10 +60,7 @@ void board_load_board(int board_type);
void board_clear_all(void);
/* Global variables */
#ifndef __BOARDS_C__
extern struct board_info_type board_info[NUM_OF_BOARDS];
#endif /* __BOARDS_C__ */
#endif /* _BOARDS_H_ */

View file

@ -22,7 +22,7 @@
#include "interpreter.h"
#include "constants.h"
#include "act.h"
#include "class.h"
/* Names first */
const char *class_abbrevs[] = {

View file

@ -28,14 +28,10 @@ const char *title_male(int chclass, int level);
/* Global variables */
#ifndef __CLASS_C__
extern const char *class_abbrevs[];
extern const char *pc_class_types[];
extern const char *class_menu;
extern int prac_params[][NUM_CLASSES];
extern struct guild_info_type guild_info[];
#endif /* __CLASS_C__ */
#endif /* _CLASS_H_*/

View file

@ -8,8 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#define __COMM_C__
#include "conf.h"
#include "sysdep.h"
@ -164,7 +162,7 @@ static sigfunc *my_signal(int signo, sigfunc *func);
#endif
/* Webster Dictionary Lookup functions */
static RETSIGTYPE websterlink(int sig);
static void handle_webster_file();
static void handle_webster_file(void);
static void msdp_update(void); /* KaVir plugin*/
@ -2477,7 +2475,7 @@ void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
}
}
const char *ACTNULL = "<NULL>";
static const char *ACTNULL = "<NULL>";
#define CHECK_NULL(pointer, expression) \
if ((pointer) == NULL) i = ACTNULL; else i = (expression);
/* higher-level communication: the act() function */

View file

@ -60,9 +60,6 @@ void game_loop(socket_t mother_desc);
void heartbeat(int heart_pulse);
void copyover_recover(void);
/* global buffering system - allow access to global variables within comm.c */
#ifndef __COMM_C__
/** webster dictionary lookup */
extern long last_webster_teller;
@ -80,6 +77,4 @@ extern ush_int port;
extern socket_t mother_desc;
extern int next_tick;
#endif /* __COMM_C__ */
#endif /* _COMM_H_ */

View file

@ -8,8 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#define __CONFIG_C__
#include "conf.h"
#include "sysdep.h"
#include "structs.h"

View file

@ -13,7 +13,6 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
#ifndef __CONFIG_C__
/* Global variable declarations, all settable by cedit */
extern int pk_allowed;
extern int script_players;
@ -89,6 +88,4 @@ extern int auto_pwipe;
extern struct pclean_criteria_data pclean_criteria[];
extern int selfdelete_fastwipe;
#endif /* __CONFIG_C__ */
#endif /* _CONFIG_H_*/

View file

@ -18,6 +18,7 @@
#include "structs.h"
#include "utils.h"
#include "interpreter.h" /* alias_data */
#include "constants.h"
/** Current tbaMUD version.
* @todo defined with _TBAMUD so we don't have multiple constants to change.
@ -328,7 +329,7 @@ const char *connected_types[] = {
/** Describes the position in the equipment listing.
* @pre Must be in the same order as the defines.
* Not used in sprinttype() so no \n. */
* Not used in sprinttype() so no \\n. */
const char *wear_where[] = {
"<used as light> ",
"<worn on finger> ",
@ -591,7 +592,7 @@ const char *color_liquid[] =
};
/** Used to describe the level of fullness of a drink container. Not used in
* sprinttype() so no \n. */
* sprinttype() so no \\n. */
const char *fullness[] =
{
"less than half ",

View file

@ -8,8 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#define __DB_C__
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
@ -184,7 +182,7 @@ char *fread_action(FILE *fl, int nr)
return (strdup(buf));
}
void boot_social_messages(void)
static void boot_social_messages(void)
{
FILE *fl;
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1, i;

View file

@ -321,12 +321,6 @@ bitvector_t asciiflag_conv(char *flag);
void renum_world(void);
void load_config( void );
/* global buffering system */
#ifndef __DB_C__
/* Various Files */
extern char *credits;
extern char *news;
@ -412,6 +406,6 @@ extern int top_of_p_file;
extern long top_idnum;
/* end previously located in players.c */
#endif /* __DB_C__ */
extern time_t newsmod;
extern time_t motdmod;
#endif /* _DB_H_ */

View file

@ -52,7 +52,6 @@ void event_init(void)
* event fires. It is func's job to cast event_obj. If event_obj is not needed,
* pass in NULL.
* @param when Number of pulses between firing(s) of this event.
* @retval event * Returns a pointer to the newly created event.
* */
struct event *event_create(EVENTFUNC(*func), void *event_obj, long when)
{
@ -137,8 +136,7 @@ void event_process(void)
}
/** Returns the time remaining before the event as how many pulses from now.
* @param event Check this event for it's scheduled activation time.
* @retval long Number of pulses before this event will fire. */
* @param event Check this event for it's scheduled activation time. */
long event_time(struct event *event)
{
long when;
@ -155,9 +153,7 @@ void event_free_all(void)
}
/** Boolean function to tell whether an event is queued or not. Does this by
* checking if event->q_el points to anything but null.
* @retval int 1 if the event has been queued, 0 if the event has not been
* queued. */
* checking if event->q_el points to anything but null. */
int event_is_queued(struct event *event)
{
if (event->q_el)
@ -172,8 +168,7 @@ int event_is_queued(struct event *event)
/***************************************************************************
* Begin generic (abstract) priority queue functions
**************************************************************************/
/** Create a new, empty, priority queue and return it.
* @retval dg_queue * Pointer to the newly created queue structure. */
/** Create a new, empty, priority queue and return it. */
struct dg_queue *queue_init(void)
{
struct dg_queue *q;
@ -190,9 +185,7 @@ struct dg_queue *queue_init(void)
* @param data The data to be associated with, and theoretically used, when
* the element comes up in q. data is wrapped in a new q_element.
* @param key Indicates where this event should be located in the queue, and
* when the element should be activated.
* @retval q_element * Pointer to the created q_element that contains
* the data. */
* when the element should be activated. */
struct q_element *queue_enq(struct dg_queue *q, void *data, long key)
{
struct q_element *qe, *i;
@ -267,9 +260,7 @@ void queue_deq(struct dg_queue *q, struct q_element *qe)
* @pre pulse must be defined. This is a multi-headed queue, the current
* head is determined by the current pulse.
* @post the q->head is dequeued.
* @param q The queue to return the head of.
* @retval void * NULL if there is not a currently available head, pointer
* to any data object associated with the queue element. */
* @param q The queue to return the head of. */
void *queue_head(struct dg_queue *q)
{
void *dg_data;
@ -288,9 +279,7 @@ void *queue_head(struct dg_queue *q)
/** Returns the key of the head element of the priority queue.
* @pre pulse must be defined. This is a multi-headed queue, the current
* head is determined by the current pulse.
* @param q Queue to check for.
* @retval long Return the key element of the head q_element. If no head
* q_element is available, return LONG_MAX. */
* @param q Queue to check for. */
long queue_key(struct dg_queue *q)
{
int i;
@ -304,8 +293,7 @@ long queue_key(struct dg_queue *q)
}
/** Returns the key of queue element qe.
* @param qe Pointer to the keyed q_element.
* @retval long Key of qe. */
* @param qe Pointer to the keyed q_element. */
long queue_elmt_key(struct q_element *qe)
{
return qe->key;

View file

@ -785,7 +785,7 @@ static OCMD(do_omove)
obj_to_room(obj, target);
}
const struct obj_command_info obj_cmd_info[] = {
static const struct obj_command_info obj_cmd_info[] = {
{ "RESERVED", 0, 0 },/* this must be first -- for specprocs */
{ "oasound " , do_oasound , 0 },

View file

@ -263,7 +263,7 @@ static void trigedit_disp_types(struct descriptor_data *d)
/****************************************************************************************
DG Scripts Code Syntax Highlighting
Created by Victor Almeida (aka Stoneheart) in Brazil
from BrMUD:Tormenta www.tormenta.com.br (mudbrasil@gmail.com)
from BrMUD:Tormenta www.tormenta.com.br
License: Attribution 4.0 International (CC BY 4.0)
http://creativecommons.org/licenses/by/4.0/
@ -281,7 +281,7 @@ static void trigedit_disp_types(struct descriptor_data *d)
*****************************************************************************************/
// Change a string for another without memory bugs
char *str_replace(const char *string, const char *substr, const char *replacement) {
static char *str_replace(const char *string, const char *substr, const char *replacement) {
char *tok = NULL;
char *newstr = NULL;
char *oldstr = NULL;
@ -317,7 +317,7 @@ char *str_replace(const char *string, const char *substr, const char *replacemen
// You can easily change the color code (\tn) to the old one (@n or &n)
#define SYNTAX_TERMS 49
const char *syntax_color_replacement[SYNTAX_TERMS][2] =
static const char *syntax_color_replacement[SYNTAX_TERMS][2] =
{
// script logic (10)
{ "if", "\tcif\tn" }, // 0
@ -378,7 +378,7 @@ const char *syntax_color_replacement[SYNTAX_TERMS][2] =
// Here you can include more commands usually used in your triggers
#define COMMAND_TERMS 35
const char *command_color_replacement[COMMAND_TERMS][2] =
static const char *command_color_replacement[COMMAND_TERMS][2] =
{
// Mob specific commands (25)
{ "marena", "\tcmarena\tn" }, // 0
@ -420,12 +420,13 @@ const char *command_color_replacement[COMMAND_TERMS][2] =
};
void script_syntax_highlighting(struct descriptor_data *d, char *string)
static void script_syntax_highlighting(struct descriptor_data *d, char *string)
{
ACMD(do_action);
char buffer[MAX_STRING_LENGTH] = "";
char *newlist, *curtok;
int i;
size_t i;
// Parse script text line by line
newlist = strdup(string);

View file

@ -81,9 +81,7 @@ static EVENTFUNC(trig_wait_event);
* a match.
* @todo Move this function to string util library.
* @param cs The string to search.
* @param ct What to search for in cs.
* @retval char * NULL if ct is not a substring of cs, or pointer to the
* location in cs where substring ct begins. */
* @param ct What to search for in cs. */
char *str_str(char *cs, char *ct)
{
char *s, *t;
@ -114,9 +112,7 @@ char *str_str(char *cs, char *ct)
}
/** Returns the number of people in a room.
* @param vnum The virtual number of a room.
* @retval int Returns -1 if the room does not exist, or the total number of
* PCs and NPCs in the room. */
* @param vnum The virtual number of a room. */
int trgvar_in_room(room_vnum vnum)
{
room_rnum rnum = real_room(vnum);
@ -139,8 +135,6 @@ int trgvar_in_room(room_vnum vnum)
* @param name Either the unique id of an object or a string identifying the
* object. Note the unique id must be prefixed with UID_CHAR.
* @param list The list of objects to look through.
* @retval obj_data * Pointer to the object if it is found in the list of
* objects, NULL if the object is not found in the list.
*/
obj_data *get_obj_in_list(char *name, obj_data *list)
{
@ -167,8 +161,6 @@ obj_data *get_obj_in_list(char *name, obj_data *list)
* @param ch Pointer to the NPC/PC to search through.
* @param name String describing either the name of the object or the unique
* id of the object. Note the unique id must be prefixed with UID_CHAR.
* @retval obj_data * Either a pointer to the first object found that matches
* the name argument, or the NULL if the object isn't found.
*/
obj_data *get_object_in_equip(char_data * ch, char *name)
{
@ -211,8 +203,6 @@ obj_data *get_object_in_equip(char_data * ch, char *name)
* Byron Ellacott.
* @param arg Either the name of the position, or the number of a wear
* location definition to check for.
* @retval int If arg is not a valid wear location name or number, return
* -1, else return the defined number of the wear location.
*/
int find_eq_pos_script(char *arg)
{
@ -256,7 +246,6 @@ int find_eq_pos_script(char *arg)
/** Figures out if an object can be worn on a defined wear location.
* @param obj The object to check.
* @param pos The defined wear location to check.
* @retval int TRUE if obj can be worn on pos, FALSE if not.
*/
int can_wear_on_pos(struct obj_data *obj, int pos)
{
@ -285,8 +274,6 @@ int can_wear_on_pos(struct obj_data *obj, int pos)
/** Search for an NPC or PC by number routines.
* @param n The unique ID (PC or NPC) to look for.
* @retval char_data * Pointer to the character structure if it exists, or NULL
* if it cannot be found.
*/
struct char_data *find_char(long n)
{
@ -298,8 +285,6 @@ struct char_data *find_char(long n)
/** Search for an object by number routines.
* @param n The unique ID to look for.
* @retval obj_data * Pointer to the object if it exists, or NULL if it cannot
* be found.
*/
static obj_data *find_obj(long n)
{
@ -311,8 +296,6 @@ static obj_data *find_obj(long n)
/* Search for a room with UID n.
* @param n the Unique ID to look for.
* @retval room_data * Pointer to the room if it exists, or NULL if it cannot
* be found.
*/
static room_data *find_room(long n)
{
@ -332,8 +315,7 @@ static room_data *find_room(long n)
/* Generic searches based only on name. */
/** Search the entire world for an NPC or PC by name.
* @param name String describing the name or the unique id of the char.
* Note the unique id must be prefixed with UID_CHAR.
* @retval char_data * Pointer to the char or NULL if char is not found. */
* Note the unique id must be prefixed with UID_CHAR. */
char_data *get_char(char *name)
{
char_data *i;
@ -359,9 +341,7 @@ char_data *get_char(char *name)
* @param obj An object that will constrain the search to the location that
* the object is in *if* the name argument is not a unique id.
* @param name Character name keyword to search for, or unique ID. Unique
* id must be prefixed with UID_CHAR.
* @retval char_data * Pointer to the the char if found, NULL if not. Will
* only find god characters if DG_ALLOW_GODS is on. */
* id must be prefixed with UID_CHAR. */
char_data *get_char_near_obj(obj_data *obj, char *name)
{
char_data *ch;
@ -389,9 +369,7 @@ char_data *get_char_near_obj(obj_data *obj, char *name)
* @param room A room that will constrain the search to that location
* *if* the name argument is not a unique id.
* @param name Character name keyword to search for, or unique ID. Unique
* id must be prefixed with UID_CHAR.
* @retval char_data * Pointer to the the char if found, NULL if not. Will
* only find god characters if DG_ALLOW_GODS is on. */
* id must be prefixed with UID_CHAR. */
char_data *get_char_in_room(room_data *room, char *name)
{
char_data *ch;
@ -416,8 +394,7 @@ char_data *get_char_in_room(room_data *room, char *name)
* @param obj The obj with which to constrain the search.
* @param name The keyword of the object to search for. If 'self' or 'me'
* are passed in as arguments, obj is returned. Can also be a unique object
* id, and if so it must be prefixed with UID_CHAR.
* @retval obj_data * Pointer to the object if found, NULL if not. */
* id, and if so it must be prefixed with UID_CHAR. */
obj_data *get_obj_near_obj(obj_data *obj, char *name)
{
obj_data *i = NULL;
@ -2958,7 +2935,7 @@ struct lookup_table_t {
void * c;
struct lookup_table_t *next;
};
struct lookup_table_t lookup_table[BUCKET_COUNT];
static struct lookup_table_t lookup_table[BUCKET_COUNT];
void init_lookup_table(void)
{

View file

@ -607,7 +607,7 @@ WCMD(do_wmove)
}
}
const struct wld_command_info wld_cmd_info[] = {
static const struct wld_command_info wld_cmd_info[] = {
{ "RESERVED", 0, 0 },/* this must be first -- for specprocs */
{ "wasound " , do_wasound , 0 },

View file

@ -8,8 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#define __FIGHT_C__
#include "conf.h"
#include "sysdep.h"
#include "structs.h"

View file

@ -37,9 +37,7 @@ void stop_fighting(struct char_data *ch);
/* Global variables */
#ifndef __FIGHT_C__
extern struct attack_hit_type attack_hit_text[];
extern struct char_data *combat_list;
#endif /* __FIGHT_C__ */
#endif /* _FIGHT_H_*/

View file

@ -381,7 +381,7 @@ int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
);
fprintf(fd, convert_from_tabs(buf), 0);
fprintf(fd, "%s", convert_from_tabs(buf));
fprintf(fd, "%d %d %d %d %d %d %d %d %d E\n"
"%d %d %d %dd%d+%d %dd%d+%d\n",

View file

@ -223,7 +223,7 @@ int save_objects(zone_rnum zone_num)
(obj->description && *obj->description) ? obj->description : "undefined",
buf);
fprintf(fp, convert_from_tabs(buf2), 0);
fprintf(fp, "%s", convert_from_tabs(buf2));
sprintascii(ebuf1, GET_OBJ_EXTRA(obj)[0]);
sprintascii(ebuf2, GET_OBJ_EXTRA(obj)[1]);

View file

@ -278,7 +278,7 @@ int sprintascii(char *out, bitvector_t bits)
}
/* converts illegal filename chars into appropriate equivalents */
char *fix_filename(char *str)
static char *fix_filename(char *str)
{
static char good_file_name[MAX_STRING_LENGTH];
char *cindex = good_file_name;

View file

@ -250,7 +250,7 @@ int save_quests(zone_rnum zone_num)
QST_QUANTITY(rnum), QST_GOLD(rnum), QST_EXP(rnum), QST_OBJ(rnum)
);
fprintf(sf, convert_from_tabs(buf), 0);
fprintf(sf, "%s", convert_from_tabs(buf));
num_quests++;
}

View file

@ -105,7 +105,7 @@ int isname(const char *str, const char *namelist)
return 0;
}
void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *msg)
static void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *msg)
{
switch (loc) {
case APPLY_NONE:
@ -394,7 +394,7 @@ void char_to_room(struct char_data *ch, room_rnum room)
{
if (ch == NULL || room == NOWHERE || room > top_of_world)
log("SYSERR: Illegal value(s) passed to char_to_room. (Room: %d/%d Ch: %p",
room, top_of_world, ch);
room, top_of_world, (void *)ch);
else {
ch->next_in_room = world[room].people;
world[room].people = ch;
@ -433,7 +433,7 @@ void obj_to_char(struct obj_data *object, struct char_data *ch)
if (!IS_NPC(ch))
SET_BIT_AR(PLR_FLAGS(ch), PLR_CRASH);
} else
log("SYSERR: NULL obj (%p) or char (%p) passed to obj_to_char.", object, ch);
log("SYSERR: NULL obj (%p) or char (%p) passed to obj_to_char.", (void *)object, (void *)ch);
}
/* take an object from a char */
@ -673,7 +673,7 @@ void obj_to_room(struct obj_data *object, room_rnum room)
{
if (!object || room == NOWHERE || room > top_of_world)
log("SYSERR: Illegal value(s) passed to obj_to_room. (Room #%d/%d, obj %p)",
room, top_of_world, object);
room, top_of_world, (void *)object);
else {
object->next_content = world[room].contents;
world[room].contents = object;
@ -692,7 +692,7 @@ void obj_from_room(struct obj_data *object)
if (!object || IN_ROOM(object) == NOWHERE) {
log("SYSERR: NULL object (%p) or obj not in a room (%d) passed to obj_from_room",
object, IN_ROOM(object));
(void *)object, IN_ROOM(object));
return;
}
@ -720,7 +720,7 @@ void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to)
if (!obj || !obj_to || obj == obj_to) {
log("SYSERR: NULL object (%p) or same source (%p) and target (%p) obj passed to obj_to_obj.",
obj, obj, obj_to);
(void *)obj, (void *)obj, (void *)obj_to);
return;
}

View file

@ -282,7 +282,7 @@ void House_boot(void)
}
/* "House Control" functions */
const char *HCONTROL_FORMAT =
static const char *HCONTROL_FORMAT =
"Usage: hcontrol build <house vnum> <exit direction> <player name>\r\n"
" hcontrol destroy <house vnum>\r\n"
" hcontrol pay <house vnum>\r\n"

View file

@ -43,7 +43,7 @@ IBT_DATA * last_idea = NULL;
IBT_DATA * first_typo = NULL;
IBT_DATA * last_typo = NULL;
const char *ibt_types[]={
static const char *ibt_types[]={
"Bug",
"Idea",
"Typo",
@ -374,7 +374,8 @@ static IBT_DATA *get_last_ibt(int mode)
}
return (last_ibt);
}
IBT_DATA *get_ibt_by_num(int mode, int target_num)
static IBT_DATA *get_ibt_by_num(int mode, int target_num)
{
int no=0;
IBT_DATA *target_ibt, *first_ibt;
@ -391,7 +392,7 @@ IBT_DATA *get_ibt_by_num(int mode, int target_num)
}
/* Search the IBT list, and return true if ibt is found there */
bool ibt_in_list(int mode, IBT_DATA *ibt)
static bool ibt_in_list(int mode, IBT_DATA *ibt)
{
IBT_DATA *target_ibt, *first_ibt;
@ -407,7 +408,7 @@ bool ibt_in_list(int mode, IBT_DATA *ibt)
/* Free up an IBT struct, removing it from the list if necessary */
/* returns TRUE on success */
bool free_ibt(int mode, IBT_DATA *ibtData)
static bool free_ibt(int mode, IBT_DATA *ibtData)
{
if (ibtData == NULL) return FALSE;
@ -454,7 +455,8 @@ ACMD(do_ibt)
{
char arg[MAX_STRING_LENGTH], arg2[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH], *arg_text, imp[30], timestr[128];
int i, num_res, num_unres, len = 0;
int i, num_res, num_unres;
size_t len = 0;
IBT_DATA *ibtData, *first_ibt, *last_ibt;
int ano=0;

View file

@ -98,6 +98,6 @@ void save_ibt_file(int mode);
void load_ibt_file(int mode);
void ibtedit_parse(struct descriptor_data *d, char *arg);
void ibtedit_string_cleanup(struct descriptor_data *d, int terminator);
void free_ibt_lists();
void free_ibt_lists(void);
void free_olc_ibt(IBT_DATA *toFree);
void clean_ibt_list(int mode);

View file

@ -8,8 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#define __INTERPRETER_C__
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
@ -368,7 +366,7 @@ cpp_extern const struct command_info cmd_info[] = {
/* Thanks to Melzaren for this change to allow DG Scripts to be attachable
*to player's while still disallowing them to manually use the DG-Commands. */
const struct mob_script_command_t mob_script_commands[] = {
static const struct mob_script_command_t mob_script_commands[] = {
/* DG trigger commands. minimum_level should be set to -1. */
{ "masound" , do_masound , 0 },
@ -420,7 +418,7 @@ int script_command_interpreter(struct char_data *ch, char *arg) {
return 1; // We took care of execution. Let caller know.
}
const char *fill[] =
static const char *fill[] =
{
"in",
"from",
@ -432,7 +430,7 @@ const char *fill[] =
"\n"
};
const char *reserved[] =
static const char *reserved[] =
{
"a",
"an",

View file

@ -120,13 +120,9 @@ struct alias_data {
/* Necessary for CMD_IS macro. Borland needs the structure defined first
* so it has been moved down here. */
/* Global buffering system */
#ifndef __INTERPRETER_C__
extern int *cmd_sort_info;
extern struct command_info *complete_cmd_info;
extern const struct command_info cmd_info[];
#endif /* __INTERPRETER_C__ */
#endif /* _INTERPRETER_H_ */

View file

@ -41,7 +41,7 @@ struct list_data * create_list(void)
return (pNewList);
}
struct item_data * create_item(void)
static struct item_data * create_item(void)
{
struct item_data *pNewItem;
@ -235,18 +235,6 @@ void clear_simple_list(void)
pLastList = NULL;
}
/** This is the "For Dummies" function, as although it's not as flexible,
* it is even easier applied for list searches then using your own iterators
* and next_in_list()
* @usage Common usage would be as follows:
*
* while ((var = (struct XXX_data *) simple_list(XXX_list))) {
* blah blah....
* }
* @return Will return the next list content until it hits the end, in which
* will detach itself from the list.
* */
void * simple_list(struct list_data * pList)
{
void * pContent;

View file

@ -1,6 +1,4 @@
/**
* @file msgedit.h
*
* Copyright 2012 Joseph Arnusch
*
* This program is free software; you can redistribute it and/or modify

View file

@ -83,8 +83,6 @@ EVENTFUNC(event_countdown)
break;
case eNULL:
break;
default:
break;
}
return 0;
@ -235,39 +233,3 @@ void clear_char_event_list(struct char_data * ch)
event_cancel(pEvent);
}
}
/* change_event_duration contributed by Ripley */
void change_event_duration(struct char_data * ch, event_id iId, long time)
{
struct event * pEvent;
struct mud_event_data * pMudEvent = 0;
bool found = FALSE;
if (ch->events == NULL)
return;
if (ch->events->iSize == 0)
return;
clear_simple_list();
while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) {
if (!pEvent->isMudEvent)
continue;
pMudEvent = (struct mud_event_data * ) pEvent->event_obj;
if (pMudEvent->iId == iId) {
found = TRUE;
break;
}
}
if (found) {
/* So we found the offending event, now build a new one, with the new time */
attach_mud_event(new_mud_event(iId, pMudEvent->pStruct, pMudEvent->sVariables), time);
event_cancel(pEvent);
}
}

View file

@ -28,26 +28,6 @@
#include "ibt.h"
#include "msgedit.h"
/* Internal Data Structures */
/** @deprecated olc_scmd_info appears to be deprecated. Commented out for now.
static struct olc_scmd_info_t {
const char *text;
int con_type;
} olc_scmd_info[] = {
{ "room", CON_REDIT },
{ "object", CON_OEDIT },
{ "zone", CON_ZEDIT },
{ "mobile", CON_MEDIT },
{ "shop", CON_SEDIT },
{ "config", CON_CEDIT },
{ "trigger", CON_TRIGEDIT },
{ "action", CON_AEDIT },
{ "help", CON_HEDIT },
{ "quest", CON_QEDIT },
{ "\n", -1 }
};
*/
/* Global variables defined here, used elsewhere */
const char *nrm, *grn, *cyn, *yel;

View file

@ -39,7 +39,7 @@ static void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin , o
static void list_shops(struct char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax);
static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax, char *name);
void perform_mob_flag_list(struct char_data * ch, char *arg)
static void perform_mob_flag_list(struct char_data * ch, char *arg)
{
int num, mob_flag, found = 0;
size_t len;
@ -76,7 +76,7 @@ void perform_mob_flag_list(struct char_data * ch, char *arg)
return;
}
void perform_mob_level_list(struct char_data * ch, char *arg)
static void perform_mob_level_list(struct char_data * ch, char *arg)
{
int num, mob_level, found = 0;
size_t len;
@ -112,7 +112,7 @@ void perform_mob_level_list(struct char_data * ch, char *arg)
return;
}
void add_to_obj_list(struct obj_list_item *lst, int num_items, obj_vnum nvo, int nval)
static void add_to_obj_list(struct obj_list_item *lst, int num_items, obj_vnum nvo, int nval)
{
int j, tmp_v;
obj_vnum tmp_ov;
@ -131,7 +131,7 @@ void add_to_obj_list(struct obj_list_item *lst, int num_items, obj_vnum nvo, int
}
}
void perform_obj_type_list(struct char_data * ch, char *arg)
static void perform_obj_type_list(struct char_data * ch, char *arg)
{
int num, itemtype, v1, v2, found = 0;
size_t len = 0, tmp_len = 0;
@ -246,7 +246,7 @@ void perform_obj_type_list(struct char_data * ch, char *arg)
page_string(ch->desc, buf, TRUE);
}
void perform_obj_aff_list(struct char_data * ch, char *arg)
static void perform_obj_aff_list(struct char_data * ch, char *arg)
{
int num, i, apply, v1 = 0, found = 0;
size_t len = 0, tmp_len = 0;
@ -331,7 +331,7 @@ void perform_obj_aff_list(struct char_data * ch, char *arg)
page_string(ch->desc, buf, TRUE);
}
void perform_obj_name_list(struct char_data * ch, char *arg)
static void perform_obj_name_list(struct char_data * ch, char *arg)
{
int num, found = 0;
size_t len = 0, tmp_len = 0;

View file

@ -1016,7 +1016,7 @@ obj_save_data *objsave_parse_objects(FILE *fl)
/* Do nothing. */
} else if (temp != NULL && current->obj != NULL) {
if (temp != current->obj)
log("inconsistent object pointers in objsave_parse_objects: %p/%p", temp, current->obj);
log("inconsistent object pointers in objsave_parse_objects: %p/%p", (void *)temp, (void *)current->obj);
}
break;
@ -1213,7 +1213,7 @@ static int Crash_load_objs(struct char_data *ch) {
if (rentcode == RENT_RENTED || rentcode == RENT_TIMEDOUT) {
sprintf(str, "%d", SECS_PER_REAL_DAY);
num_of_days = (int)((float) (time(0) - timed) / (float)atoi(str));
num_of_days = (int)((float) (time(0) - timed) / atoi(str));
cost = (unsigned int) (netcost * num_of_days);
if (cost > (unsigned int)GET_GOLD(ch) + (unsigned int)GET_BANK_GOLD(ch)) {
fclose(fl);

View file

@ -34,17 +34,6 @@
#define PT_FLAGS(i) (player_table[(i)].flags)
#define PT_LLAST(i) (player_table[(i)].last)
/* 'global' vars defined here and used externally */
/** @deprecated Since this file really is basically a functional extension
* of the database handling in db.c, until the day that the mud is broken
* down to be less monolithic, I don't see why the following should be defined
* anywhere but there.
struct player_index_element *player_table = NULL;
int top_of_p_table = 0;
int top_of_p_file = 0;
long top_idnum = 0;
*/
/* local functions */
static void load_affects(FILE *fl, struct char_data *ch);
static void load_skills(FILE *fl, struct char_data *ch);
@ -127,7 +116,7 @@ int create_entry(char *name)
/* Remove an entry from the in-memory player index table. *
* Requires the 'pos' value returned by the get_ptable_by_name function */
void remove_player_from_index(int pos)
static void remove_player_from_index(int pos)
{
int i;

View file

@ -2498,15 +2498,19 @@ static bool_t IsValidColour( const char *apArgument )
static bool_t MatchString( const char *apFirst, const char *apSecond )
{
while ( *apFirst && tolower(*apFirst) == tolower(*apSecond) )
++apFirst, ++apSecond;
while ( *apFirst && tolower(*apFirst) == tolower(*apSecond) ) {
++apFirst;
++apSecond;
}
return ( !*apFirst && !*apSecond );
}
static bool_t PrefixString( const char *apPart, const char *apWhole )
{
while ( *apPart && tolower(*apPart) == tolower(*apWhole) )
++apPart, ++apWhole;
while ( *apPart && tolower(*apPart) == tolower(*apWhole) ) {
++apPart;
++apWhole;
}
return ( !*apPart );
}

View file

@ -191,7 +191,7 @@ typedef struct
{
const char *pName; /* The name of the MSSP variable */
const char *pValue; /* The value of the MSSP variable */
const char *(*pFunction)();/* Optional function to return the value */
const char *(*pFunction)(void); /* Optional function to return the value */
} MSSP_t;
typedef struct

View file

@ -352,7 +352,7 @@ static void qedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = QEDIT_MAIN_MENU;
}
/* For quest type. */
void qedit_disp_type_menu(struct descriptor_data *d)
static void qedit_disp_type_menu(struct descriptor_data *d)
{
clear_screen(d);
column_list(d->character, 0, quest_types, NUM_AQ_TYPES, TRUE);
@ -360,7 +360,7 @@ void qedit_disp_type_menu(struct descriptor_data *d)
OLC_MODE(d) = QEDIT_TYPES;
}
/* For quest flags. */
void qedit_disp_flag_menu(struct descriptor_data *d)
static void qedit_disp_flag_menu(struct descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];

View file

@ -8,8 +8,6 @@
* Copyright (C) 1997 MS *
*********************************************************************** */
#define __QUEST_C__
#include "conf.h"
#include "sysdep.h"
@ -478,7 +476,7 @@ void list_quests(struct char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum v
send_to_char(ch, "None found.\r\n");
}
void quest_hist(struct char_data *ch)
static void quest_hist(struct char_data *ch)
{
int i = 0, counter = 0;
qst_rnum rnum = NOTHING;
@ -498,7 +496,7 @@ void quest_hist(struct char_data *ch)
send_to_char(ch, "You haven't completed any quests yet.\r\n");
}
void quest_join(struct char_data *ch, struct char_data *qm, char argument[MAX_INPUT_LENGTH])
static void quest_join(struct char_data *ch, struct char_data *qm, char argument[MAX_INPUT_LENGTH])
{
qst_vnum vnum;
qst_rnum rnum;
@ -582,7 +580,7 @@ void quest_list(struct char_data *ch, struct char_data *qm, char argument[MAX_IN
send_to_char(ch, "There is no further information on that quest.\r\n");
}
void quest_quit(struct char_data *ch)
static void quest_quit(struct char_data *ch)
{
qst_rnum rnum;
@ -608,7 +606,7 @@ void quest_quit(struct char_data *ch)
}
}
void quest_progress(struct char_data *ch)
static void quest_progress(struct char_data *ch)
{
qst_rnum rnum;
@ -632,7 +630,7 @@ void quest_progress(struct char_data *ch)
}
}
void quest_show(struct char_data *ch, mob_vnum qm)
static void quest_show(struct char_data *ch, mob_vnum qm)
{
qst_rnum rnum;
int counter = 0;
@ -650,7 +648,7 @@ void quest_show(struct char_data *ch, mob_vnum qm)
send_to_char(ch, "There are no quests available here at the moment.\r\n");
}
void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
{
qst_rnum rnum;
mob_rnum qmrnum;

View file

@ -141,9 +141,7 @@ int save_quests(zone_rnum zone_num);
/* ******************************************************************** */
/* AQ Global Variables ************************************************ */
#ifndef __QUEST_C__
extern const char *aq_flags[]; /* names for quest flags (quest.c) */
extern const char *quest_types[]; /* named for quest types (quest.c) */
#endif /* __QUEST_C__ */
#endif /* _QUEST_H_ */

View file

@ -708,10 +708,10 @@ void sedit_parse(struct descriptor_data *d, char *arg)
S_CLOSE2(OLC_SHOP(d)) = LIMIT(atoi(arg), 0, 28);
break;
case SEDIT_BUY_PROFIT:
sscanf(arg, "%f", &S_BUYPROFIT(OLC_SHOP(d)));
sscanf(arg, "%lf", &S_BUYPROFIT(OLC_SHOP(d)));
break;
case SEDIT_SELL_PROFIT:
sscanf(arg, "%f", &S_SELLPROFIT(OLC_SHOP(d)));
sscanf(arg, "%lf", &S_SELLPROFIT(OLC_SHOP(d)));
break;
case SEDIT_TYPE_MENU:
OLC_VAL(d) = LIMIT(atoi(arg), 0, NUM_ITEM_TYPES - 1);

View file

@ -9,8 +9,6 @@
* By Jeff Fink. *
**************************************************************************/
#define __SHOP_C__
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
@ -458,15 +456,15 @@ static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct
static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer)
{
return (int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr)
* (1 + (GET_CHA(keeper) - GET_CHA(buyer)) / (float)70));
* (1 + (GET_CHA(keeper) - GET_CHA(buyer)) / (double)70));
}
/* 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)
{
float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / (float)70);
float buy_cost_modifier = SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(seller)) / (float)70);
float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / (double)70);
float buy_cost_modifier = SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(seller)) / (double)70);
if (sell_cost_modifier > buy_cost_modifier)
sell_cost_modifier = buy_cost_modifier;

View file

@ -31,8 +31,8 @@ struct shop_buy_data {
struct shop_data {
room_vnum vnum; /* Virtual number of this shop */
obj_vnum *producing; /* Which item to produce (virtual) */
float profit_buy; /* Factor to multiply cost with */
float profit_sell; /* Factor to multiply cost with */
double profit_buy; /* Factor to multiply cost with */
double profit_sell; /* Factor to multiply cost with */
struct shop_buy_data *type; /* Which items to trade */
char *no_such_item1; /* Message if keeper hasn't got an item */
char *no_such_item2; /* Message if player hasn't got an item */
@ -151,11 +151,8 @@ struct stack_data {
#define MSG_CANT_KILL_KEEPER "Get out of here before I call the guards!"
/* Global variables */
#ifndef __SHOP_C__
extern const char *trade_letters[];
extern const char *shop_bits[];
#endif /* __SHOP_C__ */
#endif /* _SHOP_H_ */

View file

@ -172,7 +172,7 @@ struct spec_func_data {
SPECIAL(*func);
};
struct spec_func_data spec_func_list[] = {
static struct spec_func_data spec_func_list[] = {
{"Mayor", mayor },
{"Snake", snake },
{"Thief", thief },

View file

@ -81,7 +81,7 @@ static const char *how_good(int percent)
return " (superb)";
}
const char *prac_types[] = {
static const char *prac_types[] = {
"spell",
"skill"
};

View file

@ -26,12 +26,16 @@ void assign_mobiles(void);
void assign_objects(void);
void assign_rooms(void);
#include "structs.h"
const char *get_spec_func_name(SPECIAL(*func));
/*****************************************************************************
* Begin Functions and defines for spec_procs.c
****************************************************************************/
/* Utility functions */
void sort_spells(void);
void list_skills(struct char_data *ch);
/* Special functions */
SPECIAL(guild);
SPECIAL(dump);

View file

@ -8,8 +8,6 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#define __SPELL_PARSER_C__
#include "conf.h"
#include "sysdep.h"
#include "structs.h"

View file

@ -161,7 +161,7 @@ ASPELL(spell_summon)
}
/* Used by the locate object spell to check the alias list on objects */
int isname_obj(char *search, char *list)
static int isname_obj(char *search, char *list)
{
char *found_in_list; /* But could be something like 'ring' in 'shimmering.' */
char searchname[128];

View file

@ -282,13 +282,9 @@ ACMD(do_cast);
void unused_spell(int spl);
void mag_assign_spells(void);
/* Global variables exported */
#ifndef __SPELL_PARSER_C__
/* Global variables */
extern struct spell_info_type spell_info[];
extern char cast_arg2[];
extern const char *unused_spellname;
#endif /* __SPELL_PARSER_C__ */
#endif /* _SPELLS_H_ */

View file

@ -171,9 +171,6 @@ extern void abort (), exit ();
#define assert(arg)
#endif
/* Header files only used in comm.c and some of the utils */
#if defined(__COMM_C__) || defined(CIRCLE_UTIL)
#ifndef HAVE_STRUCT_IN_ADDR
struct in_addr {
unsigned long int s_addr; /* for inet_addr, etc. */
@ -230,17 +227,10 @@ struct in_addr {
# include <sys/uio.h>
#endif
#endif /* __COMM_C__ && CIRCLE_UNIX */
/* Header files that are only used in act.other.c */
#ifdef __ACT_OTHER_C__
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#endif /* __ACT_OTHER_C__ */
/* Basic system dependencies. */
#if CIRCLE_GNU_LIBC_MEMORY_TRACK && !defined(HAVE_MCHECK_H)
#error "Cannot use GNU C library memory tracking without <mcheck.h>"
@ -464,9 +454,6 @@ struct in_addr {
int remove(const char *path);
#endif
/* Function prototypes that are only used in comm.c and some of the utils */
#if defined(__COMM_C__) || defined(CIRCLE_UTIL)
#ifdef NEED_ACCEPT_PROTO
int accept(socket_t s, struct sockaddr *addr, int *addrlen);
#endif
@ -574,8 +561,6 @@ struct in_addr {
ssize_t write(int fildes, const void *buf, size_t nbyte);
#endif
#endif /* __COMM_C__ */
#endif /* NO_LIBRARY_PROTOTYPES */
#endif /* _SYSDEP_H_ */

View file

@ -26,8 +26,7 @@
/** Aportable random number function.
* @param from The lower bounds of the random number.
* @param to The upper bounds of the random number.
* @retval int The resulting randomly generated number. */
* @param to The upper bounds of the random number. */
int rand_number(int from, int to)
{
/* error checking in case people call this incorrectly */
@ -50,8 +49,7 @@ int rand_number(int from, int to)
/** Simulates a single dice roll from one to many of a certain sized die.
* @param num The number of dice to roll.
* @param size The number of sides each die has, and hence the number range
* of the die.
* @retval int The sum of all the dice rolled. A random number. */
* of the die. */
int dice(int num, int size)
{
int sum = 0;
@ -67,8 +65,7 @@ int dice(int num, int size)
/** Return the smaller number. Original note: Be wary of sign issues with this.
* @param a The first number.
* @param b The second number.
* @retval int The smaller of the two, a or b. */
* @param b The second number. */
int MIN(int a, int b)
{
return (a < b ? a : b);
@ -76,16 +73,14 @@ int MIN(int a, int b)
/** Return the larger number. Original note: Be wary of sign issues with this.
* @param a The first number.
* @param b The second number.
* @retval int The larger of the two, a or b. */
* @param b The second number. */
int MAX(int a, int b)
{
return (a > b ? a : b);
}
/** Used to capitalize a string. Will not change any mud specific color codes.
* @param txt The string to capitalize.
* @retval char* Pointer to the capitalized string. */
* @param txt The string to capitalize. */
char *CAP(char *txt)
{
char *p = txt;
@ -132,9 +127,9 @@ char *strdup(const char *source)
}
#endif
/** Strips "\r\n" from just the end of a string. Will not remove internal
* "\r\n" values to the string.
* @post Replaces any "\r\n" values at the end of the string with null.
/** Strips "\\r\\n" from just the end of a string. Will not remove internal
* "\\r\\n" values to the string.
* @post Replaces any "\\r\\n" values at the end of the string with null.
* @param txt The writable string to prune. */
void prune_crlf(char *txt)
{
@ -153,7 +148,7 @@ int str_cmp(const char *arg1, const char *arg2)
int chk, i;
if (arg1 == NULL || arg2 == NULL) {
log("SYSERR: str_cmp() passed a NULL pointer, %p or %p.", arg1, arg2);
log("SYSERR: str_cmp() passed a NULL pointer, %p or %p.", (void *)arg1, (void *)arg2);
return (0);
}
@ -174,7 +169,7 @@ int strn_cmp(const char *arg1, const char *arg2, int n)
int chk, i;
if (arg1 == NULL || arg2 == NULL) {
log("SYSERR: strn_cmp() passed a NULL pointer, %p or %p.", arg1, arg2);
log("SYSERR: strn_cmp() passed a NULL pointer, %p or %p.", (void *)arg1, (void *)arg2);
return (0);
}
@ -233,9 +228,7 @@ void basic_mud_log(const char *format, ...)
/** Essentially the touch command. Create an empty file or update the modified
* time of a file.
* @param path The filepath to "touch." This filepath is relative to the /lib
* directory relative to the root of the mud distribution.
* @retval int 0 on a success, -1 on a failure; standard system call exit
* values. */
* directory relative to the root of the mud distribution. */
int touch(const char *path)
{
FILE *fl;
@ -302,12 +295,12 @@ void mudlog(int type, int level, int file, const char *str, ...)
/** Take a bitvector and return a human readable
* description of which bits are set in it.
* @pre The final element in the names array must contain a one character
* string consisting of a single newline character "\n". Caller of function is
* string consisting of a single newline character "\\n". Caller of function is
* responsible for creating the memory buffer for the result string.
* @param[in] bitvector The bitvector to test for set bits.
* @param[in] names An array of human readable strings describing each possible
* bit. The final element in this array must be a string made of a single
* newline character (eg "\n").
* newline character (eg "\\n").
* If you don't have a 'const' array for the names param, cast it as such.
* @param[out] result Holds the names of the set bits in bitvector. The bit
* names will be delimited by a single space.
@ -315,8 +308,7 @@ void mudlog(int type, int level, int file, const char *str, ...)
* Will be set to "NOBITS" if no bits are set in bitvector (ie bitvector = 0).
* @param[in] reslen The length of the available memory in the result buffer.
* Ideally, results will be large enough to hold the description of every bit
* that could possibly be set in bitvector.
* @retval size_t The length of the string copied into result. */
* that could possibly be set in bitvector. */
size_t sprintbit(bitvector_t bitvector, const char *names[], char *result, size_t reslen)
{
size_t len = 0;
@ -345,18 +337,17 @@ size_t sprintbit(bitvector_t bitvector, const char *names[], char *result, size_
/** Return the human readable name of a defined type.
* @pre The final element in the names array must contain a one character
* string consisting of a single newline character "\n". Caller of function is
* string consisting of a single newline character "\\n". Caller of function is
* responsible for creating the memory buffer for the result string.
* @param[in] type The type number to be translated.
* @param[in] names An array of human readable strings describing each possible
* bit. The final element in this array must be a string made of a single
* newline character (eg "\n").
* newline character (eg "\\n").
* @param[out] result Holds the translated name of the type.
* Caller of sprintbit is responsible for creating the buffer for result.
* Will be set to "UNDEFINED" if the type is greater than the number of names
* available.
* @param[in] reslen The length of the available memory in the result buffer.
* @retval size_t The length of the string copied into result. */
* @param[in] reslen The length of the available memory in the result buffer. */
size_t sprinttype(int type, const char *names[], char *result, size_t reslen)
{
int nr = 0;
@ -372,14 +363,14 @@ size_t sprinttype(int type, const char *names[], char *result, size_t reslen)
/** Take a bitarray and return a human readable description of which bits are
* set in it.
* @pre The final element in the names array must contain a one character
* string consisting of a single newline character "\n". Caller of function is
* string consisting of a single newline character "\\n". Caller of function is
* responsible for creating the memory buffer for the result string large enough
* to hold all possible bit translations. There is no error checking for
* possible array overflow for result.
* @param[in] bitvector The bitarray in which to test for set bits.
* @param[in] names An array of human readable strings describing each possible
* bit. The final element in this array must be a string made of a single
* newline character (eg "\n").
* newline character (eg "\\n").
* If you don't have a 'const' array for the names param, cast it as such.
* @param[in] maxar The number of 'bytes' in the bitarray. This number will
* usually be pre-defined for the particular bitarray you are using.
@ -427,10 +418,7 @@ void sprintbitarray(int bitvector[], const char *names[], int maxar, char *resul
* @todo Recommend making this function foresightedly useful by calculating
* real months and years, too.
* @param t2 The later time.
* @param t1 The earlier time.
* @retval time_info_data The real hours and days passed between t2 and t1. Only
* the hours and days are returned, months and years are ignored and returned
* as -1 values. */
* @param t1 The earlier time. */
struct time_info_data *real_time_passed(time_t t2, time_t t1)
{
long secs;
@ -452,10 +440,7 @@ struct time_info_data *real_time_passed(time_t t2, time_t t1)
/** Calculate the MUD time passed between two time invervals.
* @param t2 The later time.
* @param t1 The earlier time.
* @retval time_info_data A pointer to the mud hours, days, months and years
* that have passed between the two time intervals. DO NOT FREE the structure
* pointed to by the return value. */
* @param t1 The earlier time. */
struct time_info_data *mud_time_passed(time_t t2, time_t t1)
{
long secs;
@ -478,9 +463,7 @@ struct time_info_data *mud_time_passed(time_t t2, time_t t1)
}
/** Translate the current mud time to real seconds (in type time_t).
* @param now The current mud time to translate into a real time unit.
* @retval time_t The real time that would have had to have passed
* to represent the mud time represented by the now parameter. */
* @param now The current mud time to translate into a real time unit. */
time_t mud_time_to_secs(struct time_info_data *now)
{
time_t when = 0;
@ -495,9 +478,7 @@ time_t mud_time_to_secs(struct time_info_data *now)
/** Calculate a player's MUD age.
* @todo The minimum starting age of 17 is hardcoded in this function. Recommend
* changing the minimum age to a property (variable) external to this function.
* @param ch A valid player character.
* @retval time_info_data A pointer to the mud age in years of the player
* character. DO NOT FREE the structure pointed to by the return value. */
* @param ch A valid player character. */
struct time_info_data *age(struct char_data *ch)
{
static struct time_info_data player_age;
@ -513,9 +494,7 @@ struct time_info_data *age(struct char_data *ch)
* essence, this prevents someone from following a character in a group that
* is already being lead by the character.
* @param ch The character trying to follow.
* @param victim The character being followed.
* @retval bool TRUE if ch is already leading someone in victims group, FALSE
* if it is okay for ch to follow victim. */
* @param victim The character being followed. */
bool circle_follow(struct char_data *ch, struct char_data *victim)
{
struct char_data *k;
@ -578,7 +557,6 @@ void stop_follower(struct char_data *ch)
/** Finds the number of follows that are following, and charmed by, the
* character (PC or NPC).
* @param ch The character to check for charmed followers.
* @retval int The number of followers that are also charmed by the character.
*/
int num_followers_charmed(struct char_data *ch)
{
@ -649,8 +627,7 @@ void add_follower(struct char_data *ch, struct char_data *leader)
* returned in buf.
* @param[in] fl The file to be read from.
* @param[out] buf The next non-blank line read from the file. Buffer given must
* be at least READ_SIZE (256) characters large.
* @retval int The number of lines advanced in the file. */
* be at least READ_SIZE (256) characters large. */
int get_line(FILE *fl, char *buf)
{
char temp[READ_SIZE];
@ -685,8 +662,7 @@ int get_line(FILE *fl, char *buf)
* @param[in] mode What type of files can be created. Currently, recognized
* modes are CRASH_FILE, ETEXT_FILE, SCRIPT_VARS_FILE and PLR_FILE.
* @param[in] orig_name The player name to create the filepath (of type mode)
* for.
* @retval int 0 if filename cannot be created, 1 if it can. */
* for. */
int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_name)
{
const char *prefix, *middle, *suffix;
@ -694,7 +670,7 @@ int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_nam
if (orig_name == NULL || *orig_name == '\0' || filename == NULL) {
log("SYSERR: NULL pointer or empty string passed to get_filename(), %p or %p.",
orig_name, filename);
(const void *)orig_name, (void *)filename);
return (0);
}
@ -796,8 +772,7 @@ void core_dump_real(const char *who, int line)
/** Count the number bytes taken up by color codes in a string that will be
* empty space once the color codes are converted and made non-printable.
* @param string The string in which to check for color codes.
* @retval int the number of color codes found. */
* @param string The string in which to check for color codes. */
int count_color_chars(char *string)
{
int i, len;
@ -855,8 +830,7 @@ int count_non_protocol_chars(char * str)
* Inside and City rooms are always lit. Outside rooms are dark at sunset and
* night.
* @todo Make the return value a bool.
* @param room The real room to test for.
* @retval int FALSE if the room is lit, TRUE if the room is dark. */
* @param room The real room to test for. */
int room_is_dark(room_rnum room)
{
if (!VALID_ROOM_RNUM(room)) {
@ -886,8 +860,7 @@ int room_is_dark(room_rnum room)
* down the possible choices. For more information about Levenshtein distance,
* recommend doing an internet or wikipedia search.
* @param s1 The input string.
* @param s2 The string to be compared to.
* @retval int The Levenshtein distance between s1 and s2. */
* @param s2 The string to be compared to. */
int levenshtein_distance(const char *s1, const char *s2)
{
int **d, i, j;
@ -1049,8 +1022,6 @@ void column_list(struct char_data *ch, int num_cols, const char **list, int list
* @param flag_list An array of flag name strings. The final element must
* be a string made up of a single newline.
* @param flag_name The name to search in flag_list.
* @retval int Returns the element number in flag_list of flag_name or
* NOFLAG (-1) if no match.
*/
int get_flag_by_name(const char *flag_list[], char *flag_name)
{
@ -1078,10 +1049,6 @@ int get_flag_by_name(const char *flag_list[], char *flag_name)
* @param[in] bufsize The total size of the buffer.
* @param[in] lines_to_read The number of lines to be read from the front of
* the file.
* @retval int The number of lines actually read from the file. Can be used
* the compare with the number of lines requested to be read to determine if the
* entire file was read. If lines_to_read is <= 0, no processing occurs
* and lines_to_read is returned.
*/
int file_head( FILE *file, char *buf, size_t bufsize, int lines_to_read )
{
@ -1159,10 +1126,6 @@ int file_head( FILE *file, char *buf, size_t bufsize, int lines_to_read )
* @param[in] bufsize The total size of the buffer.
* @param[in] lines_to_read The number of lines to be read from the back of
* the file.
* @retval int The number of lines actually read from the file. Can be used
* the compare with the number of lines requested to be read to determine if the
* entire file was read. If lines_to_read is <= 0, no processing occurs
* and lines_to_read is returned.
*/
int file_tail( FILE *file, char *buf, size_t bufsize, int lines_to_read )
{
@ -1244,8 +1207,6 @@ int file_tail( FILE *file, char *buf, size_t bufsize, int lines_to_read )
* @pre file parameter must already be opened.
* @post file will be rewound.
* @param file The file to determine the size of.
* @retval size_t The byte size of the file (we assume no errors will be
* encountered in this function).
*/
size_t file_sizeof( FILE *file )
{
@ -1269,14 +1230,12 @@ size_t file_sizeof( FILE *file )
return numbytes;
}
/** Returns the number of newlines '\n' in a file, which we equate to number of
/** Returns the number of newlines "\\n" in a file, which we equate to number of
* lines. We assume the int type more than adequate to count the number of lines
* and do not make checks for overrunning INT_MAX.
* @pre file parameter must already be opened.
* @post file will be rewound.
* @param file The file to determine the size of.
* @retval size_t The byte size of the file (we assume no errors will be
* encountered in this function).
*/
int file_numlines( FILE *file )
{
@ -1305,7 +1264,6 @@ int file_numlines( FILE *file )
* @pre Assumes that NOWHERE, NOTHING, NOBODY, NOFLAG, etc are all equal.
* @param str_to_conv A string of characters to attempt to convert to an
* IDXTYPE number.
* @retval IDXTYPE A valid index number, or NOWHERE if not valid.
*/
IDXTYPE atoidx( const char *str_to_conv )
{
@ -1456,7 +1414,6 @@ char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad)
@param str1 The string to be displayed on the left.
@param str2 The string to be displayed on the right.
@param joiner ???.
@retval char * Pointer to the output to be displayed?
*/
char *strpaste(char *str1, char *str2, char *joiner)
{

View file

@ -371,7 +371,7 @@ static int start_change_command(struct descriptor_data *d, int pos)
}
/*------------------------------------------------------------------*/
void zedit_disp_flag_menu(struct descriptor_data *d)
static void zedit_disp_flag_menu(struct descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
@ -385,7 +385,7 @@ void zedit_disp_flag_menu(struct descriptor_data *d)
}
/*------------------------------------------------------------------*/
bool zedit_get_levels(struct descriptor_data *d, char *buf)
static bool zedit_get_levels(struct descriptor_data *d, char *buf)
{
/* Create a string for the recommended levels for this zone. */
if ((OLC_ZONE(d)->min_level == -1) && (OLC_ZONE(d)->max_level == -1)) {
@ -688,7 +688,7 @@ static void zedit_disp_arg3(struct descriptor_data *d)
/*
* Print the recommended levels menu and setup response catch.
*/
void zedit_disp_levels(struct descriptor_data *d)
static void zedit_disp_levels(struct descriptor_data *d)
{
char lev_string[50];
bool levels_set = FALSE;

View file

@ -30,7 +30,7 @@ static unsigned char endPad[4] = {
0xde, 0xad, 0xde, 0xad };
#endif
FILE *zfd = NULL;
static FILE *zfd = NULL;
typedef struct meminfo {
struct meminfo *next;
@ -49,7 +49,7 @@ static meminfo *memlist[NUM_ZBUCKETS];
* 2 = errors with dumps
* 3 = all of the above plus all mallocs/frees
*/
int zmalloclogging = 2;
static int zmalloclogging = 2;
/* functions: */
unsigned char *zmalloc(int len, char *file, int line);
@ -129,7 +129,7 @@ unsigned char *zmalloc(int len, char *file, int line)
#endif
if (zmalloclogging > 2)
fprintf(zfd,"zmalloc: 0x%p %d bytes %s:%d\n", ret, len, file, line);
fprintf(zfd,"zmalloc: 0x%p %d bytes %s:%d\n", (void *)ret, len, file, line);
m = (meminfo *) calloc(1, sizeof(meminfo));
if (!m) {
@ -167,7 +167,7 @@ unsigned char *zrealloc(unsigned char *what, int len, char *file, int line)
if (!ret) {
fprintf(zfd,"zrealloc: FAILED for 0x%p %d bytes mallocd at %s:%d,\n"
" %d bytes reallocd at %s:%d.\n",
m->addr, m->size, m->file, m->line, len, file, line);
(void *)m->addr, m->size, m->file, m->line, len, file, line);
if (zmalloclogging > 1) zdump(m);
return NULL;
}
@ -179,7 +179,7 @@ unsigned char *zrealloc(unsigned char *what, int len, char *file, int line)
#endif
if (zmalloclogging > 2)
fprintf(zfd,"zrealloc: 0x%p %d bytes mallocd at %s:%d, %d bytes reallocd at %s:%d.\n",
m->addr, m->size, m->file, m->line, len, file, line);
(void *)m->addr, m->size, m->file, m->line, len, file, line);
m->addr = ret;
m->size = len;
@ -206,7 +206,7 @@ unsigned char *zrealloc(unsigned char *what, int len, char *file, int line)
/* NULL or invalid pointer given */
fprintf(zfd,"zrealloc: invalid pointer 0x%p, %d bytes to realloc at %s:%d.\n",
what, len, file, line);
(void *)what, len, file, line);
return (zmalloc(len, file, line));
}
@ -228,7 +228,7 @@ void zfree(unsigned char *what, char *file, int line)
/* got it. Print it if verbose: */
if (zmalloclogging > 2) {
fprintf(zfd,"zfree: Freed 0x%p %d bytes mallocd at %s:%d, freed at %s:%d\n",
m->addr, m->size, m->file, m->line, file, line);
(void *)m->addr, m->size, m->file, m->line, file, line);
}
/* check the padding: */
pad_check(m);
@ -240,7 +240,7 @@ void zfree(unsigned char *what, char *file, int line)
if (m->frees > 1) {
fprintf(zfd,"zfree: ERR: multiple frees! 0x%p %d bytes\n"
" mallocd at %s:%d, freed at %s:%d.\n",
m->addr, m->size, m->file, m->line, file, line);
(void *)m->addr, m->size, m->file, m->line, file, line);
if (zmalloclogging > 1) zdump(m);
}
gotit++;
@ -249,11 +249,11 @@ void zfree(unsigned char *what, char *file, int line)
if (!gotit) {
fprintf(zfd,"zfree: ERR: attempt to free unallocated memory 0x%p at %s:%d.\n",
what, file, line);
(void *)what, file, line);
}
if (gotit > 1) {
/* this shouldn't happen, eh? */
fprintf(zfd,"zfree: ERR: Multiply-allocd memory 0x%p.\n", what);
fprintf(zfd,"zfree: ERR: Multiply-allocd memory 0x%p.\n", (void *)what);
}
}
@ -290,7 +290,7 @@ void zmalloc_check()
next_m = m->next;
if (m->addr != 0 && m->frees <= 0) {
fprintf(zfd,"zmalloc: UNfreed memory 0x%p %d bytes mallocd at %s:%d\n",
m->addr, m->size, m->file, m->line);
(void *)m->addr, m->size, m->file, m->line);
if (zmalloclogging > 1) zdump(m);
/* check padding on un-freed memory too: */