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 ++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 31 deletions(-) (limited to 'src/artifact_type.hpp') 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 ?*/ }; -- cgit v1.2.3 From 073ad3584fbf781ce10bef61ad4ff38850282f47 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Tue, 21 Jun 2016 13:37:02 +0200 Subject: Rework TR{1,2,3,4,5}_* flags to flag_set<> --- src/artifact_type.hpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'src/artifact_type.hpp') diff --git a/src/artifact_type.hpp b/src/artifact_type.hpp index ea962bc2..8ff53433 100644 --- a/src/artifact_type.hpp +++ b/src/artifact_type.hpp @@ -1,6 +1,7 @@ #pragma once #include "h-basic.h" +#include "object_flag_set.hpp" /** * Artifact descriptor. @@ -34,17 +35,8 @@ struct artifact_type s32b cost = 0; /* Artifact "cost" */ - 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 = 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 */ + object_flag_set flags; /* Artifact Flags */ + object_flag_set oflags; /* Obvious Flags */ byte level = 0; /* Artifact level */ byte rarity = 0; /* Artifact rarity */ @@ -52,9 +44,6 @@ struct artifact_type byte cur_num = 0; /* Number created (0 or 1) */ byte max_num = 0; /* Unused (should be "1") */ - u32b esp = 0; /* ESP flags */ - u32b oesp = 0; /* ESP flags */ - s16b power = 0; /* Power granted, if any */ s16b set = 0; /* Which set does it belong it, if any? */ -- cgit v1.2.3 From b774262f0a15e1dded8f11474256015a6e639792 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Wed, 4 Jan 2017 21:13:15 +0100 Subject: Remove unused artifact_type::max_num --- src/artifact_type.hpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/artifact_type.hpp') diff --git a/src/artifact_type.hpp b/src/artifact_type.hpp index 8ff53433..9f866aa7 100644 --- a/src/artifact_type.hpp +++ b/src/artifact_type.hpp @@ -42,7 +42,6 @@ struct artifact_type byte rarity = 0; /* Artifact rarity */ byte cur_num = 0; /* Number created (0 or 1) */ - byte max_num = 0; /* Unused (should be "1") */ s16b power = 0; /* Power granted, if any */ -- cgit v1.2.3