当前位置: 首页>>代码示例>>C++>>正文


C++ GET_POS函数代码示例

本文整理汇总了C++中GET_POS函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_POS函数的具体用法?C++ GET_POS怎么用?C++ GET_POS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GET_POS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MakeSound

void MakeSound(int pulse)
{
  struct char_data *ch;

/*  objects */
  
  ForAllObjects(NULL,pulse,ObjNoise);

/* mobiles */

  for (ch = character_list; ch; ch = ch->next) {
    if (IS_NPC(ch) && (ch->player.sounds) && (number(0,5)==0)) {
      if (ch->specials.default_pos > POSITION_SLEEPING) {
	if (GET_POS(ch) > POSITION_SLEEPING) {
	  /*  Make the sound; */
	  MakeNoise(ch->in_room, ch->player.sounds, ch->player.distant_snds);
	} else if (GET_POS(ch) == POSITION_SLEEPING) {
	  char buf[MAX_STRING_LENGTH];
	  /* snore */	 
	  sprintf(buf, "%s snores loudly.\n", ch->player.short_descr);
	  MakeNoise(ch->in_room, buf, "You hear a loud snore nearby.\n");
	}
      } else if (GET_POS(ch) == ch->specials.default_pos) {
	/* Make the sound */       
	MakeNoise(ch->in_room, ch->player.sounds, ch->player.distant_snds);
      }
    }
  }
}
开发者ID:prealms1993,项目名称:PerilousRealms1993,代码行数:29,代码来源:sound.c

示例2: cast_spell

int
cast_spell (struct char_data *ch, struct char_data *tch,
			struct obj_data *tobj, int spellnum)
{
	if (spellnum < 0 || spellnum > TOP_SPELL_DEFINE)
	{
		log ("SYSERR: cast_spell trying to call spellnum %d/%d.\n", spellnum,
			 TOP_SPELL_DEFINE);
		return (0);
	}

	if (GET_POS (ch) < SINFO.min_position)
	{
		switch (GET_POS (ch))
		{
		case POS_SLEEPING:
			send_to_char ("You dream about great magical powers.\r\n", ch);
			break;
		case POS_RESTING:
			send_to_char ("You cannot concentrate while resting.\r\n", ch);
			break;
		case POS_SITTING:
			send_to_char ("You can't do this sitting!\r\n", ch);
			break;
		case POS_FIGHTING:
			send_to_char ("Impossible!  You can't concentrate enough!\r\n",
						  ch);
			break;
		default:
			send_to_char ("You can't do much of anything like this!\r\n", ch);
			break;
		}
		return (0);
	}
	if (AFF_FLAGGED (ch, AFF_CHARM) && (ch->master == tch))
	{
		send_to_char ("You are afraid you might hurt your master!\r\n", ch);
		return (0);
	}
	if ((tch != ch) && IS_SET (SINFO.targets, TAR_SELF_ONLY))
	{
		send_to_char ("You can only cast this spell upon yourself!\r\n", ch);
		return (0);
	}
	if ((tch == ch) && IS_SET (SINFO.targets, TAR_NOT_SELF))
	{
		send_to_char ("You cannot cast this spell upon yourself!\r\n", ch);
		return (0);
	}
	if (IS_SET (SINFO.routines, MAG_GROUPS) && !AFF_FLAGGED (ch, AFF_GROUP))
	{
		send_to_char
			("You can't cast this spell if you're not in a group!\r\n", ch);
		return (0);
	}
	send_to_char (OK, ch);
	say_spell (ch, spellnum, tch, tobj);

	return (call_magic (ch, tch, tobj, spellnum, GET_LEVEL (ch), CAST_SPELL));
}
开发者ID:adept2tech,项目名称:Mclandia,代码行数:60,代码来源:spell_parser.c

示例3: pulse_heal

