summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-06-20 22:49:05 +0200
committerBardur Arantsson <bardur@scientician.net>2016-06-20 22:49:05 +0200
commit8bc99186e42dbb1b1c0b840f982fe3af913c3e14 (patch)
tree5ceab4c26df6a74f28dd2c28f0ff1c5e43e6dc58
parentc263b67fbcd7ffdae13bbed8191106b6c1c80609 (diff)
Change artifact_type to non-POD type
-rw-r--r--src/artifact_type.hpp64
-rw-r--r--src/init2.cc2
2 files changed, 34 insertions, 32 deletions
diff --git a/src/artifact_type.hpp b/src/artifact_type.hpp
index 7a4340aa..ea962bc2 100644
--- a/src/artifact_type.hpp
+++ b/src/artifact_type.hpp
@@ -11,50 +11,52 @@
*/
struct artifact_type
{
- char const *name; /* Artifact name */
- char *text; /* Artifact description */
+ char const *name = nullptr; /* Artifact name */
+ char *text = nullptr; /* Artifact description */
- byte tval; /* Artifact type */
- byte sval; /* Artifact sub type */
+ byte tval = 0; /* Artifact type */
+ byte sval = 0; /* Artifact sub type */
- s16b pval; /* Artifact extra info */
+ s16b pval = 0; /* Artifact extra info */
- s16b to_h; /* Bonus to hit */
- s16b to_d; /* Bonus to damage */
- s16b to_a; /* Bonus to armor */
+ s16b to_h = 0; /* Bonus to hit */
+ s16b to_d = 0; /* Bonus to damage */
+ s16b to_a = 0; /* Bonus to armor */
- s16b activate; /* Activation Number */
+ s16b activate = 0; /* Activation Number */
- s16b ac; /* Base armor */
+ s16b ac = 0; /* Base armor */
- byte dd, ds; /* Damage when hits */
+ byte dd = 0; /* Damage dice */
+ byte ds = 0; /* Damage sides */
- s16b weight; /* Weight */
+ s16b weight = 0; /* Weight */
- s32b cost; /* Artifact "cost" */
+ s32b cost = 0; /* Artifact "cost" */
- u32b flags1; /* Artifact Flags, set 1 */
- u32b flags2; /* Artifact Flags, set 2 */
- u32b flags3; /* Artifact Flags, set 3 */
- u32b flags4; /* Artifact Flags, set 4 */
- u32b flags5; /* Artifact Flags, set 5 */
+ u32b flags1 = 0; /* Artifact Flags, set 1 */
+ u32b flags2 = 0; /* Artifact Flags, set 2 */
+ u32b flags3 = 0; /* Artifact Flags, set 3 */
+ u32b flags4 = 0; /* Artifact Flags, set 4 */
+ u32b flags5 = 0; /* Artifact Flags, set 5 */
- u32b oflags1; /* Obvious Flags, set 1 */
- u32b oflags2; /* Obvious Flags, set 2 */
- u32b oflags3; /* Obvious Flags, set 3 */
- u32b oflags4; /* Obvious Flags, set 4 */
- u32b oflags5; /* Obvious Flags, set 5 */
+ u32b oflags1 = 0; /* Obvious Flags, set 1 */
+ u32b oflags2 = 0; /* Obvious Flags, set 2 */
+ u32b oflags3 = 0; /* Obvious Flags, set 3 */
+ u32b oflags4 = 0; /* Obvious Flags, set 4 */
+ u32b oflags5 = 0; /* Obvious Flags, set 5 */
- byte level; /* Artifact level */
- byte rarity; /* Artifact rarity */
+ byte level = 0; /* Artifact level */
+ byte rarity = 0; /* Artifact rarity */
- byte cur_num; /* Number created (0 or 1) */
- byte max_num; /* Unused (should be "1") */
+ byte cur_num = 0; /* Number created (0 or 1) */
+ byte max_num = 0; /* Unused (should be "1") */
- u32b esp; /* ESP flags */
- u32b oesp; /* ESP flags */
+ u32b esp = 0; /* ESP flags */
+ u32b oesp = 0; /* ESP flags */
- s16b power; /* Power granted(if any) */
+ s16b power = 0; /* Power granted, if any */
+
+ s16b set = 0; /* Which set does it belong it, if any? */
- s16b set; /* Does it belongs to a set ?*/
};
diff --git a/src/init2.cc b/src/init2.cc
index ec6cf9d7..54f455e3 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -325,7 +325,7 @@ namespace {
static void allocate()
{
- a_info = make_array<artifact_type>(max_a_idx);
+ a_info = new artifact_type[max_a_idx];
}
static errr parse(FILE *fp)