diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:14 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:14 +0200 |
commit | 8bbf783ead4517465445272f9144cf06bdac9be7 (patch) | |
tree | 9fa9cc4de0c53df33c557d66a9efbc6781f6fb94 /src/loadsave.cc | |
parent | 013e27d39ee8ee513208d2855c7e3f6252f0c0bf (diff) |
Refactor object_type 'artifact name' field to std::string
We don't really need quarks for this since we're not nearly as
memory-constrained these days.
Diffstat (limited to 'src/loadsave.cc')
-rw-r--r-- | src/loadsave.cc | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/src/loadsave.cc b/src/loadsave.cc index 6da23406..3f4ba47f 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -1141,31 +1141,15 @@ static void do_item(object_type *o_ptr, ls_flag_t flag) // Inscription do_std_string(o_ptr->inscription, flag); - /* Artifact name */ - if (flag == ls_flag_t::LOAD) - { - char buf[128]; - load_string(buf, 128); - if (buf[0]) - { - o_ptr->art_name = quark_add(buf); - } - } - if (flag == ls_flag_t::SAVE) - { - if (o_ptr->art_name) - { - save_string(quark_str(o_ptr->art_name)); - } - else - { - save_string(""); - } - } + // Artifact name + do_std_string(o_ptr->artifact_name, flag); + + /* Stick any more shared code before this. The rest + of this function is reserved for ls_flag_t::LOAD's + cleanup functions */ + + if (flag == ls_flag_t::SAVE) return; - if (flag == ls_flag_t::SAVE) return ; /* Stick any more shared code before this. The rest - of this function is reserved for ls_flag_t::LOAD's - cleanup functions */ /*********** END OF ls_flag_t::SAVE ***************/ /* Obtain the "kind" template */ @@ -1248,7 +1232,7 @@ static void do_item(object_type *o_ptr, ls_flag_t flag) o_ptr->ds = old_ds; } - if (o_ptr->art_name) /* A random artifact */ + if (!o_ptr->artifact_name.empty()) /* A random artifact */ { o_ptr->dd = old_dd; o_ptr->ds = old_ds; |