mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Clean up pointer use:
* Use unique_ptr for Actions instead of manual memory management * Use unique_ptr in KeywordDatabase * Use unique_ptr instead of shared_ptr for file formats * Don't pass shared_ptr to Reader/Writer, use references instead Also * Switch to C++17 so we can use map::try_emplace
This commit is contained in:
@@ -528,7 +528,7 @@ void RandomPackPanel::onCommand(int id) {
|
||||
case ID_CUSTOM_PACK: {
|
||||
CustomPackDialog dlg(this, set, PackTypeP(), false);
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
set->actions.addAction( new AddPackAction(ADD,*set,dlg.get()) );
|
||||
set->actions.addAction(make_unique<AddPackAction>(ADD,*set,dlg.get()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -544,12 +544,12 @@ void RandomPackPanel::onPackTypeClick(wxCommandEvent& ev) {
|
||||
// update pack
|
||||
for (size_t i = 0 ; i < set->pack_types.size() ; ++i) {
|
||||
if (set->pack_types[i] == pick.pack) {
|
||||
set->actions.addAction( new ChangePackAction(*set,i,dlg.get()) );
|
||||
set->actions.addAction(make_unique<ChangePackAction>(*set,i,dlg.get()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// delete pack
|
||||
set->actions.addAction( new AddPackAction(REMOVE,*set,pick.pack) );
|
||||
set->actions.addAction(make_unique<AddPackAction>(REMOVE,*set,pick.pack));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user