diff src/smessage.c @ 6:8c6d5731234d

First entry of Paradise Server 2.9 patch 10 Beta
author darius
date Sat, 06 Dec 1997 04:37:04 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/smessage.c	Sat Dec 06 04:37:04 1997 +0000
@@ -0,0 +1,95 @@
+/*--------------------------------------------------------------------------
+NETREK II -- Paradise
+
+Permission to use, copy, modify, and distribute this software and its
+documentation, or any derivative works thereof, for any NON-COMMERCIAL
+purpose and without fee is hereby granted, provided that this copyright
+notice appear in all copies.  No representations are made about the
+suitability of this software for any purpose.  This software is provided
+"as is" without express or implied warranty.
+
+    Xtrek Copyright 1986                            Chris Guthrie
+    Netrek (Xtrek II) Copyright 1989                Kevin P. Smith
+                                                    Scott Silvey
+    Paradise II (Netrek II) Copyright 1993          Larry Denys
+                                                    Kurt Olsen
+                                                    Brandon Gillespie
+--------------------------------------------------------------------------*/
+
+#include "config.h"
+
+#include <stdio.h>
+#include <math.h>
+#include <signal.h>
+#include <ctype.h>
+#include "defs.h"
+#include "struct.h"
+#include "data.h"
+#include "shmem.h"
+
+/* int parse_control_mess(); */
+
+
+/*-----------------------------VISIBLE FUNCTIONS--------------------------*/
+
+/*---------------------------------PMESSAGE-------------------------------*/
+/*
+ * This function sends a message.  It marks a message as being sent from God.
+ */
+
+
+void pmessage2();
+
+void
+pmessage(str, recip, group, address)
+  char *str;			/* the message */
+  int recip;			/* who will receive it */
+  int group;			/* the group (type of recipient) */
+  char *address;		/* attached to front of message */
+{
+  pmessage2(str, recip, group, address, 255);
+}
+
+
+
+
+/*--------------------------------PMESSAGE2--------------------------------*/
+/*
+ * This function sends a message.  It places the message in the array of
+ * messages.
+ */
+
+void
+pmessage2(str, recip, group, address, from)
+  char *str;			/* the message */
+  int recip;			/* who will receive it */
+  int group;			/* the group (type of recipient) */
+  char *address;		/* attached to front of message */
+  unsigned char from;		/* who the message is from */
+{
+  struct message *cur;		/* to point to where to put message */
+  int mesgnum;			/* to hold index number in message array */
+
+  if ((mesgnum = ++(mctl->mc_current)) >= MAXMESSAGE)
+  {
+    mctl->mc_current = 0;	/* get index of where to put the message */
+    mesgnum = 0;		/* roll it index number over if need be */
+  }
+  cur = &messages[mesgnum];	/* get address of message structure in array */
+  cur->m_no = mesgnum;		/* set the message number */
+  cur->m_flags = group;		/* set group or type of recipient */
+  cur->m_recpt = recip;		/* set the recipient */
+  cur->m_from = from;		/* set who it was from */
+  (void) sprintf(cur->m_data, "%-9s ", address);
+  strncat(cur->m_data, str, sizeof(cur->m_data) - strlen(cur->m_data));
+  cur->m_flags |= MVALID;	/* set messages status as valid */
+}
+
+/*-------------------------------------------------------------------------*/
+
+
+
+/*----------------------------INVISIBLE FUNCTIONS-------------------------*/
+
+
+/*-------END OF FILE--------*/