From: Hourier Date: Fri, 10 Sep 2021 15:23:09 +0000 (+0900) Subject: [Refactor] #1479 Changed customer_ptr to player_ptr X-Git-Tag: vmacos3.0.0-alpha52~103^2~5^2~12 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c8fc43eb34c90954e947a40909218f99004afcd3;p=hengbandforosx%2Fhengbandosx.git [Refactor] #1479 Changed customer_ptr to player_ptr --- diff --git a/src/cmd-building/cmd-inn.cpp b/src/cmd-building/cmd-inn.cpp index 4c8facaf1..0f476c4b0 100644 --- a/src/cmd-building/cmd-inn.cpp +++ b/src/cmd-building/cmd-inn.cpp @@ -17,29 +17,29 @@ /*! * @brief 宿屋で食事を摂る - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ * @return 満腹ならFALSE、そうでないならTRUE */ -static bool buy_food(player_type *customer_ptr) +static bool buy_food(player_type *player_ptr) { - if (customer_ptr->food >= PY_FOOD_FULL) { + if (player_ptr->food >= PY_FOOD_FULL) { msg_print(_("今は満腹だ。", "You are full now.")); return false; } msg_print(_("バーテンはいくらかの食べ物とビールをくれた。", "The barkeep gives you some gruel and a beer.")); - (void)set_food(customer_ptr, PY_FOOD_MAX - 1); + (void)set_food(player_ptr, PY_FOOD_MAX - 1); return true; } /*! * @brief 健康体しか宿屋に泊めない処理 - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ * @return 毒でも切り傷でもないならTRUE、そうでないならFALSE */ -static bool is_healthy_stay(player_type *customer_ptr) +static bool is_healthy_stay(player_type *player_ptr) { - if (!customer_ptr->poisoned && !customer_ptr->cut) + if (!player_ptr->poisoned && !player_ptr->cut) return true; msg_print(_("あなたに必要なのは部屋ではなく、治療者です。", "You need a healer, not a room.")); @@ -49,27 +49,27 @@ static bool is_healthy_stay(player_type *customer_ptr) } #ifdef JP -static bool is_player_undead(player_type *customer_ptr) +static bool is_player_undead(player_type *player_ptr) { - return player_race_life(customer_ptr, true) == PlayerRaceLife::UNDEAD; + return player_race_life(player_ptr, true) == PlayerRaceLife::UNDEAD; } #endif /*! * @brief 宿屋に泊まったことを日記に残す - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ * @param prev_hour 宿屋に入った直後のゲーム内時刻 */ -static void write_diary_stay_inn(player_type *customer_ptr, int prev_hour) +static void write_diary_stay_inn(player_type *player_ptr, int prev_hour) { if ((prev_hour >= 6) && (prev_hour < 18)) { - concptr stay_message = _(is_player_undead(customer_ptr) ? "宿屋に泊まった。" : "日が暮れるまで宿屋で過ごした。", "stayed during the day at the inn."); - exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, stay_message); + concptr stay_message = _(is_player_undead(player_ptr) ? "宿屋に泊まった。" : "日が暮れるまで宿屋で過ごした。", "stayed during the day at the inn."); + exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, stay_message); return; } - concptr stay_message = _(is_player_undead(customer_ptr) ? "夜が明けるまで宿屋で過ごした。" : "宿屋に泊まった。", "stayed overnight at the inn."); - exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, stay_message); + concptr stay_message = _(is_player_undead(player_ptr) ? "夜が明けるまで宿屋で過ごした。" : "宿屋に泊まった。", "stayed overnight at the inn."); + exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, stay_message); } /*! @@ -90,10 +90,10 @@ static void pass_game_turn_by_stay(void) /*! * @brief 悪夢モードなら悪夢を見せる - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ * @return 悪夢モードならばTRUE */ -static bool has_a_nightmare(player_type *customer_ptr) +static bool has_a_nightmare(player_type *player_ptr) { if (!ironman_nightmare) return false; @@ -101,109 +101,109 @@ static bool has_a_nightmare(player_type *customer_ptr) msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep.")); while (true) { - sanity_blast(customer_ptr, nullptr, false); + sanity_blast(player_ptr, nullptr, false); if (!one_in_(3)) break; } msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming.")); - exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _("悪夢にうなされてよく眠れなかった。", "had a nightmare.")); + exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("悪夢にうなされてよく眠れなかった。", "had a nightmare.")); return true; } /*! * @brief 体調を元に戻す - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ */ -static void back_to_health(player_type *customer_ptr) +static void back_to_health(player_type *player_ptr) { - set_blind(customer_ptr, 0); - set_confused(customer_ptr, 0); - customer_ptr->stun = 0; - customer_ptr->chp = customer_ptr->mhp; - customer_ptr->csp = customer_ptr->msp; + set_blind(player_ptr, 0); + set_confused(player_ptr, 0); + player_ptr->stun = 0; + player_ptr->chp = player_ptr->mhp; + player_ptr->csp = player_ptr->msp; } /*! * @brief 魔力喰いの残り回数回復(本当? 要調査) - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ */ -static void charge_magic_eating_energy(player_type *customer_ptr) +static void charge_magic_eating_energy(player_type *player_ptr) { - if (customer_ptr->pclass != CLASS_MAGIC_EATER) + if (player_ptr->pclass != CLASS_MAGIC_EATER) return; int i; for (i = 0; i < 72; i++) { - customer_ptr->magic_num1[i] = customer_ptr->magic_num2[i] * EATER_CHARGE; + player_ptr->magic_num1[i] = player_ptr->magic_num2[i] * EATER_CHARGE; } for (; i < MAX_SPELLS; i++) { - customer_ptr->magic_num1[i] = 0; + player_ptr->magic_num1[i] = 0; } } /*! * @brief リフレッシュ結果を画面に表示する - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ * @param prev_hour 宿屋に入った直後のゲーム内時刻 */ -static void display_stay_result(player_type *customer_ptr, int prev_hour) +static void display_stay_result(player_type *player_ptr, int prev_hour) { if ((prev_hour >= 6) && (prev_hour < 18)) { #if JP char refresh_message_jp[50]; - sprintf(refresh_message_jp, "%s%s%s", "あなたはリフレッシュして目覚め、", is_player_undead(customer_ptr) ? "夜" : "夕方", "を迎えた。"); + sprintf(refresh_message_jp, "%s%s%s", "あなたはリフレッシュして目覚め、", is_player_undead(player_ptr) ? "夜" : "夕方", "を迎えた。"); msg_print(refresh_message_jp); #else msg_print("You awake refreshed for the evening."); #endif - concptr awake_message = _(is_player_undead(customer_ptr) ? "すがすがしい夜を迎えた。" : "夕方を迎えた。", "awoke refreshed."); - exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, awake_message); + concptr awake_message = _(is_player_undead(player_ptr) ? "すがすがしい夜を迎えた。" : "夕方を迎えた。", "awoke refreshed."); + exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, awake_message); return; } msg_print(_("あなたはリフレッシュして目覚め、新たな日を迎えた。", "You awake refreshed for the new day.")); - concptr awake_message = _(is_player_undead(customer_ptr) ? "すがすがしい朝を迎えた。" : "朝を迎えた。", "awoke refreshed."); - exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, awake_message); + concptr awake_message = _(is_player_undead(player_ptr) ? "すがすがしい朝を迎えた。" : "朝を迎えた。", "awoke refreshed."); + exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, awake_message); } /*! * @brief 宿屋への宿泊実行処理 - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ * @return 泊まれたらTRUE */ -static bool stay_inn(player_type *customer_ptr) +static bool stay_inn(player_type *player_ptr) { - if (!is_healthy_stay(customer_ptr)) + if (!is_healthy_stay(player_ptr)) return false; int prev_day, prev_hour, prev_min; - extract_day_hour_min(customer_ptr, &prev_day, &prev_hour, &prev_min); - write_diary_stay_inn(customer_ptr, prev_hour); + extract_day_hour_min(player_ptr, &prev_day, &prev_hour, &prev_min); + write_diary_stay_inn(player_ptr, prev_hour); pass_game_turn_by_stay(); - prevent_turn_overflow(customer_ptr); + prevent_turn_overflow(player_ptr); if ((prev_hour >= 18) && (prev_hour <= 23)) { - determine_daily_bounty(customer_ptr, false); /* Update daily bounty */ - exe_write_diary(customer_ptr, DIARY_DIALY, 0, nullptr); + determine_daily_bounty(player_ptr, false); /* Update daily bounty */ + exe_write_diary(player_ptr, DIARY_DIALY, 0, nullptr); } - customer_ptr->chp = customer_ptr->mhp; - if (has_a_nightmare(customer_ptr)) + player_ptr->chp = player_ptr->mhp; + if (has_a_nightmare(player_ptr)) return true; - back_to_health(customer_ptr); - charge_magic_eating_energy(customer_ptr); + back_to_health(player_ptr); + charge_magic_eating_energy(player_ptr); - display_stay_result(customer_ptr, prev_hour); + display_stay_result(player_ptr, prev_hour); return true; } /*! * @brief 宿屋を利用する - * @param customer_ptr プレーヤーへの参照ポインタ + * @param player_ptr プレーヤーへの参照ポインタ * @param cmd 宿屋の利用施設ID * @return 施設の利用が実際に行われたらTRUE * @details inn commands @@ -215,15 +215,15 @@ static bool stay_inn(player_type *customer_ptr) * Resting at night is also a quick way to restock stores -KMW- * @todo 悪夢を見る前後に全回復しているが、何か意図がある? */ -bool inn_comm(player_type *customer_ptr, int cmd) +bool inn_comm(player_type *player_ptr, int cmd) { switch (cmd) { case BACT_FOOD: - return buy_food(customer_ptr); + return buy_food(player_ptr); case BACT_REST: - return stay_inn(customer_ptr); + return stay_inn(player_ptr); case BACT_RUMORS: - display_rumor(customer_ptr, true); + display_rumor(player_ptr, true); return true; default: //!< @todo リファクタリング前のコードもTRUEだった、FALSEにすべきでは. diff --git a/src/cmd-building/cmd-inn.h b/src/cmd-building/cmd-inn.h index 9afe9c783..21819d19f 100644 --- a/src/cmd-building/cmd-inn.h +++ b/src/cmd-building/cmd-inn.h @@ -1,4 +1,4 @@ #pragma once struct player_type; -bool inn_comm(player_type *customer_ptr, int cmd); +bool inn_comm(player_type *player_ptr, int cmd); diff --git a/src/market/building-craft-weapon.cpp b/src/market/building-craft-weapon.cpp index 44aadf7f6..f1e94f81e 100644 --- a/src/market/building-craft-weapon.cpp +++ b/src/market/building-craft-weapon.cpp @@ -345,7 +345,7 @@ static void list_weapon(player_type *player_ptr, object_type *o_ptr, TERM_LEN ro * @param bcost 基本鑑定費用 * @return 最終的にかかった費用 */ -PRICE compare_weapons(player_type *customer_ptr, PRICE bcost) +PRICE compare_weapons(player_type *player_ptr, PRICE bcost) { object_type *o_ptr[2]; object_type orig_weapon; @@ -359,14 +359,14 @@ PRICE compare_weapons(player_type *customer_ptr, PRICE bcost) screen_save(); clear_bldg(0, 22); - i_ptr = &customer_ptr->inventory_list[INVEN_MAIN_HAND]; + i_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND]; (&orig_weapon)->copy_from(i_ptr); concptr q = _("第一の武器は?", "What is your first weapon? "); concptr s = _("比べるものがありません。", "You have nothing to compare."); OBJECT_IDX item; - o_ptr[0] = choose_object(customer_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), FuncItemTester(&object_type::is_orthodox_melee_weapons)); + o_ptr[0] = choose_object(player_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), FuncItemTester(&object_type::is_orthodox_melee_weapons)); if (!o_ptr[0]) { screen_load(); return 0; @@ -383,16 +383,16 @@ PRICE compare_weapons(player_type *customer_ptr, PRICE bcost) if (o_ptr[i] != i_ptr) i_ptr->copy_from(o_ptr[i]); - customer_ptr->update |= PU_BONUS; - handle_stuff(customer_ptr); + player_ptr->update |= PU_BONUS; + handle_stuff(player_ptr); - list_weapon(customer_ptr, o_ptr[i], row, col); - compare_weapon_aux(customer_ptr, o_ptr[i], col, row + 8); + list_weapon(player_ptr, o_ptr[i], row, col); + compare_weapon_aux(player_ptr, o_ptr[i], col, row + 8); i_ptr->copy_from(&orig_weapon); } - customer_ptr->update |= PU_BONUS; - handle_stuff(customer_ptr); + player_ptr->update |= PU_BONUS; + handle_stuff(player_ptr); current_world_ptr->character_xtra = old_character_xtra; #ifdef JP @@ -410,7 +410,7 @@ PRICE compare_weapons(player_type *customer_ptr, PRICE bcost) if (ch != 's') break; - if (total + cost > customer_ptr->au) { + if (total + cost > player_ptr->au) { msg_print(_("お金が足りません!", "You don't have enough money!")); msg_print(nullptr); continue; @@ -419,7 +419,7 @@ PRICE compare_weapons(player_type *customer_ptr, PRICE bcost) q = _("第二の武器は?", "What is your second weapon? "); s = _("比べるものがありません。", "You have nothing to compare."); OBJECT_IDX item2; - object_type *i2_ptr = choose_object(customer_ptr, &item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), FuncItemTester(&object_type::is_orthodox_melee_weapons)); + object_type *i2_ptr = choose_object(player_ptr, &item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), FuncItemTester(&object_type::is_orthodox_melee_weapons)); if (!i2_ptr) continue; diff --git a/src/market/building-craft-weapon.h b/src/market/building-craft-weapon.h index e62ed5480..d7c44cde7 100644 --- a/src/market/building-craft-weapon.h +++ b/src/market/building-craft-weapon.h @@ -3,4 +3,4 @@ #include "system/angband.h" struct player_type; -PRICE compare_weapons(player_type *customer_ptr, PRICE bcost); +PRICE compare_weapons(player_type *player_ptr, PRICE bcost);