OSDN Git Service

[Refactor] #2666 AngbandSystem クラスを作成した
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 30 Sep 2023 14:38:26 +0000 (23:38 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sat, 28 Oct 2023 09:31:21 +0000 (18:31 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/system/angband-system.cpp [new file with mode: 0644]
src/system/angband-system.h [new file with mode: 0644]

index 257a008..6f97753 100644 (file)
     <ClCompile Include="..\..\src\save\player-class-specific-data-writer.cpp" />\r
     <ClCompile Include="..\..\src\specific-object\stone-of-lore.cpp" />\r
     <ClCompile Include="..\..\src\spell-class\spells-mirror-master.cpp" />\r
+    <ClCompile Include="..\..\src\system\angband-system.cpp" />\r
     <ClCompile Include="..\..\src\system\redrawing-flags-updater.cpp" />\r
     <ClCompile Include="..\..\src\system\floor-type-definition.cpp" />\r
     <ClCompile Include="..\..\src\system\grid-type-definition.cpp" />\r
     <ClInclude Include="..\..\src\store\service-checker.h" />\r
     <ClInclude Include="..\..\src\system\alloc-entries.h" />\r
     <ClInclude Include="..\..\src\system\angband-exceptions.h" />\r
+    <ClInclude Include="..\..\src\system\angband-system.h" />\r
     <ClInclude Include="..\..\src\system\redrawing-flags-updater.h" />\r
     <ClInclude Include="..\..\src\system\dungeon-data-definition.h" />\r
     <ClInclude Include="..\..\src\system\floor-type-definition.h" />\r
index d25e4fa..30de6d2 100644 (file)
     <ClCompile Include="..\..\src\util\candidate-selector.cpp">\r
       <Filter>util</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\src\system\angband-system.cpp">\r
+      <Filter>system</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\src\combat\shoot.h">\r
     <ClInclude Include="..\..\src\util\candidate-selector.h">\r
       <Filter>util</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\src\system\angband-system.h">\r
+      <Filter>system</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="..\..\src\wall.bmp" />\r
index 56a17f3..7ba0646 100644 (file)
@@ -915,6 +915,7 @@ hengband_SOURCES = \
        system/alloc-entries.cpp system/alloc-entries.h \
        system/angband.h \
        system/angband-exceptions.h \
+       system/angband-system.h system/angband-system.cpp \
        system/angband-version.cpp system/angband-version.h \
        system/artifact-type-definition.cpp system/artifact-type-definition.h \
        system/baseitem-info.cpp system/baseitem-info.h \
diff --git a/src/system/angband-system.cpp b/src/system/angband-system.cpp
new file mode 100644 (file)
index 0000000..ef12cc2
--- /dev/null
@@ -0,0 +1,8 @@
+#include "system/angband-system.h"
+
+AngbandSystem AngbandSystem::instance{};
+
+AngbandSystem &AngbandSystem::get_instance()
+{
+    return instance;
+}
diff --git a/src/system/angband-system.h b/src/system/angband-system.h
new file mode 100644 (file)
index 0000000..234beca
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+class AngbandSystem {
+public:
+    AngbandSystem(const AngbandSystem &) = delete;
+    AngbandSystem(AngbandSystem &&) = delete;
+    AngbandSystem &operator=(const AngbandSystem &) = delete;
+    AngbandSystem &operator=(AngbandSystem &&) = delete;
+
+    static AngbandSystem &get_instance();
+
+private:
+    AngbandSystem() = default;
+
+    static AngbandSystem instance;
+};