mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 13:17:00 -04:00
Use make_intrusive/make_shared for smart pointer construction.
This commit is contained in:
@@ -77,7 +77,7 @@ class MessageCtrl : public wxScrolledWindow {
|
||||
Refresh(false);
|
||||
}
|
||||
void add_message(MessageType type, String const& text, bool joined_to_previous = false) {
|
||||
add_message(intrusive(new ConsoleMessage(type,text,joined_to_previous)));
|
||||
add_message(make_intrusive<ConsoleMessage>(type,text,joined_to_previous));
|
||||
}
|
||||
|
||||
bool have_selection() const {
|
||||
@@ -499,7 +499,7 @@ void ConsolePanel::exec(String const& command) {
|
||||
ScriptValueP result = ctx.eval(*script,false);
|
||||
get_pending_errors();
|
||||
// show result
|
||||
ConsoleMessageP message = intrusive(new ConsoleMessage(MESSAGE_OUTPUT));
|
||||
ConsoleMessageP message = make_intrusive<ConsoleMessage>(MESSAGE_OUTPUT);
|
||||
message->joined_to_previous = true;
|
||||
message->value = result;
|
||||
// type of result
|
||||
|
||||
@@ -344,9 +344,9 @@ void KeywordsPanel::onKeywordSelect(KeywordSelectEvent& ev) {
|
||||
if (ev.keyword) {
|
||||
Keyword& kw = *ev.keyword;
|
||||
sp->Show(fixed, kw.fixed);
|
||||
keyword ->setValue(intrusive(new KeywordTextValue(keyword->getFieldP(), &kw, &kw.keyword, !kw.fixed, true)));
|
||||
match ->setValue(intrusive(new KeywordTextValue(match->getFieldP(), &kw, &kw.match, !kw.fixed)));
|
||||
rules ->setValue(intrusive(new KeywordTextValue(rules->getFieldP(), &kw, &kw.rules, !kw.fixed)));
|
||||
keyword ->setValue(make_intrusive<KeywordTextValue>(keyword->getFieldP(), &kw, &kw.keyword, !kw.fixed, true));
|
||||
match ->setValue(make_intrusive<KeywordTextValue>(match->getFieldP(), &kw, &kw.match, !kw.fixed));
|
||||
rules ->setValue(make_intrusive<KeywordTextValue>(rules->getFieldP(), &kw, &kw.rules, !kw.fixed));
|
||||
intrusive_ptr<KeywordReminderTextValue> reminder_value(new KeywordReminderTextValue(*set, reminder->getFieldP(), &kw, !kw.fixed));
|
||||
reminder->setValue(reminder_value);
|
||||
errors->SetLabel(reminder_value->errors);
|
||||
|
||||
@@ -326,14 +326,14 @@ void CustomPackDialog::updateTotals() {
|
||||
}
|
||||
|
||||
void CustomPackDialog::storePack() {
|
||||
edited_pack = intrusive(new PackType());
|
||||
edited_pack = make_intrusive<PackType>();
|
||||
edited_pack->selectable = true;
|
||||
edited_pack->select = SELECT_ALL;
|
||||
edited_pack->name = name->GetValue();
|
||||
FOR_EACH(pick,pickers) {
|
||||
int copies = pick.value->GetValue();
|
||||
if (copies > 0) {
|
||||
edited_pack->items.push_back(intrusive(new PackItem(pick.pack->name, copies)));
|
||||
edited_pack->items.push_back(make_intrusive<PackItem>(pick.pack->name, copies));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -632,10 +632,10 @@ void RandomPackPanel::onCardSelect(CardSelectEvent& ev) {
|
||||
|
||||
void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) {
|
||||
if (!isInitialized()) return;
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice(
|
||||
out.push_back(make_intrusive<ExportCardSelectionChoice>(
|
||||
_BUTTON_("export generated packs"),
|
||||
card_list->getCardsPtr()
|
||||
)));
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ void StatsPanel::showCategory(const GraphType* prefer_layout) {
|
||||
// create axes
|
||||
GraphDataPre d;
|
||||
FOR_EACH(dim, dims) {
|
||||
d.axes.push_back(intrusive(new GraphAxis(
|
||||
d.axes.push_back(make_intrusive<GraphAxis>(
|
||||
dim->name,
|
||||
dim->colors.empty() ? AUTO_COLOR_EVEN : AUTO_COLOR_NO,
|
||||
dim->numeric,
|
||||
@@ -480,7 +480,7 @@ void StatsPanel::showCategory(const GraphType* prefer_layout) {
|
||||
&dim->colors,
|
||||
dim->groups.empty() ? nullptr : &dim->groups
|
||||
)
|
||||
));
|
||||
);
|
||||
}
|
||||
// find values for each card
|
||||
for (size_t i = 0 ; i < set->cards.size() ; ++i) {
|
||||
|
||||
@@ -309,7 +309,7 @@ void SetWindow::onChangeSet() {
|
||||
updateTitle();
|
||||
// make sure there is always at least one card
|
||||
// some things need this
|
||||
if (set->cards.empty()) set->cards.push_back(intrusive(new Card(*set->game)));
|
||||
if (set->cards.empty()) set->cards.push_back(make_intrusive<Card>(*set->game));
|
||||
// all panels view the same set
|
||||
FOR_EACH(p, panels) {
|
||||
p->setSet(set);
|
||||
@@ -383,11 +383,11 @@ void SetWindow::onCardActivate(CardSelectEvent& ev) {
|
||||
}
|
||||
|
||||
void SetWindow::selectionChoices(ExportCardSelectionChoices& out) {
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice(*set))); // entire set
|
||||
out.push_back(make_intrusive<ExportCardSelectionChoice>(*set)); // entire set
|
||||
FOR_EACH(p, panels) {
|
||||
p->selectionChoices(out);
|
||||
}
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice())); // custom
|
||||
out.push_back(make_intrusive<ExportCardSelectionChoice>()); // custom
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Window events - close
|
||||
|
||||
Reference in New Issue
Block a user