コード例 #1
0
ファイル: wizard.c プロジェクト: NickMcConnell/RePosBand
/**
 * Tweak the cursed status of an object.
 *
 * \param o_ptr is the object to curse or decurse
 */
static void wiz_tweak_curse(object_type *o_ptr)
{
	if (cursed_p(o_ptr))
	{
		msg_print("Resetting existing curses.");
		flags_clear(o_ptr->flags, OF_SIZE, OF_CURSE_MASK, FLAG_END);
	}

	if (get_check("Set light curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, FLAG_END);
	else if (get_check("Set heavy curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, OF_HEAVY_CURSE, FLAG_END);
	else if (get_check("Set permanent curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, OF_HEAVY_CURSE, OF_PERMA_CURSE, FLAG_END);
}
コード例 #2
0
ファイル: esc_hw.c プロジェクト: hefloryd/SOES
/** PDI ISR handler
 *
 * @param[in]   arg     = NOT USED
 */
static void ecat_isr (void * arg)
{

   ESC_read (ESCREG_LOCALTIME, (void *) &ESCvar.Time, sizeof (ESCvar.Time));
   ESCvar.Time = etohl (ESCvar.Time);
   CC_ATOMIC_SET(ESCvar.ALevent, etohl(ecat0->AL_EVENT_REQ));

   if(ESCvar.ALevent & ESCREG_ALEVENT_SM2)
   {
      if(ESCvar.dcsync == 0)
      {
         DIG_process(DIG_PROCESS_OUTPUTS_FLAG | DIG_PROCESS_APP_HOOK_FLAG |
               DIG_PROCESS_INPUTS_FLAG);
      }
      else
      {
         DIG_process(DIG_PROCESS_OUTPUTS_FLAG);
      }
   }

#if 1
   if(ESCvar.ALevent & (ESCREG_ALEVENT_CONTROL | ESCREG_ALEVENT_SMCHANGE
         | ESCREG_ALEVENT_SM0 | ESCREG_ALEVENT_SM1 | ESCREG_ALEVENT_EEP))
   {
      /* Mask interrupts while servicing them */
      ecat0->AL_EVENT_MASK &= ~(ESCREG_ALEVENT_CONTROL | ESCREG_ALEVENT_SMCHANGE
            | ESCREG_ALEVENT_SM0 | ESCREG_ALEVENT_SM1 | ESCREG_ALEVENT_EEP);

      extern flags_t * ecat_events;
      flags_set(ecat_events, EVENT_ISR);
      //sem_signal(ecat_isr_sem);
   }
#endif
}
コード例 #3
0
ファイル: wizard.c プロジェクト: mtadd/angband
/**
 * Tweak the cursed status of an object.
 *
 * \param o_ptr is the object to curse or decurse
 */
static void wiz_tweak_curse(object_type *o_ptr)
{
	if (cursed_p(o_ptr->flags))
	{
		bitflag f[OF_SIZE];
		msg("Resetting existing curses.");

		create_mask(f, FALSE, OFT_CURSE, OFT_MAX);
		of_diff(o_ptr->flags, f);
	}

	if (get_check("Set light curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, FLAG_END);
	else if (get_check("Set heavy curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, OF_HEAVY_CURSE, FLAG_END);
	else if (get_check("Set permanent curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, OF_HEAVY_CURSE, OF_PERMA_CURSE, FLAG_END);
}
コード例 #4
0
ファイル: ca-findcycles.c プロジェクト: allagar/junkcode
void search_cycle(CA *ca, char *graph, UINT starting_state)
{
  UINT actual_state = starting_state;
  int is_new_cycle = 0;

  while (!flags_test(graph, actual_state, STATE_HAS_BEEN_VISITED))
  {
    flags_set(graph, actual_state, STATE_HAS_BEEN_VISITED | STATE_IS_BEING_VISITED);
    actual_state = next_state(ca, actual_state);
  }

  is_new_cycle = flags_test(graph, actual_state, STATE_IS_BEING_VISITED);

  if (is_new_cycle)
  {
    UINT cycle_len = 0;

    while (flags_test(graph, actual_state, STATE_IS_BEING_VISITED))
    {
      flags_unset(graph, actual_state, STATE_IS_BEING_VISITED);

      actual_state = next_state(ca, actual_state);

      cycle_len ++;
    }

    /* printf("len %u seed %u start %u ", cycle_len, actual_state, starting_state); */
    printf("%" UFM  "\n", cycle_len);
    fflush(stdout);
  }

  for  (actual_state = starting_state;
        flags_test(graph, actual_state, STATE_IS_BEING_VISITED);
        actual_state = next_state(ca, actual_state))
  {
     flags_unset(graph, actual_state, STATE_IS_BEING_VISITED);
  }
}
コード例 #5
0
	u32 polflags_from_tileflags( unsigned short tile, u32 uoflags, bool use_no_shoot, bool LOS_through_windows )
	{
	  u32 mapflags = 0;

	  if ( ( uoflags & Core::USTRUCT_TILE::FLAG_LIQUID ) &&
		   ( uoflags & Core::USTRUCT_TILE::FLAG_FLOOR ) )
	  {
		mapflags |= FLAG::MOVESEA;
	  }
	  else if ( ( uoflags & Core::USTRUCT_TILE::FLAG_PLATFORM ) &&
				( ~uoflags & Core::USTRUCT_TILE::FLAG_BLOCKING ) )
	  {
		mapflags |= FLAG::MOVELAND;
	  }

	  // GRADUAL only makes sense if also STANDABLE.
	  if ( ( mapflags & FLAG::MOVELAND ) &&
		   ( uoflags & Core::USTRUCT_TILE::FLAG_HALF_HEIGHT ) )
	  {
		mapflags |= FLAG::GRADUAL;
	  }

	  if ( uoflags & Core::USTRUCT_TILE::FLAG_HOVEROVER )
	  {
		mapflags |= FLAG::OVERFLIGHT;
	  }

	  if ( uoflags & Core::USTRUCT_TILE::FLAG_PLATFORM )
	  {
		mapflags |= FLAG::ALLOWDROPON;
	  }

	  if ( uoflags & Core::USTRUCT_TILE::FLAG_STACKABLE )
	  {
		mapflags |= FLAG::STACKABLE;
	  }

	  if ( uoflags & Core::USTRUCT_TILE::FLAG_EQUIPPABLE )
	  {
		mapflags |= FLAG::EQUIPPABLE;
	  }

	  if ( uoflags & Core::USTRUCT_TILE::FLAG_DESC_NEEDS_A )
	  {
		mapflags |= FLAG::DESC_PREPEND_A;
	  }

	  if ( uoflags & Core::USTRUCT_TILE::FLAG_DESC_NEEDS_AN )
	  {
		mapflags |= FLAG::DESC_PREPEND_AN;
	  }

	  if ( use_no_shoot )

	  {

		if ( ( uoflags & Core::USTRUCT_TILE::FLAG_WALL ) &&

			 ( uoflags & ( Core::USTRUCT_TILE::FLAG_BLOCKING | Core::USTRUCT_TILE::FLAG_DOOR ) )

			 )

			 mapflags |= FLAG::BLOCKSIGHT;



		if ( uoflags & Core::USTRUCT_TILE::FLAG_NO_SHOOT )

		  mapflags |= FLAG::BLOCKSIGHT;



		if ( !LOS_through_windows )

		{

		  if ( ( uoflags & Core::USTRUCT_TILE::FLAG_WINDOW ) &&

			   ( uoflags & Core::USTRUCT_TILE::FLAG_WALL )

			   )

			   mapflags |= FLAG::BLOCKSIGHT;

		}
		else

		{

		  if ( uoflags & Core::USTRUCT_TILE::FLAG_WINDOW )

			mapflags &= ~FLAG::BLOCKSIGHT;

		}

	  }

	  else

	  {

		if ( ( uoflags & Core::USTRUCT_TILE::FLAG_WALL ) &&
			 ( ~uoflags & Core::USTRUCT_TILE::FLAG_BLOCKING ) &&
			 ( uoflags & Core::USTRUCT_TILE::FLAG_DOOR ) )
		{
		  // example: 0xf5 secret door
		  mapflags |= FLAG::BLOCKSIGHT;
		}
		else if ( ( uoflags & Core::USTRUCT_TILE::FLAG_WALL ) &&
				  ( ~uoflags & Core::USTRUCT_TILE::FLAG_BLOCKING ) )
		{
		  // example: 0x245 dungeon arch
		}
		else if ( uoflags & ( Core::USTRUCT_TILE::FLAG_BLOCKING |
		  Core::USTRUCT_TILE::FLAG_PLATFORM |
		  Core::USTRUCT_TILE::FLAG_HALF_HEIGHT ) )
		{
		  mapflags |= FLAG::BLOCKSIGHT;
		}
	  }

	  if ( flags_set( uoflags, Core::USTRUCT_TILE::FLAG_FLOOR | Core::USTRUCT_TILE::FLAG_LIQUID | Core::USTRUCT_TILE::FLAG_BLOCKING ) )
	  {
		// not blocking
	  }
	  else if ( ( uoflags & Core::USTRUCT_TILE::FLAG_BLOCKING ) )
	  {
		mapflags |= FLAG::BLOCKING;
	  }
	  if ( uoflags & Core::USTRUCT_TILE::FLAG_ROOF )
	  {
		mapflags |= FLAG::BLOCKING;
	  }
	  else if ( flags_clear( uoflags, Core::USTRUCT_TILE::FLAG_WALL ) &&
				flags_clear( uoflags, Core::USTRUCT_TILE::FLAG_BLOCKING ) )
	  {
		mapflags |= FLAG::MOVABLE;
	  }

	  // the following flags are probably not useful:

	  // everything allows overflight above it.
	  //mapflags |= FLAG::OVERFLIGHT;

	  if ( Core::cfg_show_roof_and_platform_warning )
      if ( ( mapflags & FLAG::BLOCKING ) && ( mapflags & ( FLAG::MOVELAND | FLAG::MOVESEA ) ) )
        INFO_PRINT << " Warning: Tile 0x" << fmt::hexu( tile ) << " uses Roof- and Platform-Flag at same time.\n";

	  return mapflags;
	}
コード例 #6
0
ファイル: widget.c プロジェクト: beoran/eruta
/** Sets an individual flag on the widget. */
int bbwidget_flag(BBWidget * self, int flag) {
  return flags_set(&self->flags, flag);
}
コード例 #7
0
ファイル: flags.c プロジェクト: beoran/eruta
/** Sets or unsets an individual flag on the self. 
If set is true the flag is set, if false it's unset. */
int flags_put(int * self, int flag, int set) {
  if (set) { return flags_set(self, flag); }
  else { return flags_unset(self, flag); }
}
コード例 #8
0
ファイル: camera.c プロジェクト: bjorndm/ekq
/** Sets an individual flag on the Camera. */
int camera_setflag(Camera * self, int flag) {
  return flags_set(&self->flags, flag);
}
コード例 #9
0
ファイル: thing.c プロジェクト: beoran/eruta
/** Sets an individual flag on the Thing. */
int thing_setflag(Thing * self, int flag) {
  return flags_set(&self->flags, flag);
}