diff options
-rw-r--r-- | src/init1.cc | 15 | ||||
-rw-r--r-- | src/object1.cc | 6 | ||||
-rw-r--r-- | src/set_type.hpp | 6 |
3 files changed, 16 insertions, 11 deletions
diff --git a/src/init1.cc b/src/init1.cc index 7d8afaa9..b68309b7 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -2926,10 +2926,10 @@ errr init_set_info_txt(FILE *fp) /* Point at the "info" */ set_ptr = &expand_to_fit_index(set_info, i); + assert(set_ptr->name.empty()); /* Copy name */ - assert(!set_ptr->name); - set_ptr->name = my_strdup(s); + set_ptr->name = s; /* Next... */ continue; @@ -2941,11 +2941,14 @@ errr init_set_info_txt(FILE *fp) /* Process 'D' for "Description" */ if (buf[0] == 'D') { - /* Acquire the text */ - char const *s = buf + 2; + /* Need newline? */ + if (!set_ptr->desc.empty()) + { + set_ptr->desc += '\n'; + } - /* Append chars to the description */ - strappend(&set_ptr->desc, s); + /* Append */ + set_ptr->desc += (buf + 2); /* Next... */ continue; diff --git a/src/object1.cc b/src/object1.cc index 0d958fc8..191b2046 100644 --- a/src/object1.cc +++ b/src/object1.cc @@ -2574,7 +2574,7 @@ bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait if (a_ptr->set != -1) { - text_out_c(TERM_GREEN, set_info[a_ptr->set].desc); + text_out_c(TERM_GREEN, set_info[a_ptr->set].desc.c_str()); text_out("\n"); } } @@ -6151,7 +6151,7 @@ bool_ wield_set(s16b a_idx, s16b set_idx, bool_ silent) } else if ((s_ptr->num_use == s_ptr->num) && (!silent)) { - cmsg_format(TERM_GREEN, "%s item set completed.", s_ptr->name); + cmsg_format(TERM_GREEN, "%s item set completed.", s_ptr->name.c_str()); } return (TRUE); } @@ -6185,7 +6185,7 @@ bool_ takeoff_set(s16b a_idx, s16b set_idx) if (s_ptr->num_use == s_ptr->num - 1) { - cmsg_format(TERM_GREEN, "%s item set not complete anymore.", s_ptr->name); + cmsg_format(TERM_GREEN, "%s item set not complete anymore.", s_ptr->name.c_str()); } return (TRUE); diff --git a/src/set_type.hpp b/src/set_type.hpp index 0a04b384..bf13c932 100644 --- a/src/set_type.hpp +++ b/src/set_type.hpp @@ -1,6 +1,8 @@ #pragma once #include <array> +#include <string> + #include "set_component.hpp" /** @@ -8,8 +10,8 @@ */ struct set_type { - const char *name = nullptr; /* Name */ - char *desc = nullptr; /* Desc */ + std::string name; /* Name */ + std::string desc; /* Desc */ byte num = 0; /* Number of artifacts used */ byte num_use = 0; /* Number actually worn */ |