Changeset 1167 for 1.8.3/trunk/hdrs/command.h
- Timestamp:
- 12/28/07 19:57:17 (1 year ago)
- Files:
-
- 1.8.3/trunk/hdrs/command.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.8.3/trunk/hdrs/command.h
r919 r1167 2 2 #define __COMMAND_H 3 3 4 #define NUM_BYTES 20 5 typedef unsigned char switch_mask[NUM_BYTES]; 4 5 typedef uint8_t *switch_mask; 6 extern int switch_bytes; 7 #define SW_ALLOC() mush_calloc(switch_bytes, 1, "cmd.switch.vector"); 8 #define SW_FREE(s) mush_free((s), "cmd.switch.vector"); 6 9 #define SW_SET(m,n) (m[(n) >> 3] |= (1 << ((n) & 0x7))) 7 10 #define SW_CLR(m,n) (m[(n) >> 3] &= ~(1 << ((n) & 0x7))) 8 11 #define SW_ISSET(m,n) (m[(n) >> 3] & (1 << ((n) & 0x7))) 9 #define SW_ZERO(m) memset(m, 0, NUM_BYTES) 12 bool SW_BY_NAME(switch_mask, const char *); 13 #define SW_ZERO(m) memset(m, 0, switch_bytes) 14 #define SW_COPY(new,old) memcpy((new), (old), switch_bytes) 10 15 11 16 /* These are type restrictors */ … … 129 134 object_flag_type flagmask; /**< Flags to which the command is restricted */ 130 135 object_flag_type powers; /**< Powers to which the command is restricted */ 131 switch_mask sw; /**< Bitflags of switches this command can take */ 136 /** Switches for this command. */ 137 union { 138 switch_mask mask; /**< Bitflags of switches this command can take */ 139 const char *names; /**< Space-seperated list of switches */ 140 } sw; 132 141 /** Hooks on this command. 133 142 */ … … 189 198 #include "switches.h" 190 199 191 extern switch_mask *switchmask(const char *switches);192 externCOMMAND_INFO *command_find(const char *name);193 externCOMMAND_INFO *command_find_exact(const char *name);194 externCOMMAND_INFO *command_add200 switch_mask switchmask(const char *switches); 201 COMMAND_INFO *command_find(const char *name); 202 COMMAND_INFO *command_find_exact(const char *name); 203 COMMAND_INFO *command_add 195 204 (const char *name, int type, const char *flagstr, const char *powers, 196 205 const char *switchstr, command_func func); 197 externCOMMAND_INFO *make_command206 COMMAND_INFO *make_command 198 207 (const char *name, int type, object_flag_type flagmask, 199 object_flag_type powers, switch_mask*sw, command_func func);200 externCOMMAND_INFO *command_modify(const char *name, int type,201 object_flag_type flagmask,202 object_flag_type powers, switch_mask *sw,203 command_func func);204 externvoid reserve_alias(const char *a);205 externint alias_command(const char *command, const char *alias);206 externvoid command_init_preconfig(void);207 externvoid command_init_postconfig(void);208 externvoid command_splitup208 object_flag_type powers, const char *sw, command_func func); 209 COMMAND_INFO *command_modify(const char *name, int type, 210 object_flag_type flagmask, 211 object_flag_type powers, switch_mask sw, 212 command_func func); 213 void reserve_alias(const char *a); 214 int alias_command(const char *command, const char *alias); 215 void command_init_preconfig(void); 216 void command_init_postconfig(void); 217 void command_splitup 209 218 (dbref player, dbref cause, char *from, char *to, char **args, 210 219 COMMAND_INFO *cmd, int side); 211 externvoid command_argparse220 void command_argparse 212 221 (dbref player, dbref cause, char **from, char *to, char **argv, 213 222 COMMAND_INFO *cmd, int side, int forcenoparse); 214 extern char *command_parse 215 (dbref player, dbref cause, char *string, int fromport); 216 extern void do_list_commands(dbref player, int lc); 217 extern char *list_commands(void); 218 extern int command_check_byname(dbref player, const char *name); 219 extern int restrict_command(const char *name, const char *restriction); 220 extern void reserve_aliases(void); 221 extern void local_commands(void); 222 extern void do_command_add(dbref player, char *name, int flags); 223 extern void do_command_delete(dbref player, char *name); 223 char *command_parse(dbref player, dbref cause, char *string, int fromport); 224 void do_list_commands(dbref player, int lc); 225 char *list_commands(void); 226 int command_check_byname(dbref player, const char *name); 227 int restrict_command(const char *name, const char *restriction); 228 void reserve_aliases(void); 229 void local_commands(void); 230 void do_command_add(dbref player, char *name, int flags); 231 void do_command_delete(dbref player, char *name); 224 232 225 233
