Permalink
Browse files

Tidy up header files

* Define a symbol for each, and `#ifdef` around it to prevent multiple
  inclusion.
* Include `config.h` in each header file
  • Loading branch information...
1 parent f886cb4 commit 77b20db2978cf53f3cf9842fef28923e2a622081 @jonm committed Nov 17, 2015
Showing with 137 additions and 6 deletions.
  1. +4 −2 src/area.h
  2. +6 −0 src/comm.h
  3. +5 −1 src/db.h
  4. +7 −0 src/debug.h
  5. +7 −0 src/handler.h
  6. +7 −0 src/hash.h
  7. +7 −0 src/heap.h
  8. +7 −0 src/interpreter.h
  9. +7 −0 src/limits.h
  10. +5 −1 src/memory.h
  11. +7 −0 src/parser.h
  12. +7 −0 src/poly.h
  13. +6 −0 src/protos.h
  14. +7 −0 src/race.h
  15. +6 −1 src/script.h
  16. +7 −0 src/spells.h
  17. +5 −0 src/structs.h
  18. +7 −0 src/temp.h
  19. +6 −0 src/trap.h
  20. +6 −0 src/utils.h
  21. +5 −1 src/vt100c.h
  22. +6 −0 src/wizlist.h
View
@@ -4,8 +4,10 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
-#ifndef _AREA_
-#define _AREA_
+#ifndef _AREA_H
+#define _AREA_H
+
+#include "config.h"
/*
* these defines are to make differentiation easier
View
@@ -3,6 +3,10 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _COMM_H
+#define _COMM_H
+
+#include "config.h"
#define TO_ROOM 0
#define TO_VICT 1
@@ -14,3 +18,5 @@
#define PLAYER_AUTH 0
+
+#endif
View
@@ -1,5 +1,7 @@
+#ifndef _DB_H
+#define _DB_H
-/* data files used by the game system */
+#include "config.h"
#define DFLT_DIR "lib" /* default data directory */
@@ -136,6 +138,8 @@ struct help_index_element
#define ZONE_OLYMPUS 64
#define ZONE_ABYSS 128
#define ZONE_PMP 256 /* Prime Material Plane */
+
#define ZONE_LIMBO 512
+#endif
View
@@ -1,2 +1,9 @@
+#ifndef _DEBUG_H
+#define _DEBUG_H
+
+#include "config.h"
#define __DEBUG
+
+#endif
+
View
@@ -4,10 +4,17 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _HANDLER_H
+#define _HANDLER_H
+
+#include "config.h"
+
#define FIND_CHAR_ROOM 1
#define FIND_CHAR_WORLD 2
#define FIND_OBJ_INV 4
#define FIND_OBJ_ROOM 8
#define FIND_OBJ_WORLD 16
#define FIND_OBJ_EQUIP 32
+#endif
+
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _HASH_H
+#define _HASH_H
+
+#include "config.h"
+
struct hash_link {
int key;
struct hash_link *next;
@@ -20,3 +25,5 @@ struct hash_header {
#define WORLD_SIZE 30000
+
+#endif
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _HEAP_H
+#define _HEAP_H
+
+#include "config.h"
+
struct StrHeapList {
char *string; /* the matching string */
int total; /* total # of occurences */
@@ -13,3 +18,5 @@ struct StrHeap {
int uniq; /* number of uniq items in list */
struct StrHeapList *str; /* the list of strings and totals */
};
+
+#endif
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _INTERPRETER_H
+#define _INTERPRETER_H
+
+#include "config.h"
+
#define MENU \
"\n\rWelcome to SillyMUD\n\r\n\
0) Exit from SillyMud.\n\r\
@@ -51,3 +56,5 @@ administration staff at the University of Florida made an alaias \n\r\
for doldrums to silly, so it is now possible to telnet to \n\r\
silly.cis.ufl.edu . \n\r\
and that, more or less, is the story of Silly Mud.\n\r"
+
+#endif
View
@@ -4,9 +4,16 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _LIMITS_H
+#define _LIMITS_H
+
+#include "config.h"
+
struct title_type
{
char *title_m;
char *title_f;
int exp;
};
+
+#endif
View
@@ -1,8 +1,12 @@
-
+#ifndef _MEMORY_H
+#define _MEMORY_H
+
+#include "config.h"
struct string_entry {
char *string; /* Pointer to the actual data */
int count; /* How many strings are using it */
struct string_entry *next;
};
+#endif
View
@@ -3,6 +3,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+
+#ifndef _PARSER_H
+#define _PARSER_H
+
+#include "config.h"
#define MAGIC 96 /* Magic number for the hash table */
@@ -25,3 +30,5 @@ struct radix_list {
unsigned short int number;
byte max_len;
};
+
+#endif
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _POLY_H
+#define _POLY_H
+
+#include "config.h"
+
/*
** just for polymorph spell(s)
*/
@@ -15,3 +20,5 @@ struct PolyType {
};
#define LAST_DRUID_MOB 16
+
+#endif
View
@@ -1,3 +1,8 @@
+#ifndef _PROTOS_H
+#define _PROTOS_H
+
+#include "config.h"
+
/* Prototypes */
#include "structs.h"
#include "area.h"
@@ -1934,3 +1939,4 @@ int No_Hoard(struct char_data *ch, struct char_data *re,
/* */
/* All Done! (yay!) */
+#endif
View
@@ -1,3 +1,8 @@
+#ifndef _RACE_H
+#define _RACE_H
+
+#include "config.h"
+
/* Race -- Npc, otherwise */
#define RACE_HALFBREED 0
#define RACE_HUMAN 1
@@ -60,3 +65,5 @@
#define RACE_FAERIE 55
#define MAX_RACE 55
+
+#endif
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _SCRIPT_H
+#define _SCRIPT_H
+
+#include "config.h"
+
struct foo_data {
char *line;
};
@@ -19,4 +24,4 @@ struct script_com {
char *arg;
} *comp;
-
+#endif
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _SPELLS_H
+#define _SPELLS_H
+
+#include "config.h"
+
#define MAX_BUF_LENGTH 240
#define TYPE_UNDEFINED -1
@@ -375,3 +380,5 @@ struct attack_hit_type {
char *singular;
char *plural;
};
+
+#endif
View
@@ -3,6 +3,9 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _STRUCTS_H
+#define _STRUCTS_H
+
#include "config.h"
#include <sys/types.h>
@@ -1471,3 +1474,5 @@ struct skill_data {
#define TAUGHT_BY_LORE 256
#define TAUGHT_BY_HUNTER 512
#define TAUGHT_BY_ETTIN 1024 /* beserk */
+
+#endif
View
@@ -1,3 +1,8 @@
+#ifndef _TEMP_H
+#define _TEMP_H
+
+#include "config.h"
+
struct char_file_u_1 {
byte sex;
byte class;
@@ -48,3 +53,5 @@ struct char_file_u_2 {
struct char_file_u_insert {
struct char_skill_data skills[200];
};
+
+#endif
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _TRAP_H
+#define _TRAP_H
+
+#include "config.h"
+
#define TRAP_EFFECT_TYPE 0
#define TRAP_DAM_TYPE 1
#define TRAP_LEVEL 2
@@ -38,3 +43,4 @@
#define GET_TRAP_CHARGES(obj) (obj)->obj_flags.value[TRAP_CHARGES]
#define GET_TRAP_DAM_TYPE(obj) (obj)->obj_flags.value[TRAP_DAM_TYPE]
+#endif
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _UTILS_H
+#define _UTILS_H
+
+#include "config.h"
+
int CAN_SEE(struct char_data *s, struct char_data *o);
#if DEBUG
@@ -293,3 +298,4 @@ int exit_ok(struct room_direction_data *, struct room_data **);
#define SUNPROBLEM(ch) (GET_RACE(ch) == RACE_DROW || GET_RACE(ch) == \
RACE_MFLAYER)
+#endif
View
@@ -15,7 +15,10 @@
* Used with permission for SillyMUD
*/
-
+#ifndef _VT100C_H
+#define _VT100C_H
+
+#include "config.h"
#define UNKNOWN 0
#define VT100 1
@@ -46,3 +49,4 @@
#define INFO_EXP 8
#define INFO_GOLD 16
+#endif
View
@@ -4,6 +4,11 @@
See license.doc for distribution terms. SillyMUD is based on DIKUMUD
*/
+#ifndef _WIZLIST_H
+#define _WIZLIST_H
+
+#include "config.h"
+
struct wiznest {
char *name;
char *title;
@@ -18,3 +23,4 @@ struct wizlistgen {
struct wiznode lookup[11];
};
+#endif

0 comments on commit 77b20db

Please sign in to comment.