1 #include "birth/history-generator.h"
2 #include "birth/history.h"
3 #include "player/player-race-types.h"
4 #include "util/buffer-shaper.h"
6 static int get_history_chart(player_type *creature_ptr)
8 switch (creature_ptr->prace) {
50 case RACE_MIND_FLAYER:
88 * @brief 生い立ちを画面に表示しつつ、種族から社会的地位を決定する
89 * @param creature_ptr プレーヤーへの参照ポインタ
90 * @param buf 生い立ち情報のバッファ
92 * @details 画面表示と社会的地位の決定が密結合していて分離できない
94 static void decide_social_class(player_type *creature_ptr, char *buf)
96 int social_class = randint1(4);
97 int chart = get_history_chart(creature_ptr);
100 int roll = randint1(100);
101 while ((chart != bg[i].chart) || (roll > bg[i].roll)) {
105 (void)strcat(buf, bg[i].info);
106 social_class += (int)(bg[i].bonus) - 50;
110 if (social_class > 100)
112 else if (social_class < 1)
115 creature_ptr->sc = (s16b)social_class;
119 * @brief プレイヤーの生い立ちの自動生成を行う。 / Get the racial history, and social class, using the "history charts".
122 void get_history(player_type *creature_ptr)
124 for (int i = 0; i < 4; i++)
125 creature_ptr->history[i][0] = '\0';
129 decide_social_class(creature_ptr, buf);
133 for (s = buf; *s == ' '; s++)
137 while ((n > 0) && (s[n - 1] == ' '))
142 shape_buffer(s, 60, temp, sizeof(temp));
145 for (int i = 0; i < 4; i++) {
149 strcpy(creature_ptr->history[i], t);