Esempio n. 1
0
// ***************** IAS Button and light ******************
void process_ias_button()
{

    if (loaded737 == 1) {
         if (multires > 0) {
             if (testbit(multibuf, IAS_BUTTON)) {
                 if (xpanelsfnbutton == 1) {
                     XPLMCommandOnce(x737mcp_spd_changeover);
                 }
                 if (xpanelsfnbutton == 0) {
                     XPLMCommandOnce(x737mcp_lvlchange_toggle);
                     lastappos = 1;
                 }
             }
         }

         // Always match x737 glareshield LED
         switch (XPLMGetDatai(x737mcp_lvlchange_led)) {
             case 1:
                 btnleds |= (1<<3);
                 break;
             case 0:
                 btnleds &= ~(1<<3);
                 break;
         }
     } else {
        if (multires > 0) {
          if(testbit(multibuf,IAS_BUTTON)) {
            if(xpanelsfnbutton == 1) {
                 if (XPLMGetDatai(AirspeedIsMach) == 1) {
                     XPLMSetDatai(AirspeedIsMach, 0);
                 } else {
                     XPLMSetDatai(AirspeedIsMach, 1);
                 }
             }
             if(xpanelsfnbutton == 0) {
                 XPLMCommandOnce(ApIasBtn);
                 lastappos = 1;
             }

          }
        }
        switch(XPLMGetDatai(ApIasStat)){
          case 2:
            btnleds |= (1<<3);   // * set bit 3 in btnleds to 1 *
            break;
          case 1:
            if (flashon == 1) {
              btnleds |= (1<<3);   // * set bit 3 in btnleds to 1 *
            }
            if (flashon == 0) {
              btnleds &= ~(1<<3);   // * clear bit 3 in btnleds to 0 *
            }
            break;
          case 0:
            btnleds &= ~(1<<3);   // * clear bit 3 in btnleds to 0 *
            break;
        }
    }
}
Esempio n. 2
0
/*
** clear collected entries from weaktables
*/
static void cleartable (GCObject *l) {
  while (l) {
    Table *h = gco2h(l);
    int i = h->sizearray;
    lua_assert(testbit(h->marked, VALUEWEAKBIT) ||
               testbit(h->marked, KEYWEAKBIT));
    if (testbit(h->marked, VALUEWEAKBIT)) {
      while (i--) {
        TValue *o = &h->array[i];
        if (iscleared(o, 0))  /* value was collected? */
          setnilvalue(o);  /* remove value */
      }
    }
    i = sizenode(h);
    while (i--) {
      Node *n = gnode(h, i);
      if (!ttisnil(gval(n)) &&  /* non-empty entry? */
          (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) {
        setnilvalue(gval(n));  /* remove value ... */
        removeentry(n);  /* remove entry from table */
      }
    }
    l = h->gclist;
  }
}
Esempio n. 3
0
void
shm_print_twin_primes(int *prime, size_t max_bit) {
    size_t i;
    for(i = 3; i <= max_bit; i += 2)
        if(testbit(prime, i) && testbit(prime, (i - 2)))
            printf("%zu %zu\n", (i - 2), i);

}
Esempio n. 4
0
void love(void)
{
    int n;

    while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
	continue;
    if (wordtype[wordnumber] == NOUNS) {
	if ((testbit(location[position].objects, BATHGOD) || testbit(location[position].objects, NORMGOD)) && wordvalue[wordnumber] == NORMGOD) {
	    if (loved) {
		printf("Loved.\n");
		return;
	    }
	    if (godready >= 2) {
		puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet,");
		puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed.");
		power++;
		pleasure += 15;
		ego++;
		if (card(injuries, NUMOFINJURIES)) {
		    puts("Her kisses revive you; your wounds are healed.\n");
		    for (n = 0; n < NUMOFINJURIES; n++)
			injuries[n] = 0;
		    WEIGHT = MAXWEIGHT;
		    CUMBER = MAXCUMBER;
		}
		printf("Goddess:\n");
		if (!loved)
		    setbit(location[position].objects, MEDALION);
		loved = 1;
		ourtime += 10;
		printf("Loved.\n");
		zzz();
		return;
	    } else {
		puts("You wish!");
		return;
	    }
	}
	if (testbit(location[position].objects, wordvalue[wordnumber])) {
	    if (wordvalue[wordnumber] == NATIVE) {
		puts("The girl peels off her sarong and indulges you.");
		power++;
		pleasure += 5;
		printf("Girl:\n");
		ourtime += 10;
		printf("Loved.\n");
		zzz();
	    }
	    if (wordvalue[wordnumber] == MAN || wordvalue[wordnumber] == BODY || wordvalue[wordnumber] == ELF || wordvalue[wordnumber] == TIMER)
		puts("Kinky!");
	    else
		puts("It doesn't seem to work.");
	} else
	    puts("Where's your lover?");
    } else
	puts("It doesn't seem to work.");
}
Esempio n. 5
0
// ***************** HDG Button and light *******************
void process_hdg_button()
{

    if (loaded737 == 1) {
        if (multires > 0) {
            if (testbit(multibuf, HDG_BUTTON)) {
                XPLMCommandOnce(x737mcp_hdg_toggle);
                lastappos = 1;
            }
        }

        // Always match x737 glareshield LED
        switch (XPLMGetDatai(x737mcp_hdg_led)) {
            case 1:
                btnleds |= (1<<1);
                break;
            case 0:
                btnleds &= ~(1<<1);
                break;
        }
    } else {
        if (multires > 0) {
          if(testbit(multibuf,HDG_BUTTON)) {

            if(xpanelsfnbutton == 1) {
                rhdgf = XPLMGetDataf(MHdg);
                XPLMSetDataf(ApHdg, rhdgf);
            }
            if(xpanelsfnbutton == 0) {
                XPLMCommandOnce(ApHdgBtn);
                lastappos = 1;
            }
          }
        }
        
        switch(XPLMGetDatai(ApHdgStat)){
          case 2:
            btnleds |= (1<<1);   // * set bit 1 in btnleds to 1 *
            break;
          case 1:
            if (flashon == 1) {
              btnleds |= (1<<1);   // * set bit 1 in btnleds to 1 *
	    }else{   
              btnleds &= ~(1<<1);   // * clear bit 1 in btnleds to 0 *
	    }
            break;
          case 0:
            btnleds &= ~(1<<1);   // * clear bit 1 in btnleds to 0 *
            break;
        }
	if (XPLMGetDatai(ApMstrStat) == 0) {
          btnleds &= ~(1<<1);   // * clear bit 1 in btnleds to 0 *
	}
    }
}
Esempio n. 6
0
// ***************** REV Button and light *******************
void process_rev_button()
{
    if (revbuttonremap == 1) {
        if (multires > 0) {
          if(testbit(multibuf,REV_BUTTON)) {
            XPLMCommandOnce(RevButtonRemapableCmd);
            lastappos = 1;
          }
        }
	switch(XPLMGetDatai(ApRevStat)){
	  case 2:
            btnleds |= (1<<7);   // * set bit 7 in btnleds to 1 *
            break;
          case 1:
	    if (flashon == 1) {
              btnleds |= (1<<7);   // * set bit 7 in btnleds to 1 *
	    }else{    
              btnleds &= ~(1<<7);   // * clear bit 7 in btnleds to 0 *
	    }
            break;
          case 0:
            btnleds &= ~(1<<7);   // * clear bit 7 in btnleds to 0 *
            break;
	} 
    } else {

        if (multires > 0) {
          if(testbit(multibuf,REV_BUTTON)) {
            XPLMCommandOnce(ApRevBtn);
            lastappos = 1;
          }
        }
        switch(XPLMGetDatai(ApRevStat)){
          case 2:
            btnleds |= (1<<7);   // * set bit 7 in btnleds to 1 *
            break;
          case 1:
            if (flashon == 1) {
              btnleds |= (1<<7);   // * set bit 7 in btnleds to 1 *
            }else{
              btnleds &= ~(1<<7);   // * clear bit 7 in btnleds to 0 *
            }
            break;
          case 0:
            btnleds &= ~(1<<7);   // * clear bit 7 in btnleds to 0 *
            break;
        }

    }

}
Esempio n. 7
0
// ***************** VS Button and light *******************
void process_vs_button()
{

    if (loaded737 == 1) {
        if (multires > 0) {
            if (testbit(multibuf, VS_BUTTON)) {
                XPLMCommandOnce(x737mcp_vs_toggle);
                lastappos = 1;
            }
        }
        switch (XPLMGetDatai(x737mcp_vvi_led)) {
            case 1:
                btnleds |= (1<<5);
                break;
            case 0:
                if (XPLMGetDatai(x737mcp_vvi_armed_led)) {
                    if (flashon == 0) {
                        btnleds |= (1<<5);
                    } else {
                        btnleds &= ~(1<<5);
                    }
                } else {
                    btnleds &= ~(1<<5);
                }
                break;
        }
    } else {
        if (multires > 0) {
          if(testbit(multibuf,VS_BUTTON)) {
            XPLMCommandOnce(ApVsBtn);
            lastappos = 1;
          }
        }
	switch(XPLMGetDatai(ApVsStat)){
	  case 2:
            btnleds |= (1<<5);   // * set bit 5 in btnleds to 1 *
            break;
          case 1:
	    if (flashon == 0) {
              btnleds |= (1<<5);   // * set bit 5 in btnleds to 1 *
	    }else{   
              btnleds &= ~(1<<5);   // * clear bit 5 in btnleds to 0 *
	    }
            break;
          case 0:
            btnleds &= ~(1<<5);   // * clear bit 5 in btnleds to 0 *
            break;
        }
    }
}
Esempio n. 8
0
// ***************** Flaps Switch *******************
void process_flaps_switch()
{
    if (XPLMGetDatai(BatPwrOn) == 1) {

        if (multires > 0) {
	  if(testbit(multibuf,FLAPS_UP_SWITCH)) {
	    XPLMCommandOnce(FlapsUp);	 
          }
	  if(testbit(multibuf,FLAPS_DN_SWITCH)) {
	    XPLMCommandOnce(FlapsDn);	 
	  }
        }
   }
}
Esempio n. 9
0
int
fill_twins_array(unsigned **twin_pairs, int *map, size_t max_bit)
{
    size_t i, j = 0;
    for(i = 0; i <= max_bit; i++) {
        if(testbit(map, i) && testbit(map, (i - 2))) {
            twin_pairs[j] = xmalloc(sizeof(unsigned) * 2);
            twin_pairs[j][0] = i - 2;
            twin_pairs[j][1] = i;
            j++;
        }
    }
    /* Return the number of pairs stored */
    return j;
}
Esempio n. 10
0
void moveF(void) {
	uint32_t F=M.AWGdesiredF;
    uint8_t i=6;
	do {    // Find range
        if(F>=pgm_read_dword_near(Powersof10+i)) break;
    } while(i--);
	uint32_t add=pgm_read_dword_near(Powersof10+i-2);
	if(testbit(Misc,negative)) F-=add;
	else if(testbit(Misc, bigfont)) F+=add;
	else {  // Shortcuts
		if(i==2) i=7;
        F=pgm_read_dword_near(Powersof10+i-1);
    }
	M.AWGdesiredF = F;
}
Esempio n. 11
0
// ***************** ALT Button and light *******************
void process_alt_button()
{

    if (loaded737 == 1) {
        if (multires > 0) {
            if (testbit(multibuf, ALT_BUTTON)) {
                XPLMCommandOnce(x737mcp_alt_toggle);
                lastappos = 1;
            }
        }

        // Always match x737 glareshield LED
        switch (XPLMGetDatai(x737mcp_alt_led)) {
            case 1:
                btnleds |= (1<<4);
                break;
            case 0:
                btnleds &= ~(1<<4);
                break;
        }
    } else {
        if (multires > 0) {
          if(testbit(multibuf,ALT_BUTTON)) {
           XPLMCommandOnce(ApAltBtn);
           lastappos = 1;
          }
        }
	switch(XPLMGetDatai(ApAltStat)){
	  case 2:
            btnleds |= (1<<4);   // * set bit 4 in btnleds to 1 *
            break;
          case 1:
	    if (flashon == 1) {
              btnleds |= (1<<4);   // * set bit 4 in btnleds to 1 *
	    }else{    
              btnleds &= ~(1<<4);   // * clear bit 4 in btnleds to 0 *
	    }
            break;
          case 0:
            btnleds &= ~(1<<4);   // * clear bit 4 in btnleds to 0 *
            break;
	} 
	
	if (XPLMGetDatai(ApMstrStat) == 0) {
          btnleds &= ~(1<<4);   // * clear bit 4 in btnleds to 0 *
	}
    }
}
Esempio n. 12
0
/*-------------------------------------------------------------------------------
Send instruction to the LCD
	LcdInstructionWrite (uint8_t u8Instruction)
		u8Instruction = Instruction to send to the LCDCHSIZE 2 2469
-------------------------------------------------------------------------------*/
void LcdInstructionWrite (uint8_t u8Instruction) {
    clrbit(LCD_CTRL, LCD_CS);			// Select
    clrbit(LCD_CTRL,LCD_RS);            // Instruction mode
    USARTD0.DATA= u8Instruction;
    while(!testbit(USARTD0.STATUS,6));     // Wait until transmit done
    setbit(USARTD0.STATUS,6);
}
Esempio n. 13
0
/*
 * Happy Thread
 * 
 * Parllel happy process with threads.
 * each thread gets a unique index
 */
static void *happy_thread (void *arg)
{
	struct happy_data *thread = (struct happy_data*) arg;
	int local = 1;
	int s;

	while (local < thread->num) {

		s = pthread_mutex_lock(&mutex_avail);
		if (s != 0) {
			errEXIT("mutex lock");
		}
		local = happy_ind;
		happy_ind++;
		s = pthread_mutex_unlock(&mutex_avail);
		if (s != 0) {
			errEXIT("mutex lock");
		}
		if (!testbit(thread->bit_pointer, local)) {
			if (happy(local)) {
				s = pthread_mutex_lock(&mutex_avail);
				if (s != 0) {
					errEXIT("mutex lock");
				}
				total_happy++;
				s = pthread_mutex_unlock(&mutex_avail);
				if (s != 0) {
					errEXIT("mutex lock");
				}
			}
		}
	}

	pthread_exit((void *) 0);
}
Esempio n. 14
0
/*
** if object 'o' has a finalizer, remove it from 'allgc' list (must
** search the list to find it) and link it in 'finobj' list.
*/
void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
	global_State *g = G(L);
	if (testbit(gch(o)->marked, SEPARATED) || /* obj. is already separated... */
		isfinalized(o) ||                           /* ... or is finalized... */
		gfasttm(g, mt, TM_GC) == NULL)                /* or has no finalizer? */
	return;  /* nothing to be done */
	else {  /* move 'o' to 'finobj' list */
	GCObject **p;
	GCheader *ho = gch(o);
	if (g->sweepgc == &ho->next) {  /* avoid removing current sweep object */
		lua_assert(issweepphase(g));
		g->sweepgc = sweeptolive(L, g->sweepgc, NULL);
	}
	/* search for pointer pointing to 'o' */
	for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ }
	*p = ho->next;  /* remove 'o' from root list */
	ho->next = g->finobj;  /* link it in list 'finobj' */
	g->finobj = o;
	l_setbit(ho->marked, SEPARATED);  /* mark it as such */
	if (!keepinvariantout(g))  /* not keeping invariant? */
		makewhite(g, o);  /* "sweep" object */
	else
		resetoldbit(o);  /* see MOVE OLD rule */
	}
}
Esempio n. 15
0
int deja_evalue(int** newtree, int nb, int** list_tree, int nblist, int nblistmax){

  int i, ii, j, jj, k, debut, tot, bitdeb;
  int eq, opp, ret;



  debut=nblist%nblistmax;
  if(nblist<nblistmax) tot=nblist; else tot=nblistmax;
  for(i=0;i<tot;i++){
    ii=debut-i-1;
    if(ii<0) ii+=nblistmax;
    bitdeb=ii*(nb-3);
    for(j=0;j<nb-3;j++){
      for(jj=0;jj<nb-3;jj++){
        eq=opp=0;
        for(k=0;k<nb;k++){
	  ret=testbit(list_tree[k], bitdeb+jj+1);
	  if(ret && newtree[k][j]) eq=1;
	  else if(ret && !newtree[k][j]) opp=1;
	  else if(!ret && newtree[k][j]) opp=1;
	  else eq=1;
	  if(eq && opp) break; /* branches j (newtree) et jj (listed current tree) differentes */
        }
        if(k==nb) break; /* branches j et jj identiques : passer a j+1 */
      }
      if(jj==nb-3) break; /* branche j n'a pas d'identique : passer au listed tree suivant */
    }
    if(j==nb-3) return 1; /* toutes les branches j ont un identique : deja evalue */ 
  }
  return 0;
}
Esempio n. 16
0
File: pgen.c Progetto: 10sr/cpython
static void
printssdfa(int xx_nstates, ss_state *xx_state, int nbits,
           labellist *ll, char *msg)
{
    int i, ibit, iarc;
    ss_state *yy;
    ss_arc *zz;

    printf("Subset DFA %s\n", msg);
    for (i = 0; i < xx_nstates; i++) {
        yy = &xx_state[i];
        if (yy->ss_deleted)
            continue;
        printf(" Subset %d", i);
        if (yy->ss_finish)
            printf(" (finish)");
        printf(" { ");
        for (ibit = 0; ibit < nbits; ibit++) {
            if (testbit(yy->ss_ss, ibit))
                printf("%d ", ibit);
        }
        printf("}\n");
        for (iarc = 0; iarc < yy->ss_narcs; iarc++) {
            zz = &yy->ss_arc[iarc];
            printf("  Arc to state %d, label %s\n",
                zz->sa_arrow,
                PyGrammar_LabelRepr(
                    &ll->ll_label[zz->sa_label]));
        }
    }
}
Esempio n. 17
0
void
shm_print_primes(int *prime, size_t max_bit) {
    size_t i;
    printf("%u\n", 2);
    for(i = 3; i <= max_bit; i += 2)
        if(testbit(prime, i))
            printf("%zu\n", i);
}
Esempio n. 18
0
// *************** Trim Wheel *********************
void process_trim_wheel()
{

  int i;
        if (multires > 0) {
	  if(testbit(multibuf,TRIM_WHEEL_UP)) {
	    for(i = 0; i < trimspeed; ++i){
              XPLMCommandOnce(PitchTrimUp);
	    }
	  }	
	  if(testbit(multibuf,TRIM_WHEEL_DN)) {
	    for(i = 0; i < trimspeed; ++i){
              XPLMCommandOnce(PitchTrimDn);
            }
	  }
	}
}
Esempio n. 19
0
// Waits for a character from the serial port for a certain time, 
// If no character is received, it returns 0
static uint8_t read(void) {
    uint16_t timeout=25000; // 250 ms
    while(!testbit(USARTE0.STATUS,USART_RXCIF_bp)) {
        _delay_us(10);
        if(--timeout==0) return 0;
    }
    return USARTE0.DATA;
}
Esempio n. 20
0
File: map.c Progetto: chobits/tinyos
/* return orignal bit value */
static int imap_lookup(struct super_block *sb, unsigned int ino)
{
	struct block *block;
	int r;
	block = minix_get_block(sb, INODE_MAP_BLK(ino));
	r = testbit(block->b_data, ino & BITS_PER_BLOCK_MASK);
	put_block(block);
	return r;
}
Esempio n. 21
0
printobjs()
{
	register unsigned int *p = location[position].objects;
	register n;

	printf("\n");
	for (n = 0; n < NUMOFOBJECTS; n++)
		if (testbit(p, n) && objdes[n])
			puts(objdes[n]);
}
Esempio n. 22
0
int
main(int argc, char **argv)
{
	char mainbuf[LINELENGTH];
	char *next;

	/* Open the score file then revoke setgid privileges */
	open_score_file();
	setgid(getgid());

	initialize(argc < 2 || strcmp(argv[1], "-r"));
start:
	news();
	beenthere[position]++;
	if (notes[LAUNCHED])
		crash();	/* decrements fuel & crash */
	if (matchlight) {
		puts("Your match splutters out.");
		matchlight = 0;
	}
	if (!notes[CANTSEE] || testbit(inven, LAMPON) ||
	    testbit(location[position].objects, LAMPON)) {
		writedes();
		printobjs();
	} else
		puts("It's too dark to see anything in here!");
	whichway(location[position]);
run:
	next = getcom(mainbuf, sizeof mainbuf, ">-: ",
	    "Please type in something.");
	for (wordcount = 0; next && wordcount < 20; wordcount++)
		next = getword(next, words[wordcount], -1);
	parse();
	switch (cypher()) {
	case -1:
		goto run;
	case 0:
		goto start;
	default:
		exit(1); /* Shouldn't happen */
	}
	return (1);
}
Esempio n. 23
0
int
ucard(const unsigned int *array)
{
	int     j = 0, n;

	for (n = 0; n < NUMOFOBJECTS; n++)
		if (testbit(array, n))
			j++;
	return (j);
}
Esempio n. 24
0
int
zzz()
{
    int oldtime;
    register int n;

    oldtime = Time;
    if ((snooze - Time) < (0.75 * CYCLE)) {
        Time += 0.75 * CYCLE - (snooze - Time);
        printf("<zzz>");
        for (n = 0; n < Time - oldtime; n++)
            printf(".");
        printf("\n");
        snooze += 3 * (Time - oldtime);
        if (notes[LAUNCHED]) {
            fuel -= (Time - oldtime);
            if (location[position].down) {
                position = location[position].down;
                crash();
            }
            else
                notes[LAUNCHED] = 0;
        }
        if (OUTSIDE && rnd(100) < 50) {
            puts("You are awakened abruptly by the sound of someone nearby.");
            switch(rnd(4)) {
            case 0:
                if (ucard(inven)) {
                    n = rnd(NUMOFOBJECTS);
                    while(!testbit(inven,n))
                        n = rnd(NUMOFOBJECTS);
                    clearbit(inven,n);
                    if (n != AMULET && n != MEDALION && n != TALISMAN)
                        setbit(location[position].objects,n);
                    carrying -= objwt[n];
                    encumber -= objcumber[n];
                }
                puts("A fiendish little Elf is stealing your treasures!");
                fight(ELF,10);
                break;
            case 1:
                setbit(location[position].objects,DEADWOOD);
                break;
            case 2:
                setbit(location[position].objects,HALBERD);
                break;
            default:
                break;
            }
        }
    }
    else
        return(0);
    return(1);
}
Esempio n. 25
0
void
printobjs(void)
{
	unsigned int *p = location[position].objects;
	int     n;

	printf("\n");
	for (n = 0; n < NUMOFOBJECTS; n++)
		if (testbit(p, n) && objdes[n])
			puts(objdes[n]);
}
Esempio n. 26
0
bool OSBlog::DiagnosticIsEnabled(VXIunsigned tagID)
{
    VXIunsigned bindex, bpos;
    if (!Convert2Index(tagID, &bindex, &bpos))
        return false;

    // if this tag is not turned on, just return
    if (!testbit(TagIDs[bindex],bpos))
        return false;

    return true;
}
Esempio n. 27
0
/** 
 * Initialize event device for mouse. 
 */
