mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-11 09:50:12 +00:00
Avoid ambigious if() if() else().
This commit is contained in:
parent
5843a8f56f
commit
c057c9b641
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51047
@ -82,7 +82,7 @@ love()
|
||||
|
||||
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
|
||||
if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
|
||||
if (wordvalue[wordnumber] == NORMGOD && !loved)
|
||||
if (wordvalue[wordnumber] == NORMGOD && !loved) {
|
||||
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.");
|
||||
@ -107,6 +107,7 @@ love()
|
||||
puts("You wish!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (wordvalue[wordnumber] == NATIVE){
|
||||
puts("The girl is easy prey. She peels off her sarong and indulges you.");
|
||||
power++;
|
||||
|
@ -570,7 +570,7 @@ peg(mycrib)
|
||||
prhand(ph, pnum, Playwin, FALSE);
|
||||
prhand(ch, cnum, Compwin, TRUE);
|
||||
prtable(sum);
|
||||
if (last)
|
||||
if (last) {
|
||||
if (played) {
|
||||
msg(quiet ? "I get one for last" :
|
||||
"I get one point for last");
|
||||
@ -583,6 +583,7 @@ peg(mycrib)
|
||||
if (chkscr(&pscore, 1))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
@ -152,21 +152,23 @@ scorehand(hand, starter, n, crb, do_explain)
|
||||
sorthand(h, n + 1); /* sort by rank */
|
||||
i = 2 * fifteens(h, n + 1);
|
||||
score += i;
|
||||
if (do_explain)
|
||||
if (do_explain) {
|
||||
if (i > 0) {
|
||||
(void) sprintf(buf, "%d points in fifteens", i);
|
||||
strcat(expl, buf);
|
||||
} else
|
||||
strcat(expl, "No fifteens");
|
||||
}
|
||||
i = pairuns(h, n + 1);
|
||||
score += i;
|
||||
if (do_explain)
|
||||
if (do_explain) {
|
||||
if (i > 0) {
|
||||
(void) sprintf(buf, ", %d points in pairs, %d in runs",
|
||||
pairpoints, runpoints);
|
||||
strcat(expl, buf);
|
||||
} else
|
||||
strcat(expl, ", No pairs/runs");
|
||||
}
|
||||
return (score);
|
||||
}
|
||||
|
||||
|
@ -510,8 +510,9 @@ register boolean on;
|
||||
for(zy = seely; zy <= seehy; zy++)
|
||||
for(zx = seelx; zx <= seehx; zx++) {
|
||||
levl[zx][zy].lit = on;
|
||||
if(!Blind && dist(zx,zy) > 2)
|
||||
if(!Blind && dist(zx,zy) > 2) {
|
||||
if(on) prl(zx,zy); else nosee(zx,zy);
|
||||
}
|
||||
}
|
||||
if(!on) seehx = 0;
|
||||
#endif QUEST
|
||||
|
@ -391,8 +391,9 @@ register int newlevel;
|
||||
newlevel = atoi(buf);
|
||||
} else {
|
||||
newlevel = 5 + rn2(20); /* 5 - 24 */
|
||||
if(dlevel == newlevel)
|
||||
if(dlevel == newlevel) {
|
||||
if(!xdnstair) newlevel--; else newlevel++;
|
||||
}
|
||||
}
|
||||
if(newlevel >= 30) {
|
||||
if(newlevel > MAXLEVEL) newlevel = MAXLEVEL;
|
||||
|
@ -50,7 +50,7 @@ main(argc,argv)
|
||||
#ifndef VT100
|
||||
init_term(); /* setup the terminal (find out what type) for termcap */
|
||||
#endif VT100
|
||||
if (((ptr = getlogin()) == 0) || (*ptr==0)) /* try to get login name */
|
||||
if (((ptr = getlogin()) == 0) || (*ptr==0)) { /* try to get login name */
|
||||
if (pwe=getpwuid(getuid())) /* can we get it from /etc/passwd? */
|
||||
ptr = pwe->pw_name;
|
||||
else
|
||||
@ -60,6 +60,7 @@ main(argc,argv)
|
||||
noone: write(2, "Can't find your logname. Who Are You?\n",39);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (ptr==0) goto noone;
|
||||
if (strlen(ptr)==0) goto noone;
|
||||
/*
|
||||
@ -788,7 +789,7 @@ char *p;
|
||||
while (1)
|
||||
{
|
||||
if ((i = whatitem("eat"))=='\33') return;
|
||||
if (i != '.')
|
||||
if (i != '.') {
|
||||
if (i=='*') showeat(); else
|
||||
{
|
||||
if (iven[i-'a']==OCOOKIE)
|
||||
@ -808,6 +809,7 @@ while (1)
|
||||
if (iven[i-'a']==0) { ydhi(i); return; }
|
||||
lprcat("\nYou can't eat that!"); return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -713,6 +713,7 @@ omnidirect(spnum,dam,str)
|
||||
for (y=playery-1; y<playery+2; y++)
|
||||
{
|
||||
if (m=mitem[x][y])
|
||||
{
|
||||
if (nospell(spnum,m) == 0)
|
||||
{
|
||||
ifblind(x,y);
|
||||
@ -720,6 +721,7 @@ omnidirect(spnum,dam,str)
|
||||
hitm(x,y,dam); nap(800);
|
||||
}
|
||||
else { lasthx=x; lasthy=y; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1085,7 +1087,9 @@ spattack(x,xx,yy)
|
||||
case 1: /* rust your armor, j=1 when rusting has occurred */
|
||||
m = k = c[WEAR];
|
||||
if ((i=c[SHIELD]) != -1)
|
||||
{
|
||||
if (--ivenarg[i] < -1) ivenarg[i]= -1; else j=1;
|
||||
}
|
||||
if ((j==0) && (k != -1))
|
||||
{
|
||||
m = iven[k];
|
||||
@ -1226,6 +1230,7 @@ annihilate()
|
||||
for (k=0, i=playerx-1; i<=playerx+1; i++)
|
||||
for (j=playery-1; j<=playery+1; j++)
|
||||
if (!vxy(&i,&j)) /* if not out of bounds */
|
||||
{
|
||||
if (*(p= &mitem[i][j])) /* if a monster there */
|
||||
if (*p<DEMONLORD+2)
|
||||
{
|
||||
@ -1236,6 +1241,7 @@ annihilate()
|
||||
lprintf("\nThe %s barely escapes being annihilated!",monster[*p].name);
|
||||
hitp[i][j] = (hitp[i][j]>>1) + 1; /* lose half hit points*/
|
||||
}
|
||||
}
|
||||
if (k>0)
|
||||
{
|
||||
lprcat("\nYou hear loud screams of agony!"); raiseexperience((long)k);
|
||||
|
@ -275,13 +275,14 @@ int ch; /* input */
|
||||
|
||||
mvaddstr(7, 0, "1:Melee 2:Skirmish 3:Evade 4:Spell 5:Nick ");
|
||||
|
||||
if (!Luckout)
|
||||
if (!Luckout) {
|
||||
/* haven't tried to luckout yet */
|
||||
if (Curmonster.m_type == SM_MORGOTH)
|
||||
/* cannot luckout against Morgoth */
|
||||
addstr("6:Ally ");
|
||||
else
|
||||
addstr("6:Luckout ");
|
||||
}
|
||||
|
||||
if (Player.p_ring.ring_type != R_NONE)
|
||||
/* player has a ring */
|
||||
@ -1200,7 +1201,7 @@ double dtemp; /* for temporary calculations */
|
||||
ch = getanswer("NY", FALSE);
|
||||
addstr("\n\n");
|
||||
|
||||
if (ch == 'Y')
|
||||
if (ch == 'Y') {
|
||||
if (drandom() < treasuretype / 35.0 + 0.04)
|
||||
/* cursed */
|
||||
{
|
||||
@ -1209,6 +1210,7 @@ double dtemp; /* for temporary calculations */
|
||||
}
|
||||
else
|
||||
collecttaxes(gold, gems);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -424,6 +424,7 @@ bool dishonest = FALSE;/* set when merchant is dishonest */
|
||||
ch = getanswer("NY", FALSE);
|
||||
|
||||
if (ch == 'Y')
|
||||
{
|
||||
if (Player.p_gold < blessingcost)
|
||||
++cheat;
|
||||
else
|
||||
@ -435,6 +436,7 @@ bool dishonest = FALSE;/* set when merchant is dishonest */
|
||||
else
|
||||
Player.p_blessing = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -346,11 +346,12 @@ compcombat()
|
||||
hit++;
|
||||
hit += QUAL[index][capship(sp)->specs->qual - 1];
|
||||
for (n = 0; n < 3 && sp->file->captured == 0; n++)
|
||||
if (!crew[n])
|
||||
if (!crew[n]) {
|
||||
if (index <= 5)
|
||||
hit--;
|
||||
else
|
||||
hit -= 2;
|
||||
}
|
||||
if (ready & R_INITIAL) {
|
||||
if (!r)
|
||||
sp->file->readyL &= ~R_INITIAL;
|
||||
@ -361,11 +362,12 @@ compcombat()
|
||||
else
|
||||
hit += 2;
|
||||
}
|
||||
if (sp->file->captured != 0)
|
||||
if (sp->file->captured != 0) {
|
||||
if (index <= 1)
|
||||
hit--;
|
||||
else
|
||||
hit -= 2;
|
||||
}
|
||||
hit += AMMO[index][load - 1];
|
||||
temp = sp->specs->class;
|
||||
if ((temp >= 5 || temp == 1) && windspeed == 5)
|
||||
@ -385,11 +387,12 @@ compcombat()
|
||||
|
||||
next()
|
||||
{
|
||||
if (++turn % 55 == 0)
|
||||
if (++turn % 55 == 0) {
|
||||
if (alive)
|
||||
alive = 0;
|
||||
else
|
||||
people = 0;
|
||||
}
|
||||
if (people <= 0 || windspeed == 7) {
|
||||
register struct ship *s;
|
||||
struct ship *bestship;
|
||||
|
@ -124,11 +124,12 @@ acceptcombat()
|
||||
else if (temp > 8)
|
||||
temp -= 8;
|
||||
sternrake = temp > 4 && temp < 6;
|
||||
if (rakehim)
|
||||
if (rakehim) {
|
||||
if (!sternrake)
|
||||
Signal("Raking the %s!", closest);
|
||||
else
|
||||
Signal("Stern Rake! %s splintering!", closest);
|
||||
}
|
||||
index = guns;
|
||||
if (target < 3)
|
||||
index += car;
|
||||
@ -142,21 +143,24 @@ acceptcombat()
|
||||
hit++;
|
||||
hit += QUAL[index][mc->qual-1];
|
||||
for (n = 0; n < 3 && mf->captured == 0; n++)
|
||||
if (!crew[n])
|
||||
if (!crew[n]) {
|
||||
if (index <= 5)
|
||||
hit--;
|
||||
else
|
||||
hit -= 2;
|
||||
if (ready & R_INITIAL)
|
||||
}
|
||||
if (ready & R_INITIAL) {
|
||||
if (index <= 3)
|
||||
hit++;
|
||||
else
|
||||
hit += 2;
|
||||
if (mf->captured != 0)
|
||||
}
|
||||
if (mf->captured != 0) {
|
||||
if (index <= 1)
|
||||
hit--;
|
||||
else
|
||||
hit -= 2;
|
||||
}
|
||||
hit += AMMO[index][load - 1];
|
||||
if (((temp = mc->class) >= 5 || temp == 1) && windspeed == 5)
|
||||
hit--;
|
||||
|
@ -84,16 +84,18 @@ newturn()
|
||||
movebuf[0] = '\0';
|
||||
|
||||
(void) alarm(0);
|
||||
if (mf->readyL & R_LOADING)
|
||||
if (mf->readyL & R_LOADING) {
|
||||
if (mf->readyL & R_DOUBLE)
|
||||
mf->readyL = R_LOADING;
|
||||
else
|
||||
mf->readyL = R_LOADED;
|
||||
if (mf->readyR & R_LOADING)
|
||||
}
|
||||
if (mf->readyR & R_LOADING) {
|
||||
if (mf->readyR & R_DOUBLE)
|
||||
mf->readyR = R_LOADING;
|
||||
else
|
||||
mf->readyR = R_LOADED;
|
||||
}
|
||||
if (!hasdriver)
|
||||
Write(W_DDEAD, SHIP(0), 0, 0, 0, 0, 0);
|
||||
|
||||
|
@ -264,7 +264,7 @@ sync_update(type, ship, a, b, c, d)
|
||||
}
|
||||
case W_UNFOUL: {
|
||||
register struct snag *p = &ship->file->foul[a];
|
||||
if (p->sn_count > 0)
|
||||
if (p->sn_count > 0) {
|
||||
if (b) {
|
||||
ship->file->nfoul -= p->sn_count;
|
||||
p->sn_count = 0;
|
||||
@ -272,11 +272,12 @@ sync_update(type, ship, a, b, c, d)
|
||||
ship->file->nfoul--;
|
||||
p->sn_count--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case W_UNGRAP: {
|
||||
register struct snag *p = &ship->file->grap[a];
|
||||
if (p->sn_count > 0)
|
||||
if (p->sn_count > 0) {
|
||||
if (b) {
|
||||
ship->file->ngrap -= p->sn_count;
|
||||
p->sn_count = 0;
|
||||
@ -284,14 +285,16 @@ sync_update(type, ship, a, b, c, d)
|
||||
ship->file->ngrap--;
|
||||
p->sn_count--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case W_SIGNAL:
|
||||
if (mode == MODE_PLAYER)
|
||||
if (mode == MODE_PLAYER) {
|
||||
if (nobells)
|
||||
Signal("%s (%c%c): %s", ship, a);
|
||||
else
|
||||
Signal("\7%s (%c%c): %s", ship, a);
|
||||
}
|
||||
break;
|
||||
case W_CREW: {
|
||||
register struct shipspecs *s = ship->specs;
|
||||
|
@ -179,12 +179,14 @@ double speed;
|
||||
Ship.sectx = ix % NSECTS;
|
||||
Ship.secty = iy % NSECTS;
|
||||
if (ix < 0 || Ship.quadx >= NQUADS || iy < 0 || Ship.quady >= NQUADS)
|
||||
{
|
||||
if (!damaged(COMPUTER))
|
||||
{
|
||||
dumpme(0);
|
||||
}
|
||||
else
|
||||
lose(L_NEGENB);
|
||||
}
|
||||
initquad(0);
|
||||
n = 0;
|
||||
break;
|
||||
|
@ -347,7 +347,7 @@ move_to(room_number)
|
||||
wump_kill();
|
||||
return(1);
|
||||
}
|
||||
if (cave[next_room].has_a_pit)
|
||||
if (cave[next_room].has_a_pit) {
|
||||
if (random() % 12 < 2) {
|
||||
pit_survive();
|
||||
return(0);
|
||||
@ -355,6 +355,7 @@ move_to(room_number)
|
||||
pit_kill();
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (cave[next_room].has_a_bat) {
|
||||
(void)printf(
|
||||
@ -389,14 +390,15 @@ shoot(room_list)
|
||||
*/
|
||||
arrow_location = player_loc;
|
||||
for (roomcnt = 1;; ++roomcnt, room_list = NULL) {
|
||||
if (!(p = strtok(room_list, " \t\n")))
|
||||
if (!(p = strtok(room_list, " \t\n"))) {
|
||||
if (roomcnt == 1) {
|
||||
(void)printf(
|
||||
"The arrow falls to the ground at your feet!\n");
|
||||
return(0);
|
||||
} else
|
||||
break;
|
||||
if (roomcnt > 5) {
|
||||
}
|
||||
if (roomcnt > 5) {
|
||||
(void)printf(
|
||||
"The arrow wavers in its flight and and can go no further!\n");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user