Skip to content

Commit

Permalink
Merge branch 'develop' into macos-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
backwardsEric committed Nov 3, 2024
2 parents 87adaf9 + 86349d9 commit f0512ce
Show file tree
Hide file tree
Showing 32 changed files with 546 additions and 558 deletions.
3 changes: 2 additions & 1 deletion VisualStudio/Hengband/Hengband.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,7 @@
<ClInclude Include="..\..\src\system\alloc-entries.h" />
<ClInclude Include="..\..\src\system\angband-exceptions.h" />
<ClInclude Include="..\..\src\system\angband-system.h" />
<ClInclude Include="..\..\src\system\enums\grid-flow.h" />
<ClInclude Include="..\..\src\system\inner-game-data.h" />
<ClInclude Include="..\..\src\system\redrawing-flags-updater.h" />
<ClInclude Include="..\..\src\system\dungeon-data-definition.h" />
Expand Down Expand Up @@ -1595,7 +1596,7 @@
<ClInclude Include="..\..\src\object\item-use-flags.h" />
<ClInclude Include="..\..\src\object\object-mark-types.h" />
<ClInclude Include="..\..\src\system\building-type-definition.h" />
<ClInclude Include="..\..\src\system\game-option-types.h" />
<ClInclude Include="..\..\src\system\enums\game-option-page.h" />
<ClInclude Include="..\..\src\system\monster-race-info.h" />
<ClInclude Include="..\..\src\system\item-entity.h" />
<ClInclude Include="..\..\src\object-enchant\old-ego-extra-values.h" />
Expand Down
18 changes: 15 additions & 3 deletions VisualStudio/Hengband/Hengband.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,9 @@
<ClCompile Include="..\..\src\monster\monster-timed-effects.cpp">
<Filter>monster</Filter>
</ClCompile>
<ClCompile Include="..\..\src\save\monster-entity-writer.cpp">
<Filter>save</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\combat\shoot.h">
Expand Down Expand Up @@ -3824,9 +3827,6 @@
<ClInclude Include="..\..\src\monster-floor\monster-summon.h">
<Filter>monster-floor</Filter>
</ClInclude>
<ClInclude Include="..\..\src\system\game-option-types.h">
<Filter>system</Filter>
</ClInclude>
<ClInclude Include="..\..\src\game-option\input-options.h">
<Filter>game-option</Filter>
</ClInclude>
Expand Down Expand Up @@ -5457,6 +5457,15 @@
<ClInclude Include="..\..\src\floor\floor-list.h">
<Filter>floor</Filter>
</ClInclude>
<ClInclude Include="..\..\src\save\monster-entity-writer.h">
<Filter>save</Filter>
</ClInclude>
<ClInclude Include="..\..\src\system\enums\game-option-page.h">
<Filter>system\enums</Filter>
</ClInclude>
<ClInclude Include="..\..\src\system\enums\grid-flow.h">
<Filter>system\enums</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
Expand Down Expand Up @@ -5724,6 +5733,9 @@
<Filter Include="tracking">
<UniqueIdentifier>{a5b8bf13-a675-4500-8b4c-37ea664757eb}</UniqueIdentifier>
</Filter>
<Filter Include="system\enums">
<UniqueIdentifier>{31491e27-d3e4-4605-b68a-c2c00d563479}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\angband.rc" />
Expand Down
4 changes: 3 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,6 @@ hengband_SOURCES = \
system/dungeon-info.cpp system/dungeon-info.h \
system/floor-type-definition.cpp system/floor-type-definition.h \
system/grid-type-definition.cpp system/grid-type-definition.h \
system/game-option-types.h \
system/h-basic.h system/h-config.h \
system/h-system.h system/h-type.h \
system/inner-game-data.cpp system/inner-game-data.h \
Expand All @@ -943,6 +942,9 @@ hengband_SOURCES = \
system/terrain-type-definition.cpp system/terrain-type-definition.h \
system/gamevalue.h \
\
system/enums/game-option-page.h \
system/enums/grid-flow.h \
\
target/grid-selector.cpp target/grid-selector.h \
target/projection-path-calculator.cpp target/projection-path-calculator.h \
target/target-checker.cpp target/target-checker.h \
Expand Down
54 changes: 27 additions & 27 deletions src/birth/auto-roller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
#include "player/player-personality.h"
#include "player/player-sex.h"
#include "player/player-status-table.h"
#include "system/game-option-types.h"
#include "system/enums/game-option-page.h"
#include "system/player-type-definition.h"
#include "term/screen-processor.h"
#include "term/term-color-types.h"
#include "term/z-form.h"
#include "util/int-char-converter.h"
#include <string>
#include <vector>

