OSDN Git Service

hook関数 monster_* を mon_hook_* と改名。これらはstatic関数にした。
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 31 Aug 2003 21:04:19 +0000 (21:04 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 31 Aug 2003 21:04:19 +0000 (21:04 +0000)
mon_hook_floorを追加。ペット召喚で床の上に水棲モンスターを
召喚しようとして失敗する事がないようにした。

src/birth.c
src/bldg.c
src/externs.h
src/monster1.c
src/monster2.c
src/rooms.c

index e1df134..126bd8b 100644 (file)
@@ -3357,6 +3357,29 @@ static void player_wipe(void)
 
 
 /*
+ *  Hook function for quest monsters
+ */
+static bool mon_hook_quest(int r_idx)
+{
+       monster_race *r_ptr = &r_info[r_idx];
+
+       /* Random quests are in the dungeon */
+       if (r_ptr->flags8 & RF8_WILD_ONLY) return FALSE;
+
+       /* No random quests for aquatic monsters */
+       if (r_ptr->flags7 & RF7_AQUATIC) return FALSE;
+
+       /* No random quests for multiplying monsters */
+       if (r_ptr->flags2 & RF2_MULTIPLY) return FALSE;
+
+       /* No quests to kill friendly monsters */
+       if (r_ptr->flags7 & RF7_FRIENDLY) return FALSE;
+
+       return TRUE;
+}
+
+
+/*
  * Determine the random quest uniques
  */
 void determine_random_questor(quest_type *q_ptr)
@@ -3365,7 +3388,7 @@ void determine_random_questor(quest_type *q_ptr)
        monster_race *r_ptr;
 
        /* Prepare allocation table */
-       get_mon_num_prep(monster_quest, NULL);
+       get_mon_num_prep(mon_hook_quest, NULL);
 
        while (1)
        {
index 26b2ec3..487e4f7 100644 (file)
@@ -1672,7 +1672,7 @@ static bool vault_aux_battle(int r_idx)
        monster_race *r_ptr = &r_info[r_idx];
 
        /* Decline town monsters */
-/*     if (!monster_dungeon(r_idx)) return FALSE; */
+/*     if (!mon_hook_dungeon(r_idx)) return FALSE; */
 
        /* Decline unique monsters */
 /*     if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */
index 79f6612..ed9e82a 100644 (file)
@@ -811,19 +811,8 @@ extern void screen_roff(int r_idx, int mode);
 extern void display_roff(int r_idx);
 extern void output_monster_spoiler(int r_idx, void (*roff_func)(byte attr, cptr str));
 extern void create_name(int type, char *name);
-/* monster1.c (was in monster3.c ??) */
-extern bool monster_quest(int r_idx);
-extern bool monster_dungeon(int r_idx);
-extern bool monster_ocean(int r_idx);
-extern bool monster_shore(int r_idx);
-extern bool monster_town(int r_idx);
-extern bool monster_wood(int r_idx);
-extern bool monster_volcano(int r_idx);
-extern bool monster_mountain(int r_idx);
-extern bool monster_grass(int r_idx);
-extern bool monster_deep_water(int r_idx);
-extern bool monster_shallow_water(int r_idx);
-extern bool monster_lava(int r_idx);
+extern bool mon_hook_dungeon(int r_idx);
+
 extern monster_hook_type get_monster_hook(void);
 extern monster_hook_type get_monster_hook2(int y, int x);
 extern void set_friendly(monster_type *m_ptr);
index cb57e0b..78081ab 100644 (file)
@@ -3188,27 +3188,7 @@ void output_monster_spoiler(int r_idx, void (*roff_func)(byte attr, cptr str))
 }
 
 
-bool monster_quest(int r_idx)
-{
-       monster_race *r_ptr = &r_info[r_idx];
-
-       /* Random quests are in the dungeon */
-       if (r_ptr->flags8 & RF8_WILD_ONLY) return FALSE;
-
-       /* No random quests for aquatic monsters */
-       if (r_ptr->flags7 & RF7_AQUATIC) return FALSE;
-
-       /* No random quests for multiplying monsters */
-       if (r_ptr->flags2 & RF2_MULTIPLY) return FALSE;
-
-       /* No quests to kill friendly monsters */
-       if (r_ptr->flags7 & RF7_FRIENDLY) return FALSE;
-
-       return TRUE;
-}
-
-
-bool monster_dungeon(int r_idx)
+bool mon_hook_dungeon(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3224,7 +3204,7 @@ bool monster_dungeon(int r_idx)
 }
 
 
-bool monster_ocean(int r_idx)
+static bool mon_hook_ocean(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3235,7 +3215,7 @@ bool monster_ocean(int r_idx)
 }
 
 
-bool monster_shore(int r_idx)
+static bool mon_hook_shore(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3246,7 +3226,7 @@ bool monster_shore(int r_idx)
 }
 
 
-static bool monster_waste(int r_idx)
+static bool mon_hook_waste(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3257,7 +3237,7 @@ static bool monster_waste(int r_idx)
 }
 
 
-bool monster_town(int r_idx)
+static bool mon_hook_town(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3268,7 +3248,7 @@ bool monster_town(int r_idx)
 }
 
 
-bool monster_wood(int r_idx)
+static bool mon_hook_wood(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3279,7 +3259,7 @@ bool monster_wood(int r_idx)
 }
 
 
-bool monster_volcano(int r_idx)
+static bool mon_hook_volcano(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3290,7 +3270,7 @@ bool monster_volcano(int r_idx)
 }
 
 
-bool monster_mountain(int r_idx)
+static bool mon_hook_mountain(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3301,7 +3281,7 @@ bool monster_mountain(int r_idx)
 }
 
 
-bool monster_grass(int r_idx)
+static bool mon_hook_grass(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3312,11 +3292,11 @@ bool monster_grass(int r_idx)
 }
 
 
-bool monster_deep_water(int r_idx)
+static bool mon_hook_deep_water(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       if (!monster_dungeon(r_idx)) return FALSE;
+       if (!mon_hook_dungeon(r_idx)) return FALSE;
 
        if (r_ptr->flags7 & RF7_AQUATIC)
                return TRUE;
@@ -3325,11 +3305,11 @@ bool monster_deep_water(int r_idx)
 }
 
 
-bool monster_shallow_water(int r_idx)
+static bool mon_hook_shallow_water(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       if (!monster_dungeon(r_idx)) return FALSE;
+       if (!mon_hook_dungeon(r_idx)) return FALSE;
 
        if (r_ptr->flags2 & RF2_AURA_FIRE)
                return FALSE;
@@ -3338,11 +3318,11 @@ bool monster_shallow_water(int r_idx)
 }
 
 
-bool monster_lava(int r_idx)
+static bool mon_hook_lava(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       if (!monster_dungeon(r_idx)) return FALSE;
+       if (!mon_hook_dungeon(r_idx)) return FALSE;
 
        if (((r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK) ||
             (r_ptr->flags7 & RF7_CAN_FLY)) &&
@@ -3353,6 +3333,20 @@ bool monster_lava(int r_idx)
 }
 
 
+static bool mon_hook_floor(int r_idx)
+{
+       monster_race *r_ptr = &r_info[r_idx];
+
+       if (!mon_hook_dungeon(r_idx)) return FALSE;
+
+       if (!(r_ptr->flags7 & RF7_AQUATIC) ||
+           (r_ptr->flags7 & RF7_CAN_FLY))
+               return TRUE;
+       else
+               return FALSE;
+}
+
+
 monster_hook_type get_monster_hook(void)
 {
        if (!dun_level && !p_ptr->inside_quest)
@@ -3360,31 +3354,31 @@ monster_hook_type get_monster_hook(void)
                switch (wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].terrain)
                {
                case TERRAIN_TOWN:
-                       return (monster_hook_type)monster_town;
+                       return (monster_hook_type)mon_hook_town;
                case TERRAIN_DEEP_WATER:
-                       return (monster_hook_type)monster_ocean;
+                       return (monster_hook_type)mon_hook_ocean;
                case TERRAIN_SHALLOW_WATER:
                case TERRAIN_SWAMP:
-                       return (monster_hook_type)monster_shore;
+                       return (monster_hook_type)mon_hook_shore;
                case TERRAIN_DIRT:
                case TERRAIN_DESERT:
-                       return (monster_hook_type)monster_waste;
+                       return (monster_hook_type)mon_hook_waste;
                case TERRAIN_GRASS:
-                       return (monster_hook_type)monster_grass;
+                       return (monster_hook_type)mon_hook_grass;
                case TERRAIN_TREES:
-                       return (monster_hook_type)monster_wood;
+                       return (monster_hook_type)mon_hook_wood;
                case TERRAIN_SHALLOW_LAVA:
                case TERRAIN_DEEP_LAVA:
-                       return (monster_hook_type)monster_volcano;
+                       return (monster_hook_type)mon_hook_volcano;
                case TERRAIN_MOUNTAIN:
-                       return (monster_hook_type)monster_mountain;
+                       return (monster_hook_type)mon_hook_mountain;
                default:
-                       return (monster_hook_type)monster_dungeon;
+                       return (monster_hook_type)mon_hook_dungeon;
                }
        }
        else
        {
-               return (monster_hook_type)monster_dungeon;
+               return (monster_hook_type)mon_hook_dungeon;
        }
 }
 
