Skip to content

Commit

Permalink
add include
Browse files Browse the repository at this point in the history
  • Loading branch information
AsPJT committed Dec 28, 2018
1 parent e3ded57 commit fb476e8
Show file tree
Hide file tree
Showing 22 changed files with 134 additions and 26 deletions.
21 changes: 21 additions & 0 deletions include/c99/DTL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY_C99
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_C99
//:::::----------::::::::::----------::::://
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://


#include "DungeonBinarization.h"
#include "DungeonNoise.h"
#include "DungeonOutput.h"
#include "DungeonRandom.h"
#include "DungeonStandard.h"

#include "FractalIsland.h"
#include "MazeDig.h"
#include "SimpleRogueLike.h"

#endif //Included Dungeon Template Library
1 change: 1 addition & 0 deletions include/c99/DungeonBinarization.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

//2値化処理
Expand Down
1 change: 1 addition & 0 deletions include/c99/DungeonNoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include "DungeonRandom.h"
Expand Down
1 change: 1 addition & 0 deletions include/c99/DungeonOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <stddef.h>
Expand Down
1 change: 1 addition & 0 deletions include/c99/DungeonRandom.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <stddef.h>
Expand Down
1 change: 1 addition & 0 deletions include/c99/DungeonStandard.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

//全てのマスを0で埋める
Expand Down
1 change: 1 addition & 0 deletions include/c99/FractalIsland.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions include/c99/MazeDig.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions include/c99/SimpleRogueLike.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions include/c99/SimpleVoronoiIsland.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <stdlib.h>
Expand Down
24 changes: 24 additions & 0 deletions include/cpp14/DTL.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY
//:::::----------::::::::::----------::::://
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://


#include "DungeonBinarization.hpp"
#include "DungeonNoise.hpp"
#include "DungeonOutput.hpp"
#include "DungeonRandom.hpp"
#include "DungeonStandard.hpp"

#include "FractalIsland.hpp"
#include "MazeDig.hpp"
#include "RogueLike.hpp"
#include "SimpleRogueLike.hpp"
#include "SimpleTerrain1.hpp"
#include "SimpleVoronoiIsland.hpp"

#endif //Included Dungeon Template Library
1 change: 1 addition & 0 deletions include/cpp14/DungeonBinarization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>
Expand Down
1 change: 1 addition & 0 deletions include/cpp14/DungeonNoise.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>
Expand Down
1 change: 1 addition & 0 deletions include/cpp14/DungeonOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>
Expand Down
1 change: 1 addition & 0 deletions include/cpp14/DungeonRandom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstdint>
Expand Down
16 changes: 9 additions & 7 deletions include/cpp14/DungeonStandard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,36 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>

