diff options
author | 2017-02-12 01:11:07 +0100 | |
---|---|---|
committer | 2017-02-12 23:48:53 +0100 | |
commit | f2c3b5155392165ebbf0ae9c1f42ae98a15cb520 (patch) | |
tree | e1ab70610d8fb2bc017543c850567ef2d4663d84 /src/lib | |
parent | d7f420ccf76d560281904522fefb5729195a58e3 (diff) |
Separate custom save states. (nw)
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/netlist/plib/pstate.cpp | 20 | ||||
-rw-r--r-- | src/lib/netlist/plib/pstate.h | 2 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/lib/netlist/plib/pstate.cpp b/src/lib/netlist/plib/pstate.cpp index 91869c26ba7..6f9b16e3583 100644 --- a/src/lib/netlist/plib/pstate.cpp +++ b/src/lib/netlist/plib/pstate.cpp @@ -16,6 +16,7 @@ state_manager_t::state_manager_t() state_manager_t::~state_manager_t() { m_save.clear(); + m_custom.clear(); } @@ -35,20 +36,25 @@ void state_manager_t::remove_save_items(const void *owner) else i++; } + for (auto i = m_custom.begin(); i != m_custom.end(); ) + { + if (i->get()->m_owner == owner) + i = m_save.erase(i); + else + i++; + } } void state_manager_t::pre_save() { - for (auto & s : m_save) - if (s->m_dt.is_custom) - s->m_callback->on_pre_save(); + for (auto & s : m_custom) + s->m_callback->on_pre_save(); } void state_manager_t::post_load() { - for (auto & s : m_save) - if (s->m_dt.is_custom) - s->m_callback->on_post_load(); + for (auto & s : m_custom) + s->m_callback->on_post_load(); } template<> void state_manager_t::save_item(const void *owner, callback_t &state, const pstring &stname) @@ -56,7 +62,7 @@ template<> void state_manager_t::save_item(const void *owner, callback_t &state, //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state); callback_t *state_p = &state; auto p = plib::make_unique<entry_t>(stname, owner, state_p); - m_save.push_back(std::move(p)); + m_custom.push_back(std::move(p)); state.register_state(*this, stname); } diff --git a/src/lib/netlist/plib/pstate.h b/src/lib/netlist/plib/pstate.h index 4256fa45152..27acaa0fb2c 100644 --- a/src/lib/netlist/plib/pstate.h +++ b/src/lib/netlist/plib/pstate.h @@ -135,6 +135,8 @@ protected: private: entry_t::list_t m_save; + entry_t::list_t m_custom; + }; template<> void state_manager_t::save_item(const void *owner, callback_t &state, const pstring &stname); |