summaryrefslogtreecommitdiff
path: root/src
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
commitc4a8fd220d2742e521f0d96ea3d8cb7e9375bcb4 (patch)
tree36391290b57d7202ff6a229d45d802ef1423a464 /src
parent68e2a10b2d76cb3a2f5aa6818b4b184b6a02ef14 (diff)
Change object_kind to non-POD type
Diffstat (limited to 'src')
-rw-r--r--src/init2.cc2
-rw-r--r--src/object_kind.hpp84
2 files changed, 43 insertions, 43 deletions
diff --git a/src/init2.cc b/src/init2.cc
index d0bf5697..86a0ab1e 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -293,7 +293,7 @@ namespace {
static void allocate()
{
- k_info = make_array<object_kind>(max_k_idx);
+ k_info = new object_kind[max_k_idx];
}
static errr parse(FILE *fp)
diff --git a/src/object_kind.hpp b/src/object_kind.hpp
index 505f54d9..767c7e05 100644
--- a/src/object_kind.hpp
+++ b/src/object_kind.hpp
@@ -14,70 +14,70 @@ constexpr int ALLOCATION_MAX = 8;
*/
struct object_kind
{
- const char *name; /* Name */
- char *text; /* Text */
+ const char *name = nullptr; /* Name */
+ char *text = nullptr; /* Text */
- byte tval; /* Object type */
- byte sval; /* Object sub type */
+ byte tval = 0; /* Object type */
+ byte sval = 0; /* Object sub type */
- s32b pval; /* Object extra info */
- s32b pval2; /* Object extra info */
+ s32b pval = 0; /* Object extra info */
+ s32b pval2 = 0; /* Object 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 dice/sides */
+ byte dd = 0; /* Damage dice */
+ byte ds = 0; /* Damage sides */
- s32b weight; /* Weight */
+ s32b weight = 0; /* Weight */
- s32b cost; /* Object "base cost" */
+ s32b cost = 0; /* Object "base cost" */
- u32b flags1; /* Flags, set 1 */
- u32b flags2; /* Flags, set 2 */
- u32b flags3; /* Flags, set 3 */
- u32b flags4; /* Flags, set 4 */
- u32b flags5; /* Flags, set 5 */
+ u32b flags1 = 0; /* Flags, set 1 */
+ u32b flags2 = 0; /* Flags, set 2 */
+ u32b flags3 = 0; /* Flags, set 3 */
+ u32b flags4 = 0; /* Flags, set 4 */
+ u32b flags5 = 0; /* 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 locale[ALLOCATION_MAX]; /* Allocation level(s) */
- byte chance[ALLOCATION_MAX]; /* Allocation chance(s) */
+ byte locale[ALLOCATION_MAX] = { 0 }; /* Allocation level(s) */
+ byte chance[ALLOCATION_MAX] = { 0 }; /* Allocation chance(s) */
- byte level; /* Level */
+ byte level = 0; /* Level */
- byte d_attr; /* Default object attribute */
- char d_char; /* Default object character */
+ byte d_attr = 0; /* Default object attribute */
+ char d_char = 0; /* Default object character */
- byte x_attr; /* Desired object attribute */
- char x_char; /* Desired object character */
+ byte x_attr = 0; /* Desired object attribute */
+ char x_char = 0; /* Desired object character */
- byte flavor; /* Special object flavor (or zero) */
+ byte flavor = 0; /* Special object flavor (or zero) */
- bool_ easy_know; /* This object is always known (if aware) */
+ bool_ easy_know = 0; /* This object is always known (if aware) */
+ bool_ aware = 0; /* The player is "aware" of the item's effects */
- bool_ aware; /* The player is "aware" of the item's effects */
+ bool_ tried = 0; /* The player has "tried" one of the items */
- bool_ tried; /* The player has "tried" one of the items */
+ u32b esp = 0; /* ESP flags */
+ u32b oesp = 0; /* Obvious ESP flags */
- u32b esp; /* ESP flags */
- u32b oesp; /* Obvious ESP flags */
+ byte btval = 0; /* Become Object type */
+ byte bsval = 0; /* Become Object sub type */
+ bool_ artifact = 0; /* Is it a normal artifact(already generated) */
- byte btval; /* Become Object type */
- byte bsval; /* Become Object sub type */
- bool_ artifact; /* Is it a normal artifact(already generated) */
-
- s16b power; /* Power granted(if any) */
+ s16b power = 0; /* Power granted(if any) */
};