/* nb, also mess up anyone affected by AFF_POISON */
void pulse_heal(void)
{
    CharData *ch;
    int gain = number(18,24);

    for (ch = character_list; ch; ch = ch->next) {
        if(ch->in_room == NOWHERE)
            continue;

        if(!(pvpFactor() > 1)) {
            if( GET_POS(ch) == POS_INCAP )      damage(ch, ch, 1, TYPE_SUFFERING);
            else if( GET_POS(ch) == POS_MORTALLYW )  damage(ch, ch, 2, TYPE_SUFFERING);
            else if( GET_POS(ch) == POS_DEAD) {
                if(IN_ARENA(ch) || IN_QUEST_FIELD(ch) ||
                   ZONE_FLAGGED(world[ch->in_room].zone, ZONE_ARENA) ||
                   ZONE_FLAGGED(world[ch->in_room].zone, ZONE_SLEEPTAG))
                    // If they're dying in the arena, they eventually get better (or killed by someone)
                {
                    GET_HIT(ch) = number(GET_HIT(ch), 1);
                    sendChar(ch, "You slowly recover.\r\n");
                    update_pos(ch);
                }
                else {
                    raw_kill(ch, NULL);
                    continue;
                }
            }
        }

        if (IS_AFFECTED(ch, AFF_PULSE_HIT))
            if (GET_HIT(ch) < GET_MAX_HIT(ch)) GET_HIT(ch) += gain;
        if (IS_AFFECTED(ch, AFF_PULSE_MANA))
            if (GET_MANA(ch) < GET_MAX_MANA(ch)) GET_MANA(ch) += gain;
        if (IS_AFFECTED(ch, AFF_POISON)) doPoison(ch);
        if (IS_AFFECTED(ch, AFF_DISEASE)) doDisease(ch);
	if (affected_by_spell(ch, SKILL_INVIGORATE)) doInvigorate(ch);
        if (IS_BOUNTY_HUNTER(ch) && GET_ADVANCE_LEVEL(ch) >= 1 && IS_AFFECTED(ch, AFF_HIDE)) GET_MOVE(ch) = MIN(GET_MOVE(ch) + 3*gain, GET_MAX_MOVE(ch));
        if (IS_PRESTIDIGITATOR(ch)) GET_MANA(ch) = MIN(GET_MANA(ch) + GET_ADVANCE_LEVEL(ch) * 2, GET_MAX_MANA(ch));
        if (affected_by_spell(ch, SPELL_HIPPOCRATIC_OATH)) GET_MANA(ch) = MIN(GET_MANA(ch) + 25, GET_MAX_MANA(ch));
        if (affected_by_spell(ch, SKILL_PET_MEND)) GET_HIT(ch) = MIN(GET_HIT(ch) * 115 / 100, GET_MAX_HIT(ch));
        if (IS_HOLY_PRIEST(ch)) GET_MANA(ch) = MIN(GET_MANA(ch) + 10 + 2*GET_ADVANCE_LEVEL(ch), GET_MAX_MANA(ch));

        /* The room might be poisoned! (Or later, otherwise dangerous) */
        if (ch->in_room != NOWHERE) {
            if (ROOM_FLAGGED(ch->in_room, ROOM_POISONED)) {
                if (!mag_savingthrow(ch, SAVING_SPELL)) {
                    act("$n chokes and gags!", TRUE, ch, 0, 0, TO_ROOM);
                    act("You choke and gag!", TRUE, ch, 0, 0, TO_CHAR);
                    add_affect( ch, ch, SPELL_POISON, 30, APPLY_NONE, 0, 5 TICKS,
                            AFF_POISON, FALSE, FALSE, FALSE, FALSE);
                }
            }
        }

        if(IS_DEFENDER(ch) && !affected_by_spell(ch, SKILL_DEFENDER_HEALTH))
            add_affect(ch, ch, SKILL_DEFENDER_HEALTH, GET_LEVEL(ch), APPLY_HIT, GET_ADVANCE_LEVEL(ch)*5, -1, FALSE, FALSE, FALSE, FALSE, FALSE);

    }
}
开发者ID:Lundessa,项目名称:NewRavenVM,代码行数:60,代码来源:mudlimits.c

示例4: dismount_char

/* dismount_char() / fr: Daniel Koepke ([email protected])
 *   If a character is mounted on something, we dismount them.  If
 *   someone is mounting our character, then we dismount that someone.
 *   This is used for cleaning up after a mount is cancelled by
 *   something (either intentionally or by death, etc.)
 */
void dismount_char(struct char_data *ch) 
{
  if (RIDING(ch)) {
    RIDDEN_BY(RIDING(ch)) = NULL;
    RIDING(ch) = NULL;
    GET_POS(ch) = POS_STANDING;

  }
  
  if (RIDDEN_BY(ch)) {
    RIDING(RIDDEN_BY(ch)) = NULL;
    RIDDEN_BY(ch) = NULL;
    GET_POS(ch) = POS_STANDING;
  }
}
开发者ID:Calebros,项目名称:aol,代码行数:21,代码来源:handler.c