void
init_mouse ( void )
{
  	uint8_t evt[EV_MAX / 8 + 1];

	/* get capabilities */
	ioctl( fd, EVIOCGBIT( 0, sizeof(evt)), evt );

	if ( ! ( testbit( EV_KEY, evt ) &&
			 testbit( EV_REL, evt ) ) )
	{
		fprintf( stderr, "'%s' doesn't seem to be a mouse! look in /proc/bus/input/devices to find the name of your mouse's event device\n", device );
		exit( 1 );
	}

	if ( ioctl( fd, EVIOCGRAB, 1 ) )
	{
		perror( "EVIOCGRAB" );
		exit(1);
	}
}
Esempio n. 28
0
void kiss (void)
{
    while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
	continue;
    // The goddess must be "taken" first if bathing. This will remove her from the bath and move her into the throne room.
    if (wordtype[wordnumber] == NOUNS && wordvalue[wordnumber] == NORMGOD && testbit(location[position].objects, BATHGOD)) {
	wordvalue[--wordnumber] = TAKE;
	cypher();
	return;
    }
    if (wordtype[wordnumber] == NOUNS) {
	if (testbit(location[position].objects, wordvalue[wordnumber])) {
	    pleasure++;
	    printf("Kissed.\n");
	    switch (wordvalue[wordnumber]) {
		case NORMGOD:
		    switch (godready++) {
			case 0: puts("She squirms and avoids your advances."); break;
			case 1: puts("She is coming around; she didn't fight it as much."); break;
			case 2: puts("She's beginning to like it."); break;
			default: puts("She's gone limp."); break;
		    }
		    break;
		case NATIVE:
		    puts("Her lips are warm and her body robust. She pulls you down to the ground.");
		    break;
		case TIMER:
		    puts("The old man blushes.");
		    break;
		case MAN:
		    puts("The dwarf punches you in the kneecap.");
		    break;
		default:
		    pleasure--;
	    }
	} else
	    puts("I see nothing like that here.");
    } else
	puts("I'd prefer not to.");
}
Esempio n. 29
0
void
print_bits(int *map, size_t max_bit)
{
    size_t i, j;
    for(i = 0, j = 0; i < max_bit; i++, j++) {
        if(j == 78) {
            //putchar('\n');
            j = 0;
        }
        printf("%zu, %c\n", i, (testbit(map, i) == 1 ? '1' : '0'));
    }
    //putchar('\n');
}
Esempio n. 30
0
int
use(void)
{
	while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount)
		; /* nothing */
	if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) &&
	    position != FINAL) {
		puts("The amulet begins to glow.");
		if (testbit(inven, MEDALION)) {
			puts("The medallion comes to life too.");
			if (position == 114) {
				location[position].down = 160;
				whichway(location[position]);
				puts("The waves subside and it is possible to descend to the sea cave now.");
				gtime++;
				return (-1);
			}
		}
		puts("A light mist falls over your eyes and the sound of purling water trickles in");
		puts("your ears.   When the mist lifts you are standing beside a cool stream.");
		if (position == 229)
			position = 224;
		else
			position = 229;
		gtime++;
		notes[CANTSEE] = 0;
		return(0);
	} else if (position == FINAL)
		puts("The amulet won't work in here.");
	else if (wordvalue[wordnumber] == COMPASS && testbit(inven, COMPASS))
		printf("Your compass points %s.\n", truedirec(NORTH, '-'));
	else if (wordvalue[wordnumber] == COMPASS)
		puts("You aren't holding the compass.");
	else if (wordvalue[wordnumber] == AMULET)
		puts("You aren't holding the amulet.");
	else
		puts("There is no apparent use.");
	return (-1);
}