Beispiel #1
0
void do_dmuse(struct char_data *ch, char *argument, int cmd)
{
  char buf[MAX_INPUT_LENGTH], mudname[MAX_INPUT_LENGTH];
  struct descriptor_data *d;
  int i;
  
  
  if (IS_SET(ch->specials.act, PLR_NOSHOUT))
    {
      msg("The gods are sick of listen to you!  You've been gagged!", ch);
      return;
    };
  
  if (HUMAN(ch) && IS_SET(ch->pc->comm, COMM_NOMUSE))
    {
      msg("You are not tuned into the muse channel!", ch);
      return;
    };
  
  one_argument(argument, mudname);
  if ((i=matchmud(mudname))!=UNDEFINED)
    {
      argument = one_argument(argument, mudname);
      if ((i=getmud(ch, mudname, TRUE))==UNDEFINED)
	return;
    };
  
  while(isspace(*argument)) argument++;
  if (!*argument)
    {
      msg("Sure you have something to muse!", ch);
      return;
    };
  
  if (!dimd_credit(ch, 1+2*(i==UNDEFINED)))
    return;
  
  if (i!=UNDEFINED)
    {
      if (IS_SET(muds[i].flags, DD_NOMUSE))
	{
	  msg("They are no longer listening to remote muses.", ch);
	  return;
	};
      
      sprintf(buf, "^%s^%s^%d^mg^%s\n\r",
	      PER(ch), GET_KEYNAME(ch), GetMaxLevel(ch), argument);
      write_to_descriptor(muds[i].desc, buf);
    }
  else
    {
      sprintf(buf, "^%s^%s^%d^mg^%s\n\r",
	      PER(ch), GET_KEYNAME(ch), GetMaxLevel(ch), argument);
      for(i=0; muds[i].address; i++)
	if (IS_SET(muds[i].flags, DD_VERIFIED)
	    && !IS_SET(muds[i].flags, DD_NOMUSE))
	  write_to_descriptor(muds[i].desc, buf);
#if USE_COLOR      
      sprintf(buf, "$kW$n $kLdimension muses, '%s'", argument);
#else
      sprintf(buf, "$n dimension muses, '%s'", argument);
#endif
      for(d = descriptor_list; d; d = d->next)
	if (!d->connected && d->character != ch
	    && GetMaxLevel(d->character) >= LOW_IMMORTAL
	    && !IS_SET(d->character->pc->comm, COMM_NOMUSE))
	  cact(buf, FALSE, ch, 0, d->character, TO_VICT, CLR_MUSE);
    };
}
// This method gets called from the scheduler as often
// as possible.  It retrieves keyboard input, or commands
// from the demo data.
int Player::PLAYER()
{
	int tokCnt, tokCtr;
	dodBYTE objstr[10];
	dodBYTE * X, * U;
	int Xup;

	// Update Task's next_time
	scheduler.TCBLND[Scheduler::TID_PLAYER].next_time = scheduler.curTime +
		scheduler.TCBLND[Scheduler::TID_PLAYER].frequency;

	dodBYTE c;
	if (game.AUTFLG == 0)
	{
		// Process Keyboard Buffer
		do
		{
			c = parser.KBDGET();
			if (c == 0)
			{
				return 0;
			}
			if (FAINT != 0)
			{
				while (parser.KBDGET() != 0)
					;	// loop !!!
				return 0;
			}

			// Convert from ASCII to Internal Codes
			if (c >= 'A' && c <= 'Z')
			{
				c &= 0x1F;
			}
			else if (c == parser.C_BS)
			{
				c = parser.I_BS;
			}
			else if (c == parser.C_CR)
			{
				c = parser.I_CR;
			}
			else
			{
				c = parser.I_SP;
			}

			if(!HUMAN(c))
				return -1;
		} while (true);
	}
	else
	{
		// Process Autoplay Commands
		tokCnt = game.DEMO_CMDS[game.DEMOPTR++];
		if (tokCnt == 0)
		{
			game.WAIT();
			game.WAIT();
			game.hasWon = true;
			game.demoRestart = true;
			return 0;
		}

		// Feed next autoplay command to HUMAN
		tokCtr = 1;

		do
		{
			if (tokCtr == 1)
			{
				X = &parser.CMDTAB[game.DEMO_CMDS[game.DEMOPTR]];
			}
			else if (tokCtr == 2)
			{
				X = &parser.DIRTAB[game.DEMO_CMDS[game.DEMOPTR]];
			}
			else
			{
				X = &object.GENTAB[game.DEMO_CMDS[game.DEMOPTR]];
			}
			++game.DEMOPTR;
			U = &objstr[1];
			parser.EXPAND(X, &Xup, U);
			++U;
			game.WAIT();
			do
			{
				HUMAN(*U);
				++U;
			} while (*U != 0xFF);
			HUMAN(parser.I_SP);
			++tokCtr;
		} while (tokCtr <= tokCnt);
		--viewer.UPDATE;
		viewer.draw_game();
		HUMAN(parser.I_CR);
	}

	return 0;
}