@@ -3395,14 +3389,14 @@ monster_hook_type get_monster_hook2(int y, int x)
        switch (cave[y][x].feat)
        {
        case FEAT_SHAL_WATER:
-               return (monster_hook_type)monster_shallow_water;
+               return (monster_hook_type)mon_hook_shallow_water;
        case FEAT_DEEP_WATER:
-               return (monster_hook_type)monster_deep_water;
+               return (monster_hook_type)mon_hook_deep_water;
        case FEAT_DEEP_LAVA:
        case FEAT_SHAL_LAVA:
-               return (monster_hook_type)monster_lava;
+               return (monster_hook_type)mon_hook_lava;
        default:
-               return NULL;
+               return (monster_hook_type)mon_hook_floor;
        }
 }
 
index 9bba056..d5c9f75 100644 (file)
@@ -3590,7 +3590,7 @@ static bool place_monster_okay(int r_idx)
        monster_race *z_ptr = &r_info[r_idx];
 
        /* Hack - Escorts have to have the same dungeon flag */
-       if (monster_dungeon(place_monster_idx) != monster_dungeon(r_idx)) return (FALSE);
+       if (mon_hook_dungeon(place_monster_idx) != mon_hook_dungeon(r_idx)) return (FALSE);
 
        /* Require similar "race" */
        if (z_ptr->d_char != r_ptr->d_char) return (FALSE);
@@ -3927,7 +3927,7 @@ static bool summon_specific_okay(int r_idx)
        monster_race *r_ptr = &r_info[r_idx];
 
        /* Hack - Only summon dungeon monsters */
-       if (!monster_dungeon(r_idx)) return (FALSE);
+       if (!mon_hook_dungeon(r_idx)) return (FALSE);
 
        /* Hack -- identify the summoning monster */
        if (summon_specific_who > 0)
index 43c47ce..05e389c 100644 (file)
@@ -1274,7 +1274,7 @@ static bool build_type4(void)
  * Line 3 -- forbid aquatic monsters
  */
 #define vault_monster_okay(I) \
-       (monster_dungeon(I) && \
+       (mon_hook_dungeon(I) && \
         !(r_info[I].flags1 & RF1_UNIQUE) && \
         !(r_info[I].flags7 & RF7_UNIQUE2) && \
         !(r_info[I].flagsr & RFR_RES_ALL) && \