示例5: castle_twin_proc

/* Common routine for the Castle Twins. */
int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname)
{
  struct char_data *king, *twin;

  if (!AWAKE(ch))
    return (FALSE);

  if (cmd)
    return block_way(ch, cmd, arg, castle_virtual(ctlnum), 1);

  if ((king = find_npc_by_name(ch, "King Welmar", 11)) != NULL) {
    char actbuf[MAX_INPUT_LENGTH];

    if (!ch->master)
      do_follow(ch, strcpy(actbuf, "King Welmar"), 0, 0);	/* strcpy: OK */
    if (FIGHTING(king))
      do_npc_rescue(ch, king);
  }

  if ((twin = find_npc_by_name(ch, twinname, strlen(twinname))) != NULL)
    if (FIGHTING(twin) && 2 * GET_HIT(twin) < GET_HIT(ch))
      do_npc_rescue(ch, twin);

  if (GET_POS(ch) != POS_FIGHTING)
    banzaii(ch);

  return (FALSE);
}
开发者ID:ryantm,项目名称:deimos-mud,代码行数:29,代码来源:castle.c

示例6: dream

void dream (CHAR_DATA *ch)
{
    DREAM_DATA		*dream;
    DREAM_DATA		*dreamed;

    if ( !ch->pc || !ch->pc->dreams )
        return;

    if ( GET_POS (ch) != POSITION_SLEEPING )
        return;

    dream = ch->pc->dreams;

    ch->pc->dreams = dream->next;
    dream->next = NULL;

    if ( !ch->pc->dreamed )
        ch->pc->dreamed = dream;
    else {
        for ( dreamed = ch->pc->dreamed; dreamed->next; )
            dreamed = dreamed->next;

        dreamed->next = dream;
    }

    send_to_char ("While asleep, you have a dream.\n\n\r", ch);

    page_string (ch->desc, dream->dream);

    save_char (ch, TRUE);
}
开发者ID:stefanludlow,项目名称:Argila,代码行数:31,代码来源:magic.c

示例7: cityguard

int cityguard(struct char_data *ch, int cmd, char *arg)
{
	struct char_data *tch, *evil;
	int max_evil;

	if (cmd || !AWAKE(ch) || (GET_POS(ch) == POSITION_FIGHTING))
		return (FALSE);

	max_evil = 300;
	evil = 0;

	for (tch=world[ch->in_room].people; tch; tch = tch->next_in_room) {
		if (tch->specials.fighting) {
         if ((GET_ALIGNMENT(tch) < max_evil) &&
             (IS_NPC(tch) || IS_NPC(tch->specials.fighting))) {
				max_evil = GET_ALIGNMENT(tch);
				evil = tch;
			}
		}
	}

	if (evil && !IS_EVIL(evil->specials.fighting))
	{
		act("$n screams 'PROTECT THE INNOCENT!  BANZAI!!! CHARGE!!! ARARARAGGGHH!'", FALSE, ch, 0, 0, TO_ROOM);
		hit(ch, evil, TYPE_UNDEFINED);
		return(TRUE);
	}

	return(FALSE);
}
开发者ID:MUDOmnibus,项目名称:DikuMUD-Alfa,代码行数:30,代码来源:spec_procs.c

示例8: stop_fighting

/* remove a char from the list of fighting chars */
void stop_fighting(struct char_data *ch)
{
	struct char_data *tmp;

	assert(ch->specials.fighting);

	if (ch == combat_next_dude)
		combat_next_dude = ch->next_fighting;

	if (combat_list == ch)
	   combat_list = ch->next_fighting;
	else
	{
		for (tmp = combat_list; tmp && (tmp->next_fighting != ch); 
			tmp = tmp->next_fighting);
		if (!tmp) {
			log("Char fighting not found Error (fight.c, stop_fighting)");
			abort();
		}
		tmp->next_fighting = ch->next_fighting;
	}

	ch->next_fighting = 0;
	ch->specials.fighting = 0;
	GET_POS(ch) = POSITION_STANDING;
	update_pos(ch);
}
开发者ID:MUDOmnibus,项目名称:DikuMUD-Alfa,代码行数:28,代码来源:fight.c

示例9: InformMess