//Dungeon Template Library Namespace
namespace dtl {

//全てのマスを0で埋める
template<typename STL_>
constexpr void dungeonInit(STL_& stl_) noexcept {
for (std::size_t i{}; i < stl_.size(); ++i)
for (std::size_t j{}; j < stl_[i].size(); ++j)
j = 0;
stl_[i][j] = 0;
}

//全てのマスを指定した数値で埋める
template<typename Int_, typename STL_>
constexpr void dungeonInit(STL_& stl_, const Int_ value_) noexcept {
for (std::size_t i{}; i < stl_.size(); ++i)
for (std::size_t j{}; j < stl_[i].size(); ++j)
j = value_;
stl_[i][j] = value_;
}

//全てのマスを0で埋める
template<typename STL_>
constexpr void dungeonInit_RangeBasedFor(STL_& stl_) noexcept {
for (auto&& i : stl_)
for (auto&& j : i)
j = 0;
}

//全てのマスを指定した数値で埋める
template<typename Int_, typename STL_>
constexpr void dungeonInit_RangeBasedFor(STL_& stl_, const Int_ value_) noexcept {
for (auto&& i : stl_)
Expand All @@ -49,10 +51,10 @@ namespace dtl {
return true;
}

//
//値が全て一致しているか確認する
template<typename STL_>
constexpr bool dungeonArrayCheck(const STL_& stl_) noexcept {
if (stl_.size()==0 || stl_.front().size()==0) return false;
if (stl_.size() == 0 || stl_.front().size() == 0) return false;
const auto& stl_value{ stl_.front().front() };
for (std::size_t i{}; i < stl_.size(); ++i)
for (std::size_t j{}; j < stl_[i].size(); ++j)
Expand Down
6 changes: 4 additions & 2 deletions include/cpp14/FractalIsland.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>
Expand All @@ -17,9 +18,10 @@ namespace dtl {
template<typename Int_>
class FractalIsland {
public:
FractalIsland() = default;
//コンストラクタ
constexpr FractalIsland() noexcept = default;
template<typename STL_>
constexpr explicit FractalIsland(STL_& world_map, std::size_t seed_ = 0, const std::int_fast32_t max_value_ = 255) {
constexpr explicit FractalIsland(STL_& world_map, std::size_t seed_ = 0, const std::int_fast32_t max_value_ = 255) noexcept {
create(world_map, seed_, max_value_);
}
//ワールドマップ生成
Expand Down
10 changes: 6 additions & 4 deletions include/cpp14/MazeDig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>
Expand All @@ -22,17 +23,18 @@ namespace dtl {
template<typename Int_>
class MazeDig {
public:
MazeDig() = default;
//コンストラクタ
constexpr MazeDig() noexcept = default;
template<typename STL_>
constexpr explicit MazeDig(STL_& data, const Int_ v1_, const Int_ v2_) {
constexpr explicit MazeDig(STL_& data, const Int_ v1_, const Int_ v2_) noexcept {
mazeDig_Create(data, v1_, v2_);
}
template<typename STL_>
constexpr explicit MazeDig(STL_& data, const Int_ v1_) {
constexpr explicit MazeDig(STL_& data, const Int_ v1_) noexcept {
mazeDig_Create(data, v1_, static_cast<Int_>(maze_dig_type_way));
}
template<typename STL_>
constexpr explicit MazeDig(STL_& data) {
constexpr explicit MazeDig(STL_& data) noexcept {
mazeDig_Create(data, static_cast<Int_>(maze_dig_type_wall), static_cast<Int_>(maze_dig_type_way));
}
private:
Expand Down
5 changes: 3 additions & 2 deletions include/cpp14/RogueLike.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>
Expand Down Expand Up @@ -42,9 +43,9 @@ namespace dtl {
class RogueLike {
public:
//コンストラクタ
RogueLike() = default;
constexpr RogueLike() noexcept = default;
template<typename STL_>
constexpr explicit RogueLike(STL_& stl_, const std::size_t way_max_) {
constexpr explicit RogueLike(STL_& stl_, const std::size_t way_max_) noexcept {
create(stl_, way_max_);
}
//マップ生成
Expand Down
19 changes: 10 additions & 9 deletions include/cpp14/SimpleRogueLike.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstdint>
Expand Down Expand Up @@ -44,19 +45,19 @@ namespace dtl {
//マップの道 [部屋ID(前)][繋がる先の部屋ID(後) , (0.X座標 , 1.Y座標) , (前)側の通路の位置 , (後)側の通路の位置]
std::vector<std::array<std::size_t, 4>> dungeon_road{};
public:

SimpleRogueLike() = default;
//コンストラクタ
constexpr SimpleRogueLike() noexcept = default;
template <typename STL_>
SimpleRogueLike(STL_& stl_, const std::size_t division_min = 3, const std::size_t division_rand_max = 4, const std::size_t room_min_x = 5, const std::size_t room_rand_max_x = 2, const std::size_t room_min_y = 5, const std::size_t room_rand_max_y = 2) {
constexpr explicit SimpleRogueLike(STL_& stl_, const std::size_t division_min = 3, const std::size_t division_rand_max = 4, const std::size_t room_min_x = 5, const std::size_t room_rand_max_x = 2, const std::size_t room_min_y = 5, const std::size_t room_rand_max_y = 2) noexcept {
create(stl_, division_min, division_rand_max, room_min_x, room_rand_max_x, room_min_y, room_rand_max_y);
}

//ローグライク生成関数
template <typename STL_>
void create(STL_& stl_, const std::size_t division_min = 3, const std::size_t division_rand_max = 4, const std::size_t room_min_x = 5, const std::size_t room_rand_max_x = 2, const std::size_t room_min_y = 5, const std::size_t room_rand_max_y = 2) noexcept {
constexpr void create(STL_& stl_, const std::size_t division_min = 3, const std::size_t division_rand_max = 4, const std::size_t room_min_x = 5, const std::size_t room_rand_max_x = 2, const std::size_t room_min_y = 5, const std::size_t room_rand_max_y = 2) noexcept {
if (stl_.size() == 0 || stl_.front().size() == 0) return;
//マップの区分け数 (部屋の個数) 0~nまでの部屋ID
const std::size_t mapDivCount{ division_min + (std::size_t)rnd(1,(std::int_fast32_t)division_rand_max) }; //マップの区分け数 (部屋の個数) 0~nまでの部屋ID
const std::size_t mapDivCount{ division_min + (std::size_t)rnd(1,(std::int_fast32_t)division_rand_max) }; //マップの区分け数 (部屋の個数) 0~yまでの部屋ID

dungeon_division.resize(mapDivCount);
dungeon_room.resize(mapDivCount);
Expand Down Expand Up @@ -149,12 +150,12 @@ namespace dtl {
dungeon_room[i][0] = dungeon_division[i][2] + 1;
dungeon_room[i][1] = dungeon_division[i][3] + 1;
}
std::size_t l{ (std::size_t)rnd(1,(std::int_fast32_t)(dungeon_division[i][0] - dungeon_room[i][0] - 5)) + 2 };
std::size_t m{ (std::size_t)rnd(1,(std::int_fast32_t)(dungeon_division[i][1] - dungeon_room[i][1] - 5)) + 2 };
const std::size_t l{ (std::size_t)rnd(1,(std::int_fast32_t)(dungeon_division[i][0] - dungeon_room[i][0] - 5)) + 2 };
const std::size_t n{ (std::size_t)rnd(1,(std::int_fast32_t)(dungeon_division[i][1] - dungeon_room[i][1] - 5)) + 2 };
dungeon_room[i][0] += l;
dungeon_room[i][2] += l;
dungeon_room[i][1] += m;
dungeon_room[i][3] += m;
dungeon_room[i][1] += n;
dungeon_room[i][3] += n;

for (std::size_t j{ dungeon_room[i][2] }; j < dungeon_room[i][0]; ++j)
for (std::size_t k{ dungeon_room[i][3] }; k < dungeon_room[i][1]; ++k)
Expand Down
41 changes: 41 additions & 0 deletions include/cpp14/SimpleTerrain1.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY_SIMPLE_TERRAIN1
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_SIMPLE_TERRAIN1
//:::::----------::::::::::----------::::://
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>
#include "DungeonRandom.hpp"

//Dungeon Template Library Namespace
namespace dtl {

template<typename Int_>
class SimpleTerrain1 {
public:
//ƒRƒ“ƒXƒgƒ‰ƒNƒ^
constexpr SimpleTerrain1() noexcept = default;
template<typename STL_>
constexpr explicit SimpleTerrain1(STL_& stl_, const Int_ v1_, const std::size_t v2_ = 2) noexcept {
create(stl_, v1_, v2_);
}
template<typename STL_>
constexpr void create(STL_& stl_, const Int_ v1_, const std::size_t v2_ = 2) noexcept {

for (std::size_t i{}; i < stl_.size(); i += v2_) {
for (std::size_t j{}; j < stl_[i].size(); j += v2_) {
stl_[i][j] = static_cast<Int_>(v1_);
}
}

}


};

}

#endif //Included Dungeon Template Library
5 changes: 3 additions & 2 deletions include/cpp14/SimpleVoronoiIsland.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dungeon Template Library //
// Made by Gaccho. //
// This code is licensed under CC0. //
// [email protected] //
//:::::----------::::::::::----------::::://

#include <cstddef>
Expand All @@ -26,9 +27,9 @@ namespace dtl {
class SimpleVoronoiIsland {
public:
//コンストラクタ
SimpleVoronoiIsland() = default;
constexpr SimpleVoronoiIsland() noexcept = default;
template<typename STL_>
constexpr explicit SimpleVoronoiIsland(STL_& stl_, const std::size_t count_ = 100, const double rbool_ = 0.4, const Int_ land_ = 1, const Int_ sea_ = 0) {
constexpr explicit SimpleVoronoiIsland(STL_& stl_, const std::size_t count_ = 100, const double rbool_ = 0.4, const Int_ land_ = 1, const Int_ sea_ = 0) noexcept {
create(stl_, count_, rbool_, land_, sea_);
}
template<typename STL_>
Expand Down

0 comments on commit fb476e8

Please sign in to comment.