OSDN Git Service

[Refactor] #38862 Moved angband.h, h-*.h and system-variables.c/h
[hengband/hengband.git] / src / avatar.c
index dd4d98b..fa6504f 100644 (file)
     included in all such copies.
 */
 
-#include "angband.h"
+#include "system/angband.h"
 #include "avatar.h"
-#include "realm.h"
-#include "player-race.h"
-#include "player-class.h"
+#include "realm/realm.h"
+#include "player/player-race.h"
+#include "player/player-class.h"
 
 /*!
  * 徳の名称 / The names of the virtues
@@ -53,11 +53,11 @@ concptr virtue[MAX_VIRTUE] =
  * @return 比較の真偽値を返す
  * @todo 引数名を直しておく
  */
-bool compare_virtue(int type, int num, int tekitou)
+bool compare_virtue(player_type *creature_ptr, int type, int num, int tekitou)
 {
        int vir;
-       if (virtue_number(type))
-               vir = p_ptr->virtues[virtue_number(type) - 1];
+       if (virtue_number(creature_ptr, type))
+               vir = creature_ptr->virtues[virtue_number(creature_ptr, type) - 1];
        else
                vir = 0;
 
@@ -79,14 +79,14 @@ bool compare_virtue(int type, int num, int tekitou)
  * @param type 確認したい徳のID
  * @return スロットがあるならばスロットのID(0~7)+1、ない場合は0を返す。
  */
-int virtue_number(int type)
+int virtue_number(player_type *creature_ptr, int type)
 {
        int i;
 
        /* Search */
        for (i = 0; i < 8; i++)
        {
-               if (p_ptr->vir_types[i] == type) return i + 1;
+               if (creature_ptr->vir_types[i] == type) return i + 1;
        }
 
        /* No match */
@@ -98,12 +98,12 @@ int virtue_number(int type)
  * @param which 確認したい徳のID
  * @return なし
  */
-static void get_random_virtue(int which)
+static void get_random_virtue(player_type *creature_ptr, int which)
 {
        int type = 0;
 
        /* Randomly choose a type */
-       while (!(type) || virtue_number(type))
+       while (!(type) || virtue_number(creature_ptr, type))
        {
                switch (randint1(29))
                {
@@ -138,7 +138,7 @@ static void get_random_virtue(int which)
        }
 
        /* Chosen */
-       p_ptr->vir_types[which] = (s16b)type;
+       creature_ptr->vir_types[which] = (s16b)type;
 }
 
 /*!
@@ -146,21 +146,21 @@ static void get_random_virtue(int which)
  * @param realm 魔法領域のID
  * @return 対応する徳のID
  */
-static VIRTUES_IDX get_realm_virtues(REALM_IDX realm)
+static VIRTUES_IDX get_realm_virtues(player_type *creature_ptr, REALM_IDX realm)
 {
        switch (realm)
        {
        case REALM_LIFE:
-               if (virtue_number(V_VITALITY)) return V_TEMPERANCE;
+               if (virtue_number(creature_ptr, V_VITALITY)) return V_TEMPERANCE;
                else return V_VITALITY;
        case REALM_SORCERY:
-               if (virtue_number(V_KNOWLEDGE)) return V_ENCHANT;
+               if (virtue_number(creature_ptr, V_KNOWLEDGE)) return V_ENCHANT;
                else return V_KNOWLEDGE;
        case REALM_NATURE:
-               if (virtue_number(V_NATURE)) return V_HARMONY;
+               if (virtue_number(creature_ptr, V_NATURE)) return V_HARMONY;
                else return V_NATURE;
        case REALM_CHAOS:
-               if (virtue_number(V_CHANCE)) return V_INDIVIDUALISM;
+               if (virtue_number(creature_ptr, V_CHANCE)) return V_INDIVIDUALISM;
                else return V_CHANCE;
        case REALM_DEATH:
                return V_UNLIFE;
@@ -169,16 +169,16 @@ static VIRTUES_IDX get_realm_virtues(REALM_IDX realm)
        case REALM_ARCANE:
                return 0;
        case REALM_CRAFT:
-               if (virtue_number(V_ENCHANT)) return V_INDIVIDUALISM;
+               if (virtue_number(creature_ptr, V_ENCHANT)) return V_INDIVIDUALISM;
                else return V_ENCHANT;
        case REALM_DAEMON:
-               if (virtue_number(V_JUSTICE)) return V_FAITH;
+               if (virtue_number(creature_ptr, V_JUSTICE)) return V_FAITH;
                else return V_JUSTICE;
        case REALM_CRUSADE:
-               if (virtue_number(V_JUSTICE)) return V_HONOUR;
+               if (virtue_number(creature_ptr, V_JUSTICE)) return V_HONOUR;
                else return V_JUSTICE;
        case REALM_HEX:
-               if (virtue_number(V_COMPASSION)) return V_JUSTICE;
+               if (virtue_number(creature_ptr, V_COMPASSION)) return V_JUSTICE;
                else return V_COMPASSION;
        };
 
@@ -369,12 +369,12 @@ void get_virtues(player_type *creature_ptr)
        /* Get a virtue for realms */
        if (creature_ptr->realm1)
        {
-               tmp_vir = get_realm_virtues(creature_ptr->realm1);
+               tmp_vir = get_realm_virtues(creature_ptr, creature_ptr->realm1);
                if (tmp_vir) creature_ptr->vir_types[i++] = tmp_vir;
        }
        if (creature_ptr->realm2)
        {
-               tmp_vir = get_realm_virtues(creature_ptr->realm2);
+               tmp_vir = get_realm_virtues(creature_ptr, creature_ptr->realm2);
                if (tmp_vir) creature_ptr->vir_types[i++] = tmp_vir;
        }
 
@@ -391,7 +391,7 @@ void get_virtues(player_type *creature_ptr)
        /* Fill in the blanks */
        for (i = 0; i < 8; i++)
        {
-               if (creature_ptr->vir_types[i] == 0) get_random_virtue(i);
+               if (creature_ptr->vir_types[i] == 0) get_random_virtue(creature_ptr, i);
        }
 }