From 8bc99186e42dbb1b1c0b840f982fe3af913c3e14 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 20 Jun 2016 22:49:05 +0200 Subject: Change artifact_type to non-POD type --- src/artifact_type.hpp | 64 ++++++++++++++++++++++++++------------------------- src/init2.cc | 2 +- 2 files changed, 34 insertions(+), 32 deletions(-) (limited to 'src') 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(max_a_idx); + a_info = new artifact_type[max_a_idx]; } static errr parse(FILE *fp) -- cgit v1.2.3