void InformMess( struct char_data *v)
{
if(DEBUG) dlog("InformMess");
  switch (GET_POS(v)) {
    case POSITION_MORTALLYW:
       	act("$n is mortally wounded, and will die soon, if not aided.", 
	    TRUE, v, 0, 0, TO_ROOM);
       	act("You are mortally wounded, and will die soon, if not aided.", 
	    FALSE, v, 0, 0, TO_CHAR);
	break;
     case POSITION_INCAP:
       	act("$n is incapacitated and will slowly die, if not aided.", 
	    TRUE, v, 0, 0, TO_ROOM);
	act("You are incapacitated and you will slowly die, if not aided.", 
	    FALSE, v, 0, 0, TO_CHAR);
	break;
     case POSITION_STUNNED:
       	act("$n is stunned, but will probably regain consciousness.", 
	    TRUE, v, 0, 0, TO_ROOM);
	act("You're stunned, but you will probably regain consciousness.", 
	    FALSE, v, 0, 0, TO_CHAR);
	break;
      case POSITION_DEAD:
       	act("$n is dead! R.I.P.", TRUE, v, 0, 0, TO_ROOM);
       	act("You are dead!  Sorry...", FALSE, v, 0, 0, TO_CHAR);
       	break;
      default:  /* >= POSITION SLEEPING */
       	break;
      }
}
开发者ID:Lundex,项目名称:wileymud,代码行数:30,代码来源:Trap.c

示例10: do_tell

void do_tell (struct char_data *ch, char *argument, int cmd)
{
  struct char_data *vict;
  char name[100], message[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];

  if (IS_SET (ch->specials.act, PLR_NOTELL)) {
    send_to_char ("Your message didn't get through!!\n\r", ch);
    return;
  }

  half_chop (argument, name, message);

  if (!*name || !*message)
    send_to_char ("Who do you wish to tell what??\n\r", ch);
  else if (!(vict = get_char_vis (ch, name)))
    send_to_char ("No-one by that name here..\n\r", ch);
  else if (ch == vict)
    send_to_char ("You try to tell yourself something.\n\r", ch);
  else if ((GET_POS (vict) == POSITION_SLEEPING) ||
    IS_SET (vict->specials.act, PLR_NOTELL)) {
    act ("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR);
  } else {
    sprintf (buf, "%s tells you '%s'\n\r",
      (IS_NPC (ch) ? ch->player.short_descr : GET_NAME (ch)), message);
    send_to_char (buf, vict);
    send_to_char ("Ok.\n\r", ch);
  }
}
开发者ID:Goldbishop,项目名称:MUD_Source,代码行数:28,代码来源:act.comm.c

示例11: perform_move

int perform_move(struct char_data *ch, int dir, int need_specials_check)
{
  room_rnum was_in;
  struct follow_type *k, *next;

  if (ch == NULL || dir < 0 || dir >= NUM_OF_DIRS || FIGHTING(ch))
    return (0);
  else if ((!EXIT(ch, dir) && !buildwalk(ch, dir)) || EXIT(ch, dir)->to_room == NOWHERE)
    send_to_char(ch, "Alas, you cannot go that way...\r\n");
  else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED)) {
    if (EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s seems to be closed.\r\n", fname(EXIT(ch, dir)->keyword));
    else
      send_to_char(ch, "It seems to be closed.\r\n");
  } else {
    if (!ch->followers)
      return (do_simple_move(ch, dir, need_specials_check));

    was_in = IN_ROOM(ch);
    if (!do_simple_move(ch, dir, need_specials_check))
      return (0);

    for (k = ch->followers; k; k = next) {
      next = k->next;
      if ((IN_ROOM(k->follower) == was_in) &&
	  (GET_POS(k->follower) >= POS_STANDING)) {
	act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR);
	perform_move(k->follower, dir, 1);
      }
    }
    return (1);
  }
  return (0);
}
开发者ID:ryantm,项目名称:deimos-mud,代码行数:34,代码来源:act.movement.c

示例12: rs_mbrd

