home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume12 / mdg / part05 / speak.c < prev   
C/C++ Source or Header  |  1991-03-04  |  1KB  |  71 lines

  1. /*
  2.     MDG Multiuser Dungeon Game -- speak.c message handler
  3.     
  4.     MDG is Copyright 1990 John C. Gonnerman
  5.     This program is subject to the general MDG 
  6.     copyright statement (see enclosed file, Copyright).
  7. */
  8.  
  9.  
  10. static char *sccsvers = "@(#) speak.c\t(1.1)\tcreated 12/25/90";
  11.  
  12. #include <string.h>
  13.  
  14. #include "setup.h"
  15. #include "struct.h"
  16. #include "spells.h"
  17.  
  18. extern struct player_seg *pseg;
  19. extern struct map_seg *mseg;
  20.  
  21.  
  22. speak(indx, text)
  23. int indx;
  24. char *text;
  25. {
  26.     int i, all;
  27.     char buf[35];
  28.  
  29.     all = 0;
  30.  
  31.     if(text[0] == '\0')
  32.         return;
  33.  
  34.     if(text[0] == '!') {
  35.         all = 1;
  36.         text++;
  37.     }
  38.  
  39.     for(i = 0; i < MAX_PLAYERS; i++)
  40.         if(all || pseg->p[i].loc.sector == pseg->p[indx].loc.sector) {
  41.             sprintf(buf, "%c> ", (char)(indx + '1'));
  42.             strcat(buf, text);
  43.             dmsg_add(i, buf);
  44.         }
  45. }
  46.  
  47.  
  48. whisper(indx, to_indx, text)
  49. int indx, to_indx;
  50. char *text;
  51. {
  52.     int i;
  53.     char buf[35];
  54.  
  55.     if(text[0] == '\0')
  56.         return;
  57.  
  58.     if(to_indx < 0 || to_indx >= MAX_PLAYERS)
  59.         return;
  60.  
  61.     if(pseg->p[to_indx].loc.sector >= 0
  62.     && pseg->p[to_indx].playernum >= 0) {
  63.         sprintf(buf, "%c} ", (char)(indx + '1'));
  64.         strcat(buf, text);
  65.         dmsg_add(to_indx, buf);
  66.     }
  67. }
  68.  
  69.  
  70. /* end of file. */
  71.