Instead of the new_intrusive<T>() functions, use intrusive(new T)

This means we no longer need 8 different functions for different numbers of arguments, and non-const references can now also be passed to constructors without problems.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1443 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-07-21 14:32:28 +00:00
parent 8800500d86
commit 51dfed69b4
66 changed files with 304 additions and 353 deletions
+3 -3
View File
@@ -326,9 +326,9 @@ void KeywordsPanel::onKeywordSelect(KeywordSelectEvent& ev) {
if (ev.keyword) {
Keyword& kw = *ev.keyword;
sp->Show(fixed, kw.fixed);
keyword ->setValue(new_intrusive5<KeywordTextValue> (keyword->getFieldP(), &kw, &kw.keyword, !kw.fixed, true));
match ->setValue(new_intrusive4<KeywordTextValue> (match->getFieldP(), &kw, &kw.match, !kw.fixed));
rules ->setValue(new_intrusive4<KeywordTextValue> (rules->getFieldP(), &kw, &kw.rules, !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)));
intrusive_ptr<KeywordReminderTextValue> reminder_value(new KeywordReminderTextValue(*set, reminder->getFieldP(), &kw, !kw.fixed));
reminder->setValue(reminder_value);
errors->SetLabel(reminder_value->errors);
+4 -4
View File
@@ -387,14 +387,14 @@ void CustomPackDialog::updateTotals() {
}
void CustomPackDialog::storePack() {
edited_pack = new_intrusive<PackType>();
edited_pack = intrusive(new 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(new_intrusive2<PackItem>(pick.pack->name, copies));
edited_pack->items.push_back(intrusive(new PackItem(pick.pack->name, copies)));
}
}
}
@@ -725,10 +725,10 @@ void RandomPackPanel::onCardSelect(CardSelectEvent& ev) {
void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) {
if (!isInitialized()) return;
out.push_back(new_intrusive2<ExportCardSelectionChoice>(
out.push_back(intrusive(new ExportCardSelectionChoice(
_BUTTON_("export generated packs"),
card_list->getCardsPtr()
));
)));
}
+2 -2
View File
@@ -470,7 +470,7 @@ void StatsPanel::showCategory(const GraphType* prefer_layout) {
// create axes
GraphDataPre d;
FOR_EACH(dim, dims) {
d.axes.push_back(new_intrusive6<GraphAxis>(
d.axes.push_back(intrusive(new GraphAxis(
dim->name,
dim->colors.empty() ? AUTO_COLOR_EVEN : AUTO_COLOR_NO,
dim->numeric,
@@ -478,7 +478,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) {
+3 -3
View File
@@ -263,7 +263,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(new_intrusive1<Card>(*set->game));
if (set->cards.empty()) set->cards.push_back(intrusive(new Card(*set->game)));
// all panels view the same set
FOR_EACH(p, panels) {
p->setSet(set);
@@ -337,11 +337,11 @@ void SetWindow::onCardActivate(CardSelectEvent& ev) {
}
void SetWindow::selectionChoices(ExportCardSelectionChoices& out) {
out.push_back(new_intrusive1<ExportCardSelectionChoice>(*set)); // entire set
out.push_back(intrusive(new ExportCardSelectionChoice(*set))); // entire set
FOR_EACH(p, panels) {
p->selectionChoices(out);
}
out.push_back(new_intrusive<ExportCardSelectionChoice>()); // custom
out.push_back(intrusive(new ExportCardSelectionChoice())); // custom
}
// ----------------------------------------------------------------------------- : Window events - close