From c8a270e51dc22f39ed048ab1cc609e6e456df58f Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sun, 7 Jun 2015 17:49:09 +0200 Subject: Split types.h into separate header for each type --- src/dungeon_info_type.hpp | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/dungeon_info_type.hpp (limited to 'src/dungeon_info_type.hpp') diff --git a/src/dungeon_info_type.hpp b/src/dungeon_info_type.hpp new file mode 100644 index 00000000..5f6fc9d0 --- /dev/null +++ b/src/dungeon_info_type.hpp @@ -0,0 +1,72 @@ +#pragma once + +#include "h-basic.h" +#include "rule_type.hpp" +#include "obj_theme.hpp" + +/** + * Maximum number of towns per dungeon + */ +constexpr int TOWN_DUNGEON = 4; + +/* A structure for the != dungeon types */ +struct dungeon_info_type +{ + const char *name; /* Name */ + char *text; /* Description */ + char short_name[3]; /* Short name */ + + char generator[30]; /* Name of the level generator */ + + s16b floor1; /* Floor tile 1 */ + byte floor_percent1[2]; /* Chance of type 1 */ + s16b floor2; /* Floor tile 2 */ + byte floor_percent2[2]; /* Chance of type 2 */ + s16b floor3; /* Floor tile 3 */ + byte floor_percent3[2]; /* Chance of type 3 */ + s16b outer_wall; /* Outer wall tile */ + s16b inner_wall; /* Inner wall tile */ + s16b fill_type1; /* Cave tile 1 */ + byte fill_percent1[2]; /* Chance of type 1 */ + s16b fill_type2; /* Cave tile 2 */ + byte fill_percent2[2]; /* Chance of type 2 */ + s16b fill_type3; /* Cave tile 3 */ + byte fill_percent3[2]; /* Chance of type 3 */ + byte fill_method; /* Smoothing parameter for the above */ + + s16b mindepth; /* Minimal depth */ + s16b maxdepth; /* Maximal depth */ + + bool_ principal; /* If it's a part of the main dungeon */ + byte next; /* The next part of the main dungeon */ + byte min_plev; /* Minimal plev needed to enter -- it's an anti-cheating mesure */ + + int min_m_alloc_level; /* Minimal number of monsters per level */ + int max_m_alloc_chance; /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */ + + u32b flags1; /* Flags 1 */ + u32b flags2; /* Flags 1 */ + + int size_x, size_y; /* Desired numers of panels */ + + byte rule_percents[100]; /* Flat rule percents */ + rule_type rules[5]; /* Monster generation rules */ + + int final_object; /* The object you'll find at the bottom */ + int final_artifact; /* The artifact you'll find at the bottom */ + int final_guardian; /* The artifact's guardian. If an artifact is specified, then it's NEEDED */ + + int ix, iy, ox, oy; /* Wilderness coordinates of the entrance/output of the dungeon */ + + obj_theme objs; /* The drops type */ + + int d_dice[4]; /* Number of dices */ + int d_side[4]; /* Number of sides */ + int d_frequency[4]; /* Frequency of damage (1 is the minimum) */ + int d_type[4]; /* Type of damage */ + + s16b t_idx[TOWN_DUNGEON]; /* The towns */ + s16b t_level[TOWN_DUNGEON]; /* The towns levels */ + s16b t_num; /* Number of towns */ +}; + -- cgit v1.2.3 From 959f8c09f32e6b431bc4f7af8d1a5c296cefdafe Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 5 Feb 2016 19:22:46 +0100 Subject: Remove unused dungeon_info_type::next --- src/dungeon_info_type.hpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/dungeon_info_type.hpp') diff --git a/src/dungeon_info_type.hpp b/src/dungeon_info_type.hpp index 5f6fc9d0..b7b61a53 100644 --- a/src/dungeon_info_type.hpp +++ b/src/dungeon_info_type.hpp @@ -38,7 +38,6 @@ struct dungeon_info_type s16b maxdepth; /* Maximal depth */ bool_ principal; /* If it's a part of the main dungeon */ - byte next; /* The next part of the main dungeon */ byte min_plev; /* Minimal plev needed to enter -- it's an anti-cheating mesure */ int min_m_alloc_level; /* Minimal number of monsters per level */ -- cgit v1.2.3 From 493333206ea94eb0592e52629a0a628fa34eb266 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Tue, 29 Mar 2016 20:32:55 +0200 Subject: Change dungeon_info_type to non-POD type --- src/dungeon_info_type.hpp | 116 ++++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 55 deletions(-) (limited to 'src/dungeon_info_type.hpp') diff --git a/src/dungeon_info_type.hpp b/src/dungeon_info_type.hpp index b7b61a53..77c037a7 100644 --- a/src/dungeon_info_type.hpp +++ b/src/dungeon_info_type.hpp @@ -4,6 +4,8 @@ #include "rule_type.hpp" #include "obj_theme.hpp" +#include + /** * Maximum number of towns per dungeon */ @@ -12,60 +14,64 @@ constexpr int TOWN_DUNGEON = 4; /* A structure for the != dungeon types */ struct dungeon_info_type { - const char *name; /* Name */ - char *text; /* Description */ - char short_name[3]; /* Short name */ - - char generator[30]; /* Name of the level generator */ - - s16b floor1; /* Floor tile 1 */ - byte floor_percent1[2]; /* Chance of type 1 */ - s16b floor2; /* Floor tile 2 */ - byte floor_percent2[2]; /* Chance of type 2 */ - s16b floor3; /* Floor tile 3 */ - byte floor_percent3[2]; /* Chance of type 3 */ - s16b outer_wall; /* Outer wall tile */ - s16b inner_wall; /* Inner wall tile */ - s16b fill_type1; /* Cave tile 1 */ - byte fill_percent1[2]; /* Chance of type 1 */ - s16b fill_type2; /* Cave tile 2 */ - byte fill_percent2[2]; /* Chance of type 2 */ - s16b fill_type3; /* Cave tile 3 */ - byte fill_percent3[2]; /* Chance of type 3 */ - byte fill_method; /* Smoothing parameter for the above */ - - s16b mindepth; /* Minimal depth */ - s16b maxdepth; /* Maximal depth */ - - bool_ principal; /* If it's a part of the main dungeon */ - byte min_plev; /* Minimal plev needed to enter -- it's an anti-cheating mesure */ - - int min_m_alloc_level; /* Minimal number of monsters per level */ - int max_m_alloc_chance; /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */ - - u32b flags1; /* Flags 1 */ - u32b flags2; /* Flags 1 */ - - int size_x, size_y; /* Desired numers of panels */ - - byte rule_percents[100]; /* Flat rule percents */ - rule_type rules[5]; /* Monster generation rules */ - - int final_object; /* The object you'll find at the bottom */ - int final_artifact; /* The artifact you'll find at the bottom */ - int final_guardian; /* The artifact's guardian. If an artifact is specified, then it's NEEDED */ - - int ix, iy, ox, oy; /* Wilderness coordinates of the entrance/output of the dungeon */ - - obj_theme objs; /* The drops type */ - - int d_dice[4]; /* Number of dices */ - int d_side[4]; /* Number of sides */ - int d_frequency[4]; /* Frequency of damage (1 is the minimum) */ - int d_type[4]; /* Type of damage */ - - s16b t_idx[TOWN_DUNGEON]; /* The towns */ - s16b t_level[TOWN_DUNGEON]; /* The towns levels */ - s16b t_num; /* Number of towns */ + const char *name = nullptr; /* Name */ + char *text = nullptr; /* Description */ + char short_name[3] = { 0 }; /* Short name */ + + char generator[30] = { 0 }; /* Name of the level generator */ + + s16b floor1 = 0; /* Floor tile 1 */ + byte floor_percent1[2] = { 0 }; /* Chance of type 1 */ + s16b floor2 = 0; /* Floor tile 2 */ + byte floor_percent2[2] = { 0 }; /* Chance of type 2 */ + s16b floor3 = 0; /* Floor tile 3 */ + byte floor_percent3[2] = { 0 }; /* Chance of type 3 */ + s16b outer_wall = 0; /* Outer wall tile */ + s16b inner_wall = 0; /* Inner wall tile */ + s16b fill_type1 = 0; /* Cave tile 1 */ + byte fill_percent1[2] = { 0 }; /* Chance of type 1 */ + s16b fill_type2 = 0; /* Cave tile 2 */ + byte fill_percent2[2] = { 0 }; /* Chance of type 2 */ + s16b fill_type3 = 0; /* Cave tile 3 */ + byte fill_percent3[2] = { 0 }; /* Chance of type 3 */ + byte fill_method = 0; /* Smoothing parameter for the above */ + + s16b mindepth = 0; /* Minimal depth */ + s16b maxdepth = 0; /* Maximal depth */ + + bool_ principal = 0; /* If it's a part of the main dungeon */ + byte min_plev = 0; /* Minimal plev needed to enter -- it's an anti-cheating mesure */ + + int min_m_alloc_level = 0; /* Minimal number of monsters per level */ + int max_m_alloc_chance = 0; /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */ + + u32b flags1 = 0; /* Dungeon flags 1 */ + u32b flags2 = 0; /* Dungeon flags 2 */ + + int size_x = 0; + int size_y = 0; + + byte rule_percents[100] = {0}; /* Flat rule percents */ + std::array rules { }; /* Monster generation rules */ + + int final_object = 0; /* The object you'll find at the bottom */ + int final_artifact = 0; /* The artifact you'll find at the bottom */ + int final_guardian = 0; /* The artifact's guardian. If an artifact is specified, then it's NEEDED */ + + int ix = 0; /* Wilderness coordinates of entrance */ + int iy = 0; /* Wilderness coordinates of entrance */ + int ox = 0; /* Wilderness coordinates of exit */ + int oy = 0; /* Wilderness coordinates of exit */ + + obj_theme objs = obj_theme { 0, 0, 0, 0 }; /* The drops type */ + + int d_dice[4] = { 0 }; /* Number of dices */ + int d_side[4] = { 0 }; /* Number of sides */ + int d_frequency[4] = { 0 }; /* Frequency of damage (1 is the minimum) */ + int d_type[4] = { 0 }; /* Type of damage */ + + s16b t_idx[TOWN_DUNGEON] = { 0 }; /* The towns */ + s16b t_level[TOWN_DUNGEON] = { 0 }; /* The towns levels */ + s16b t_num = 0; /* Number of towns */ }; -- cgit v1.2.3 From 899041ce6b7cbc33e8cb3124aaa54b518c4a4b72 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Tue, 29 Mar 2016 20:32:55 +0200 Subject: Convert dungeon_info_type to use new flag_set --- src/dungeon_info_type.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dungeon_info_type.hpp') diff --git a/src/dungeon_info_type.hpp b/src/dungeon_info_type.hpp index 77c037a7..c4edc770 100644 --- a/src/dungeon_info_type.hpp +++ b/src/dungeon_info_type.hpp @@ -3,6 +3,7 @@ #include "h-basic.h" #include "rule_type.hpp" #include "obj_theme.hpp" +#include "dungeon_flag_set.hpp" #include @@ -45,8 +46,7 @@ struct dungeon_info_type int min_m_alloc_level = 0; /* Minimal number of monsters per level */ int max_m_alloc_chance = 0; /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */ - u32b flags1 = 0; /* Dungeon flags 1 */ - u32b flags2 = 0; /* Dungeon flags 2 */ + dungeon_flag_set flags { }; /* Dungeon flags */ int size_x = 0; int size_y = 0; -- cgit v1.2.3 From e17e742edb3809d45ce1edc716d71b3bb93056d6 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 20 Jun 2016 22:49:05 +0200 Subject: Make obj_theme a non-POD struct --- src/dungeon_info_type.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dungeon_info_type.hpp') diff --git a/src/dungeon_info_type.hpp b/src/dungeon_info_type.hpp index c4edc770..b15cf9fe 100644 --- a/src/dungeon_info_type.hpp +++ b/src/dungeon_info_type.hpp @@ -63,7 +63,7 @@ struct dungeon_info_type int ox = 0; /* Wilderness coordinates of exit */ int oy = 0; /* Wilderness coordinates of exit */ - obj_theme objs = obj_theme { 0, 0, 0, 0 }; /* The drops type */ + obj_theme objs; /* The drops type */ int d_dice[4] = { 0 }; /* Number of dices */ int d_side[4] = { 0 }; /* Number of sides */ -- cgit v1.2.3 From 7ccb0c1a48d571abd6dc3aca725275e2d264aa2d Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Wed, 5 Oct 2016 18:45:08 +0200 Subject: Change strings in dungeon_info_type to std::string --- src/dungeon_info_type.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dungeon_info_type.hpp') diff --git a/src/dungeon_info_type.hpp b/src/dungeon_info_type.hpp index b15cf9fe..324a32bd 100644 --- a/src/dungeon_info_type.hpp +++ b/src/dungeon_info_type.hpp @@ -15,11 +15,11 @@ constexpr int TOWN_DUNGEON = 4; /* A structure for the != dungeon types */ struct dungeon_info_type { - const char *name = nullptr; /* Name */ - char *text = nullptr; /* Description */ - char short_name[3] = { 0 }; /* Short name */ + std::string name; /* Name */ + std::string text; /* Description */ + std::string short_name; /* Short name */ - char generator[30] = { 0 }; /* Name of the level generator */ + std::string generator; /* Name of the level generator */ s16b floor1 = 0; /* Floor tile 1 */ byte floor_percent1[2] = { 0 }; /* Chance of type 1 */ -- cgit v1.2.3 From ec9527e2f0c4394f8c2acede78c81e90421b4b09 Mon Sep 17 00:00:00 2001 From: Elmo Todurov Date: Thu, 6 Oct 2016 03:02:30 +0300 Subject: Added missing #includes --- src/dungeon_info_type.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/dungeon_info_type.hpp') diff --git a/src/dungeon_info_type.hpp b/src/dungeon_info_type.hpp index 324a32bd..2f8fefde 100644 --- a/src/dungeon_info_type.hpp +++ b/src/dungeon_info_type.hpp @@ -6,6 +6,7 @@ #include "dungeon_flag_set.hpp" #include +#include /** * Maximum number of towns per dungeon -- cgit v1.2.3