-
Notifications
You must be signed in to change notification settings - Fork 0
/
comm.h
94 lines (74 loc) · 4.46 KB
/
comm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* ************************************************************************
* File: comm.h Part of CircleMUD *
* Usage: header file: prototypes of public communication functions *
* *
* All rights reserved. See license.doc for complete information. *
* *
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
#ifndef COMM_H
#define COMM_H
#define NUM_RESERVED_DESCS 8
#define COPYOVER_FILE "copyover.dat"
/* comm.c */
size_t new_send_to_char ( Character *ch, const char *messg, ... ) __attribute__ ( ( format ( printf, 2, 3 ) ) );
size_t send_to_fusion ( Character *ch, const char *messg, ... ) __attribute__ ( ( format ( printf, 2, 3 ) ) );
void send_to_all ( const char *messg, ... ) __attribute__ ( ( format ( printf, 1, 2 ) ) );
void send_to_mortals ( const char *messg, ... ) __attribute__ ( ( format ( printf, 1, 2 ) ) );
void send_to_arena ( const char *messg, ... ) __attribute__ ( ( format ( printf, 1, 2 ) ) );
void send_to_char ( const char *messg, Character *ch );
void send_to_range ( room_vnum start, room_vnum finish, const char *messg, ... ) __attribute__ ( ( format ( printf, 3, 4 ) ) );
void send_to_room ( room_rnum room, const char *messg, ... ) __attribute__ ( ( format ( printf, 2, 3 ) ) );
void send_to_outdoor ( const char *messg, ... ) __attribute__ ( ( format ( printf, 1, 2 ) ) );
void perform_to_all ( const char *messg, Character *ch );
int is_ignoring ( Character *ch, Character *vict );
void perform_act ( string &orig, Character *ch,
struct obj_data *obj, const void *vict_obj, const Character *to );
void perform_act ( const char *orig, Character *ch,
struct obj_data *obj, const void *vict_obj,
const Character *to );
void act ( const char *str, int hide_invisible, Character *ch, struct obj_data *obj, const void *vict_obj, int type );
void act ( string &str, int hide_invisible, Character *ch,
struct obj_data *obj, const void *vict_obj, int type );
void brag ( Character *ch, Character *victim );
extern struct comm_data * comlist;
void free_commlist ( struct comm_data *c );
void send_out_signals ( Descriptor *d );
#define ALERT_1 send_to_all("{cRALERT: 4Dimensions has had an internal error and is shutting down now.\r\n" \
"Please Reconnect in 20 seconds.\r\n{c0");
#define ALERT_2 send_to_all("{cRALERT: 4Dimensions has encountered some instability." \
"\r\nCrash may follow.\r\n{c0");
#define CHECK_NULL(pointer, expression) \
if ((pointer) == NULL) i = ACTNULL; else i = (expression);
#define TO_ROOM 1
#define TO_VICT 2
#define TO_NOTVICT 3
#define TO_CHAR 4
#define TO_SLEEP 128 /* to char, even if sleeping */
#define DG_NO_TRIG 256 /* don't check act trigger */
/* I/O functions */
int write_to_descriptor ( socket_t desc, const char *txt, struct compr *comp );
void write_to_q ( const char *txt, struct txt_q *queue, int aliased );
size_t write_to_output ( Descriptor *d, const char *txt, ... ) __attribute__ ( ( format ( printf, 2, 3 ) ) );
size_t vwrite_to_output ( Descriptor *d, const char *format, va_list args );
void paginate_string ( const char *str, Descriptor *d ); //mord??
void page_string ( Descriptor *d, char *str, int keep_internal );
void page_string ( Descriptor *d, std::stringstream &str);
void string_add ( Descriptor *d, char *str );
void string_write ( Descriptor *d, char **txt, size_t len, long mailto, void *data );
void string_write ( Descriptor *d, string *writeto, size_t len, long mailto, void *data );
int toggle_compression ( Descriptor *t );
void mccp_off(Descriptor *d);
#define SEND_TO_SOCKET(messg, desc) write_to_descriptor((desc), (messg), strlen(messg))
/* values for keep_internal...
FALSE Buffer is read only and will not be modifed so it does not
need to be copied.
TRUE Buffer is re-usable and needs to be copied before use. */
#define DYN_BUFFER 2 /* Buffer is dynamically allocated and does not need to be */
/* copied, but does need to be freed. */
#define SEND_TO_Q(messg, desc) write_to_output(desc,"%s", (messg))
#define USING_SMALL(d) ((d)->output == (d)->small_outbuf)
#define USING_LARGE(d) ((d)->output == (d)->large_outbuf)
typedef RETSIGTYPE sigfunc ( int );
#endif