t_stat rs_mbrd (int32 *data, int32 ofs, int32 drv)
{
uint32 val, dtype, i;
UNIT *uptr;

rs_update_ds (0, drv);                                  /* update ds */
uptr = rs_dev.units + drv;                              /* get unit */
if (uptr->flags & UNIT_DIS) {                           /* nx disk */
    *data = 0;
    return MBE_NXD;
    }
dtype = GET_DTYPE (uptr->flags);                        /* get drive type */
ofs = ofs & MBA_RMASK;                                  /* mask offset */

switch (ofs) {                                          /* decode offset */

    case RS_CS1_OF:                                     /* RSCS1 */
        val = (rscs1[drv] & CS1_RW) | CS1_DVA;          /* DVA always set */
        break;

    case RS_DA_OF:                                      /* RSDA */
        val = rsda[drv];
        break;

    case RS_DS_OF:                                      /* RSDS */
        val = rsds[drv] & ~DS_MBZ;
        break;

    case RS_ER_OF:                                      /* RSER */
        val = rser[drv] & ~ER_MBZ;
        break;

    case RS_AS_OF:                                      /* RSAS */
        val = 0;
        for (i = 0; i < RS_NUMDR; i++) {
            if (rsds[i] & DS_ATA)
                val |= (AS_U0 << i);
            }
        break;

    case RS_LA_OF:                                      /* RSLA */
        val = GET_POS (rs_wait);
        break;

    case RS_MR_OF:                                      /* RSMR */
        val = rsmr[drv];
        break;

    case RS_DT_OF:                                      /* RSDT */
        val = dtype? RS04_ID: RS03_ID;
        break;

   default:                                             /* all others */
        *data = 0;
        return MBE_NXR;
        }

*data = val;
return SCPE_OK;
}
开发者ID:markpizz,项目名称:markpizz.github.io,代码行数:60,代码来源:pdp11_rs.c

示例13: VermeDellaMorte

/*****************************************************************************
  Chiunque veda il Verme della Morte, viene addormentato dal suo sguardo
  ipnotico, a meno con non azzecchi un tiro salvezza contro paralisi.
*****************************************************************************/
int VermeDellaMorte( struct char_data *pChar, int nCmd, const char *szArg, 
                     struct char_data *pMob, int nType )
{
  if( nType == EVENT_TICK && AWAKE( pMob ) )
  {
    struct room_data *pRoom;
    
    if( ( pRoom = real_roomp( pMob->in_room ) ) != NULL )
    {
      struct char_data *pNext, *pTar;
      for( pTar = pRoom->people; pTar; pTar = pNext )
      {
        pNext = pTar->next_in_room;
        if( CAN_SEE( pTar, pMob ) && 
            ( ( IS_PC( pTar ) && 
                !IS_SET( pTar->specials.act, PLR_NOHASSLE ) ) ||
              ( IS_NPC( pTar ) && 
                ( ( pTar->specials.zone != pMob->specials.zone &&
                    !strchr( zone_table[ pTar->specials.zone ].races, 
                             GET_RACE( pTar ) ) ) ||
                  IS_SET( pTar->specials.act, ACT_ANNOYING ) ) ) ) && 
            GET_POS( pTar ) > POSITION_SLEEPING &&
            !IsImmune( pTar, IMM_SLEEP ) )
        {
          if( IsSusc( pTar, IMM_SLEEP ) || 
              ( !saves_spell( pTar, SAVING_PARA ) && 
                ( !IsResist( pTar, IMM_SLEEP ) || 
                  !saves_spell( pTar, SAVING_PARA ) ) ) )
          {
            act( "$N ti guarda fisso. La tua vista si sdoppia.", FALSE,
                 pTar, 0, pMob, TO_CHAR );
            act( "$n cade a terra addormentat$b.", TRUE, pTar, 0, 0, 
                 TO_ROOM );
            if( pTar->specials.fighting )
              stop_fighting( pTar );
            GET_POS( pTar ) = POSITION_SLEEPING;
          }
        }
      }
    }
    else
      mudlog( LOG_SYSERR, 
              "pMob in invalid room in VermeDellaMorte( carceri.c )" );
  }
  return FALSE;
}
开发者ID:frasten,项目名称:openleu,代码行数:50,代码来源:carceri.c

示例14: skill_message

/*
 * message for doing damage with a spell or skill
 *  C3.0: Also used for weapon damage on miss and death blows
 */