/*! オートローラの能力値的要求水準 / Autoroll limit */
int16_t stat_limit[6];
Expand All @@ -36,8 +38,8 @@ static int32_t get_autoroller_prob(int *minval)
/* 1 percent of the valid random space (60^6 && 72<sum<87) */
int32_t tot_rand_1p = 320669745;
int i, j, tmp;
int ii[6];
int tval[6];
int ii[6]{};
int tval[6]{};
int tot = 0;

/* success count */
Expand Down Expand Up @@ -328,7 +330,7 @@ bool get_stat_limits(PlayerType *player_ptr)
break;
case '=':
screen_save();
do_cmd_options_aux(player_ptr, OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
do_cmd_options_aux(player_ptr, GameOptionPage::BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
screen_load();
break;
default:
Expand Down Expand Up @@ -365,10 +367,7 @@ void initialize_chara_limit(chara_limit_type *chara_limit_ptr)
*/
bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)
{
#define MAXITEMS 8

concptr itemname[] = { _("年齢", "age"), _("身長(cm)", "height"), _("体重(kg)", "weight"), _("社会的地位", "social class") };

static const std::vector<std::string> item_names = { _("年齢", "age"), _("身長(cm)", "height"), _("体重(kg)", "weight"), _("社会的地位", "social class") };
clear_from(10);
put_str(_("2/4/6/8で項目選択、+/-で値の増減、Enterで次へ", "2/4/6/8 for Select, +/- for Change value, Enter for Goto next"), 11, 10);
put_str(
Expand All @@ -385,9 +384,10 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)

put_str(_("体格/地位の最小値/最大値を設定して下さい。", "Set minimum/maximum attribute."), 10, 10);
put_str(_(" 項 目 最小値 最大値", " Parameter Min Max"), 13, 20);
int mval[MAXITEMS];
int cval[MAXITEMS];
for (int i = 0; i < MAXITEMS; i++) {
constexpr auto max_items = 8;
int mval[max_items]{};
int cval[max_items]{};
for (int i = 0; i < max_items; i++) {
int m;
switch (i) {
case 0: /* Minimum age */
Expand Down Expand Up @@ -445,12 +445,12 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)
mval[4] = lb_to_kg(mval[4]);
mval[5] = lb_to_kg(mval[5]);
#endif
for (auto i = 0; i < MAXITEMS; i++) {
for (auto i = 0; i < max_items; i++) {
cval[i] = mval[i];
}

for (int i = 0; i < 4; i++) {
auto buf = format("%-12s (%3d - %3d)", itemname[i], mval[i * 2], mval[i * 2 + 1]);
auto buf = format("%-12s (%3d - %3d)", item_names[i].data(), mval[i * 2], mval[i * 2 + 1]);
put_str(buf, 14 + i, 20);
for (int j = 0; j < 2; j++) {
buf = format(" %3d", cval[i * 2 + j]);
Expand All @@ -460,17 +460,17 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)

std::string cur;
int cs = 0;
int os = MAXITEMS;
int os = max_items;
while (true) {
if (cs != os) {
constexpr auto accept = _("決定する", "Accept");
if (os == MAXITEMS) {
if (os == max_items) {
c_put_str(TERM_WHITE, accept, 19, 35);
} else {
c_put_str(TERM_WHITE, cur, 14 + os / 2, 45 + 8 * (os % 2));
}

if (cs == MAXITEMS) {
if (cs == max_items) {
c_put_str(TERM_YELLOW, accept, 19, 35);
} else {
cur = format(" %3d", cval[cs]);
Expand All @@ -492,7 +492,7 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)
case ' ':
case '\r':
case '\n':
if (cs == MAXITEMS) {
if (cs == max_items) {
break;
}
cs++;
Expand All @@ -506,11 +506,11 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)
break;
case '2':
case 'j':
if (cs < MAXITEMS) {
if (cs < max_items) {
cs += 2;
}
if (cs > MAXITEMS) {
cs = MAXITEMS;
if (cs > max_items) {
cs = max_items;
}
break;
case '4':
Expand All @@ -521,13 +521,13 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)
break;
case '6':
case 'l':
if (cs < MAXITEMS) {
if (cs < max_items) {
cs++;
}
break;
case '-':
case '<':
if (cs != MAXITEMS) {
if (cs != max_items) {
if (cs % 2) {
if (cval[cs] > cval[cs - 1]) {
cval[cs]--;
Expand All @@ -544,7 +544,7 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)
break;
case '+':
case '>':
if (cs != MAXITEMS) {
if (cs != max_items) {
if (cs % 2) {
if (cval[cs] < mval[cs]) {
cval[cs]++;
Expand All @@ -560,7 +560,7 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)

break;
case 'm':
if (cs != MAXITEMS) {
if (cs != max_items) {
if (cs % 2) {
if (cval[cs] < mval[cs]) {
cval[cs] = mval[cs];
Expand All @@ -576,7 +576,7 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)

break;
case 'n':
if (cs != MAXITEMS) {
if (cs != max_items) {
if (cs % 2) {
if (cval[cs] > cval[cs - 1]) {
cval[cs] = cval[cs - 1];
Expand All @@ -600,15 +600,15 @@ bool get_chara_limits(PlayerType *player_ptr, chara_limit_type *chara_limit_ptr)
break;
case '=':
screen_save();
do_cmd_options_aux(player_ptr, OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
do_cmd_options_aux(player_ptr, GameOptionPage::BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
screen_load();
break;
default:
bell();
break;
}

if (c == ESCAPE || ((c == ' ' || c == '\r' || c == '\n') && cs == MAXITEMS)) {
if (c == ESCAPE || ((c == ' ' || c == '\r' || c == '\n') && cs == max_items)) {
break;
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/birth/birth-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#include "cmd-io/cmd-gameoption.h"
#include "core/show-file.h"
#include "main/sound-of-music.h"
#include "system/game-option-types.h"
#include "system/enums/game-option-page.h"
#include "system/player-type-definition.h"
#include "term/screen-processor.h"
#include <string>

/*!
* @brief プレイヤー作成を中断して変愚蛮怒を終了する
Expand All @@ -19,7 +20,7 @@ void birth_quit(void)
* @param player_ptr プレイヤーへの参照ポインタ
* @param helpfile ファイル名
*/
void show_help(PlayerType *player_ptr, concptr helpfile)
void show_help(PlayerType *player_ptr, std::string_view helpfile)
{
screen_save();
FileDisplayer(player_ptr->name).display(true, helpfile, 0, 0);
Expand All @@ -28,7 +29,7 @@ void show_help(PlayerType *player_ptr, concptr helpfile)

void birth_help_option(PlayerType *player_ptr, char c, BirthKind bk)
{
concptr help_file;
std::string help_file;
switch (bk) {
case BirthKind::RACE:
help_file = _("jraceclas.txt#TheRaces", "raceclas.txt#TheRaces");
Expand All @@ -54,7 +55,7 @@ void birth_help_option(PlayerType *player_ptr, char c, BirthKind bk)
show_help(player_ptr, help_file);
} else if (c == '=') {
screen_save();
do_cmd_options_aux(player_ptr, OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
do_cmd_options_aux(player_ptr, GameOptionPage::BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
screen_load();
} else if (c != '2' && c != '4' && c != '6' && c != '8') {
bell();
Expand Down
4 changes: 2 additions & 2 deletions src/birth/birth-util.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "system/angband.h"
#include <string_view>

enum class BirthKind {
REALM,
Expand All @@ -12,5 +12,5 @@ enum class BirthKind {

class PlayerType;
void birth_quit();
void show_help(PlayerType *player_ptr, concptr helpfile);
void show_help(PlayerType *player_ptr, std::string_view helpfile);
void birth_help_option(PlayerType *player_ptr, char c, BirthKind bk);
26 changes: 11 additions & 15 deletions src/birth/birth-wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "player/player-status-table.h"
#include "player/player-status.h"
#include "player/process-name.h"
#include "system/game-option-types.h"
#include "system/enums/game-option-page.h"
#include "system/player-type-definition.h"
#include "system/redrawing-flags-updater.h"
#include "term/screen-processor.h"
Expand All @@ -47,16 +47,6 @@
#include "world/world.h"
#include <sstream>

/*!
* オートローラーの内容を描画する間隔 /
* How often the autoroller will update the display and pause
* to check for user interuptions.
* Bigger values will make the autoroller faster, but slower
* system may have problems because the user can't stop the
* autoroller for this number of rolls.
*/
#define AUTOROLLER_STEP 54321L

static void display_initial_birth_message(PlayerType *player_ptr)
{
term_clear();
Expand All @@ -80,7 +70,7 @@ static void display_help_on_sex_select(PlayerType *player_ptr, char c)
do_cmd_help(player_ptr);
} else if (c == '=') {
screen_save();
do_cmd_options_aux(player_ptr, OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
do_cmd_options_aux(player_ptr, GameOptionPage::BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
screen_load();
} else if (c != '4' && c != '6') {
bell();
Expand Down Expand Up @@ -273,7 +263,7 @@ static bool let_player_build_character(PlayerType *player_ptr)
static void display_initial_options(PlayerType *player_ptr)
{
const auto expfact_mod = static_cast<int>(get_expfact(player_ptr)) - 100;
int16_t adj[A_MAX];
int16_t adj[A_MAX]{};
for (int i = 0; i < A_MAX; i++) {
adj[i] = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
}
Expand Down Expand Up @@ -303,7 +293,7 @@ static void display_initial_options(PlayerType *player_ptr)

clear_from(10);
screen_save();
do_cmd_options_aux(player_ptr, OPT_PAGE_BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
do_cmd_options_aux(player_ptr, GameOptionPage::BIRTH, _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
screen_load();
}

Expand Down Expand Up @@ -399,7 +389,13 @@ static bool decide_body_spec(PlayerType *player_ptr, chara_limit_type chara_limi

static bool display_auto_roller_count(PlayerType *player_ptr, const int col)
{
if ((auto_round % AUTOROLLER_STEP) != 0) {
/*!
* @details ここで指定された回数だけロールする度にその時の結果を画面に表示する
* @todo この定数を定義した時代に比べて、CPUパワーが相当に上がっている.
* 表示部で足を引っ張っているので、タイマで数えて0.1秒/表示 くらいで良いと思われる.
*/
constexpr auto roll_results_per_display = 54321;
if ((auto_round % roll_results_per_display) != 0) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/birth/character-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void write_birth_diary(PlayerType *player_ptr)
}

if (player_ptr->element) {
const auto mes_element = format(_("%s元素系統に%sを選択した。", "%schose %s system."), indent, get_element_title(player_ptr->element));
const auto mes_element = format(_("%s元素系統に%sを選択した。", "%schose %s system."), indent, get_element_title(player_ptr->element).data());
exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, mes_element);
}

Expand Down
Loading

0 comments on commit f0512ce

Please sign in to comment.