diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-10-05 18:45:08 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-10-05 18:45:08 +0200 |
commit | c84490dd6fb5d1e85482c2271e00cb768bae410e (patch) | |
tree | c2043c4f418f7565c911b88d6aa926d4b3747230 /src/init1.cc | |
parent | dd76070a7d8676a5f13dcc91fc7ed2eb2639d9df (diff) |
Change ability_type::{name, desc, action_desc} to std::string
Diffstat (limited to 'src/init1.cc')
-rw-r--r-- | src/init1.cc | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/init1.cc b/src/init1.cc index 977bad9a..f9df3c1b 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -3329,10 +3329,10 @@ errr init_ab_info_txt(FILE *fp) /* Point at the "info" */ ab_ptr = &expand_to_fit_index(ab_info, i); + assert(ab_ptr->name.empty()); /* Copy name */ - assert(!ab_ptr->name); - ab_ptr->name = my_strdup(s); + ab_ptr->name = s; /* Init */ ab_ptr->action_mkey = 0; @@ -3357,19 +3357,15 @@ errr init_ab_info_txt(FILE *fp) /* Process 'D' for "Description" */ if (buf[0] == 'D') { - /* Acquire the text */ - char const *s = buf + 2; - - /* Append description */ - if (!ab_ptr->desc) - { - ab_ptr->desc = my_strdup(s); - } - else + /* Need newline? */ + if (!ab_ptr->desc.empty()) { - strappend(&ab_ptr->desc, format("\n%s", s)); + ab_ptr->desc += '\n'; } + /* Append */ + ab_ptr->desc += (buf + 2); + /* Next... */ continue; } @@ -3387,8 +3383,8 @@ errr init_ab_info_txt(FILE *fp) txt++; /* Copy name */ - assert(!ab_ptr->action_desc); - ab_ptr->action_desc = my_strdup(txt); + assert(ab_ptr->action_desc.empty()); + ab_ptr->action_desc = txt; /* Set mkey */ ab_ptr->action_mkey = atoi(s); |