case '\n':
case '\r':
- case KTRL('s'):
- if (*o_handle)
- return (back ? -1 : 1);
+ case KTRL('s'): {
+ byte ret = back ? -1 : 1;
+ if (*o_handle) {
+ return ret;
+ }
+
string_free(*search_strp);
*search_strp = string_make(buf);
*o_handle = nullptr;
- return (back ? -1 : 1);
-
+ return ret;
+ }
case KTRL('i'):
return get_object_for_search(player_ptr, o_handle, search_strp);
*/
inline bool is_greater_autopick_max_line(int count)
{
- return (count > MAX_LINES - 3);
+ return count > MAX_LINES - 3;
}
return REALM_SELECT_CANCEL;
clear_from(10);
- return (byte)(birth_realm_ptr->picks[birth_realm_ptr->k]);
+ return static_cast<byte>(birth_realm_ptr->picks[birth_realm_ptr->k]);
}
static void cleanup_realm_selection_window(void)
/* Spell is learned */
if ((use_realm == player_ptr->realm2) ? (player_ptr->spell_learned2 & (1UL << spell)) : (player_ptr->spell_learned1 & (1UL << spell))) {
/* Always true */
- return (!study_pray);
+ return !study_pray;
}
/* Okay to study, not to cast */
- return (!learned);
+ return !learned;
}
/*!
if (!streq(macro__pat[i], pat))
continue;
- return (i);
+ return i;
}
return -1;
if (!prefix(macro__pat[i], pat))
continue;
- return (i);
+ return i;
}
return -1;
if (streq(macro__pat[i], pat))
continue;
- return (i);
+ return i;
}
return -1;
s = t;
}
- return (n);
+ return n;
}
/*
if (stun && one_in_(2))
return false;
if (k < 10)
- return (k < 5);
+ return k < 5;
int i = (power + (level * 3));
int ac = player_ptr->ac + player_ptr->to_a;
if (stun && one_in_(2))
return false;
if (k < 10)
- return (k < 5);
+ return k < 5;
int i = (power + (level * 3));
if ((i > 0) && (randint1(i) > ((ac * 3) / 4)))
mult = calc_snipe_damage_with_slay(player_ptr, mult, monster_ptr, snipe_type);
/* Return the total damage */
- return (tdam * mult / 10);
+ return tdam * mult / 10;
}
/*!
}
}
- return (dam);
+ return dam;
}
/*!
}
}
- return (energy);
+ return energy;
}
/*
}
}
- return (tmul);
+ return tmul;
}
/*!
if (mult > 150)
mult = 150;
- return (tdam * mult / 10);
+ return tdam * mult / 10;
}
AttributeFlags melee_attribute(PlayerType *player_ptr, ObjectType *o_ptr, combat_options mode)
prt(prompt, 0, 0);
res = askfor(buf, len);
prt("", 0, 0);
- return (res);
+ return res;
}
/*
if (amt > max)
amt = max;
- return (amt);
+ return amt;
}
COMMAND_CODE code;
if (amt < 0)
amt = 0;
- return (amt);
+ return amt;
}
if (!prompt) {
if (amt)
repeat_push((COMMAND_CODE)amt);
- return (amt);
+ return amt;
}
/*
*/
int highscore_seek(int i)
{
- return (fd_seek(highscore_fd, (ulong)(i) * sizeof(high_score)));
+ return fd_seek(highscore_fd, (ulong)(i) * sizeof(high_score));
}
/*!
*/
errr highscore_read(high_score *score)
{
- return (fd_read(highscore_fd, (char *)(score), sizeof(high_score)));
+ return fd_read(highscore_fd, (char *)(score), sizeof(high_score));
}
static int highscore_write(high_score *score)
{
/* Write the record, note failure */
- return (fd_write(highscore_fd, (char *)(score), sizeof(high_score)));
+ return fd_write(highscore_fd, (char *)(score), sizeof(high_score));
}
/*!
for (int i = 0; i < MAX_HISCORES; i++) {
int old_score;
if (highscore_read(&the_score))
- return (i);
+ return i;
old_score = atoi(the_score.pts);
if (my_score > old_score)
- return (i);
+ return i;
}
/* The "last" entry is always usable */
}
angband_fclose(fff);
- return (skey != 'q');
+ return skey != 'q';
}
/*
{
auto *floor_ptr = player_ptr->current_floor_ptr;
if (inside_quest(floor_ptr->quest_number))
- return (floor_ptr->quest_number);
+ return floor_ptr->quest_number;
for (int16_t i = 0; i < max_q_idx; i++) {
if (quest[i].status != QuestStatusType::TAKEN)
}
lite_spot(player_ptr, y, x);
- return (obvious);
+ return obvious;
}
case AttributeType::CAPTURE:
return effect_monster_capture(player_ptr, em_ptr);
case AttributeType::ATTACK:
- return (process_result)do_cmd_attack(player_ptr, em_ptr->y, em_ptr->x, i2enum<combat_options>(em_ptr->dam));
+ return do_cmd_attack(player_ptr, em_ptr->y, em_ptr->x, i2enum<combat_options>(em_ptr->dam)) ? PROCESS_TRUE : PROCESS_FALSE;
case AttributeType::ENGETSU:
return effect_monster_engetsu(player_ptr, em_ptr);
case AttributeType::GENOCIDE:
parse_error_type parse_line_wilderness(PlayerType *player_ptr, char *buf, int xmin, int xmax, int *y, int *x)
{
if (!(buf[0] == 'W'))
- return (PARSE_ERROR_GENERIC);
+ return PARSE_ERROR_GENERIC;
int num;
char *zz[33];
w_letter[index].name[0] = 0;
} else {
/* Failure */
- return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
+ return PARSE_ERROR_TOO_FEW_ARGUMENTS;
}
break;
if (d == 5)
d = 0;
- return (d);
+ return d;
}
*/
bool no_lite(PlayerType *player_ptr)
{
- return (!player_can_see_bold(player_ptr, player_ptr->y, player_ptr->x));
+ return !player_can_see_bold(player_ptr, player_ptr->y, player_ptr->x);
}
/*
/* Hack -- 5% hit, 5% miss */
if (k < 10)
- return (k < 5);
+ return k < 5;
if (player_ptr->ppersonality == PERSONALITY_LAZY)
if (one_in_(20))
buf[n] = '\0';
/* Return length */
- return (n);
+ return n;
}
/*
/* Refuse to divide by zero */
if (!d)
- return (n);
+ return n;
/* Division */
tmp = n / d;
n++;
} while (0 != (x = x&(x - 1)));
- return (n);
+ return n;
}
/*!
if (path_parse(buf, 1024, file))
return nullptr;
- return (fopen(buf, mode));
+ return fopen(buf, mode);
}
/*
if (fd < 0)
return nullptr;
- return (fdopen(fd, "w"));
+ return fdopen(fd, "w");
}
#else /* HAVE_MKSTEMP */
FILE *angband_fopen_temp(char *buf, int max)