int skill_message(int dam, struct char_data * ch, struct char_data * vict,
		      int attacktype)
{
  int i, j, nr;
  struct message_type *msg;

  struct obj_data *weap = GET_EQ(ch, WEAR_WIELD);

  for (i = 0; i < MAX_MESSAGES; i++) {
    if (fight_messages[i].a_type == attacktype) {
      nr = dice(1, fight_messages[i].number_of_attacks);
      for (j = 1, msg = fight_messages[i].msg; (j < nr) && msg; j++)
	msg = msg->next;

      if (!IS_NPC(vict) && (GET_LEVEL(vict) >= LVL_IMMORT)) {
	act(msg->god_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
	act(msg->god_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT);
	act(msg->god_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
      } else if (dam != 0) {
	if (GET_POS(vict) == POS_DEAD) {
	  send_to_char(CCYEL(ch, C_CMP), ch);
	  act(msg->die_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
	  send_to_char(CCNRM(ch, C_CMP), ch);

	  send_to_char(CCRED(vict, C_CMP), vict);
	  act(msg->die_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
	  send_to_char(CCNRM(vict, C_CMP), vict);

	  act(msg->die_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
	} else {
	  send_to_char(CCYEL(ch, C_CMP), ch);
	  act(msg->hit_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
	  send_to_char(CCNRM(ch, C_CMP), ch);

	  send_to_char(CCRED(vict, C_CMP), vict);
	  act(msg->hit_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
	  send_to_char(CCNRM(vict, C_CMP), vict);

	  act(msg->hit_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
	}
      } else if (ch != vict) {	/* Dam == 0 */
	send_to_char(CCYEL(ch, C_CMP), ch);
	act(msg->miss_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
	send_to_char(CCNRM(ch, C_CMP), ch);

	send_to_char(CCRED(vict, C_CMP), vict);
	act(msg->miss_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
	send_to_char(CCNRM(vict, C_CMP), vict);

	act(msg->miss_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
      }
      return (1);
    }
  }
  return (0);
}
开发者ID:matthewbode,项目名称:mg2,代码行数:60,代码来源:fight.c

示例15: rs_go

t_stat rs_go (int32 drv)
{
int32 fnc, dtype, t;
UNIT *uptr;

fnc = GET_FNC (rscs1[drv]);                             /* get function */
if (DEBUG_PRS (rs_dev))
    fprintf (sim_deb, ">>RS%d STRT: fnc=%s, ds=%o, da=%o, er=%o\n",
             drv, rs_fname[fnc], rsds[drv], rsda[drv], rser[drv]);
uptr = rs_dev.units + drv;                              /* get unit */
rs_clr_as (AS_U0 << drv);                               /* clear attention */
dtype = GET_DTYPE (uptr->flags);                        /* get drive type */
if ((fnc != FNC_DCLR) && (rsds[drv] & DS_ERR)) {        /* err & ~clear? */
    rs_set_er (ER_ILF, drv);                            /* not allowed */
    rs_update_ds (DS_ATA, drv);                         /* set attention */
    return MBE_GOE;
    }

switch (fnc) {                                          /* case on function */

    case FNC_DCLR:                                      /* drive clear */
        rser[drv] = 0;                                  /* clear errors */
    case FNC_NOP:                                       /* no operation */
        return SCPE_OK;

    case FNC_SEARCH:                                    /* search */
    case FNC_WRITE:                                     /* write */
    case FNC_WCHK:                                      /* write check */
    case FNC_READ:                                      /* read */
        if ((uptr->flags & UNIT_ATT) == 0) {            /* not attached? */
            rs_set_er (ER_UNS, drv);                    /* unsafe */
            break;
            }
        if (rsda[drv] & DA_INV) {                       /* bad address? */
            rs_set_er (ER_IAE, drv);
            break;
            }
        rsds[drv] = rsds[drv] & ~DS_RDY;                /* clr drive rdy */
        if (fnc == FNC_SEARCH)                          /* search? */
            rsds[drv] = rsds[drv] | DS_PIP;             /* set PIP */
        t = abs (rsda[drv] - GET_POS (rs_wait));        /* pos diff */
        if (t < 1)                                      /* min time */
            t = 1;
        sim_activate (uptr, rs_wait * t);               /* schedule */
        return SCPE_OK;

    default:                                            /* all others */
        rs_set_er (ER_ILF, drv);                        /* not supported */
        break;
        }

rs_update_ds (DS_ATA, drv);                             /* set attn, req int */
return MBE_GOE;
}
开发者ID:markpizz,项目名称:markpizz.github.io,代码行数:54,代码来源:pdp11_rs.c


注:本文中的GET_POS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。