OSDN Git Service

[Refactor] #3334 FloorType にset/reset/get_dungeon() メソッドを追加した
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 27 May 2023 00:44:12 +0000 (09:44 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Thu, 1 Jun 2023 13:35:30 +0000 (22:35 +0900)
src/system/floor-type-definition.cpp
src/system/floor-type-definition.h

index e247029..f713f1d 100644 (file)
@@ -1,6 +1,22 @@
 #include "system/floor-type-definition.h"
+#include "system/dungeon-info.h"
 
 bool FloorType::is_in_dungeon() const
 {
     return this->dun_level > 0;
 }
+
+void FloorType::set_dungeon_index(short dungeon_idx_)
+{
+    this->dungeon_idx = dungeon_idx_;
+}
+
+void FloorType::reset_dungeon_index()
+{
+    this->set_dungeon_index(0);
+}
+
+dungeon_type &FloorType::get_dungeon_definition() const
+{
+    return dungeons_info[this->dungeon_idx];
+}
index 4cadfe9..d2b3d9a 100644 (file)
@@ -33,13 +33,14 @@ constexpr auto VIEW_MAX = 1536;
  */
 constexpr auto REDRAW_MAX = 2298;
 
+struct dungeon_type;
 struct grid_type;
 class MonsterEntity;
 class ItemEntity;
 class FloorType {
 public:
     FloorType() = default;
-    DUNGEON_IDX dungeon_idx = 0;
+    short dungeon_idx = 0;
     std::vector<std::vector<grid_type>> grid_array;
     DEPTH dun_level = 0; /*!< 現在の実ダンジョン階層 base_level の参照元となる / Current dungeon level */
     DEPTH base_level = 0; /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
@@ -83,4 +84,7 @@ public:
     bool inside_arena = false; /* Is character inside on_defeat_arena_monster? */
 
     bool is_in_dungeon() const;
+    void set_dungeon_index(short dungeon_idx_); /*!< @todo 後でenum class にする */
+    void reset_dungeon_index();
+    dungeon_type &get_dungeon_definition() const;
 };