6
|
1 /*--------------------------------------------------------------------------
|
|
2 NETREK II -- Paradise
|
|
3
|
|
4 Permission to use, copy, modify, and distribute this software and its
|
|
5 documentation, or any derivative works thereof, for any NON-COMMERCIAL
|
|
6 purpose and without fee is hereby granted, provided that this copyright
|
|
7 notice appear in all copies. No representations are made about the
|
|
8 suitability of this software for any purpose. This software is provided
|
|
9 "as is" without express or implied warranty.
|
|
10
|
|
11 Xtrek Copyright 1986 Chris Guthrie
|
|
12 Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
|
|
13 Scott Silvey
|
|
14 Paradise II (Netrek II) Copyright 1993 Larry Denys
|
|
15 Kurt Olsen
|
|
16 Brandon Gillespie
|
|
17 --------------------------------------------------------------------------*/
|
|
18
|
|
19 #include "config.h"
|
|
20
|
|
21 #include <stdio.h>
|
|
22 #include <math.h>
|
|
23 #include <signal.h>
|
|
24 #include <ctype.h>
|
|
25 #include "defs.h"
|
|
26 #include "struct.h"
|
|
27 #include "data.h"
|
|
28 #include "shmem.h"
|
|
29
|
|
30 /* int parse_control_mess(); */
|
|
31
|
|
32
|
|
33 /*-----------------------------VISIBLE FUNCTIONS--------------------------*/
|
|
34
|
|
35 /*---------------------------------PMESSAGE-------------------------------*/
|
|
36 /*
|
|
37 * This function sends a message. It marks a message as being sent from God.
|
|
38 */
|
|
39
|
|
40
|
|
41 void pmessage2();
|
|
42
|
|
43 void
|
|
44 pmessage(str, recip, group, address)
|
|
45 char *str; /* the message */
|
|
46 int recip; /* who will receive it */
|
|
47 int group; /* the group (type of recipient) */
|
|
48 char *address; /* attached to front of message */
|
|
49 {
|
|
50 pmessage2(str, recip, group, address, 255);
|
|
51 }
|
|
52
|
|
53
|
|
54
|
|
55
|
|
56 /*--------------------------------PMESSAGE2--------------------------------*/
|
|
57 /*
|
|
58 * This function sends a message. It places the message in the array of
|
|
59 * messages.
|
|
60 */
|
|
61
|
|
62 void
|
|
63 pmessage2(str, recip, group, address, from)
|
|
64 char *str; /* the message */
|
|
65 int recip; /* who will receive it */
|
|
66 int group; /* the group (type of recipient) */
|
|
67 char *address; /* attached to front of message */
|
|
68 unsigned char from; /* who the message is from */
|
|
69 {
|
|
70 struct message *cur; /* to point to where to put message */
|
|
71 int mesgnum; /* to hold index number in message array */
|
|
72
|
|
73 if ((mesgnum = ++(mctl->mc_current)) >= MAXMESSAGE)
|
|
74 {
|
|
75 mctl->mc_current = 0; /* get index of where to put the message */
|
|
76 mesgnum = 0; /* roll it index number over if need be */
|
|
77 }
|
|
78 cur = &messages[mesgnum]; /* get address of message structure in array */
|
|
79 cur->m_no = mesgnum; /* set the message number */
|
|
80 cur->m_flags = group; /* set group or type of recipient */
|
|
81 cur->m_recpt = recip; /* set the recipient */
|
|
82 cur->m_from = from; /* set who it was from */
|
|
83 (void) sprintf(cur->m_data, "%-9s ", address);
|
|
84 strncat(cur->m_data, str, sizeof(cur->m_data) - strlen(cur->m_data));
|
|
85 cur->m_flags |= MVALID; /* set messages status as valid */
|
|
86 }
|
|
87
|
|
88 /*-------------------------------------------------------------------------*/
|
|
89
|
|
90
|
|
91
|
|
92 /*----------------------------INVISIBLE FUNCTIONS-------------------------*/
|
|
93
|
|
94
|
|
95 /*-------END OF FILE--------*/
|