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
+2 -2
View File
@@ -538,7 +538,7 @@ void ApprCardDatabase::doRead(wxInputStream& in) {
progress_target->onProgress(0.4f * float(i) / cards.size(),
String(_("reading card ")) << i << _(" of ") << (int)cards.size());
}
card = new_intrusive<ApprCardRecord>();
card = intrusive(new ApprCardRecord());
card->readHead(data);
head_pos = in.TellI();
in.SeekI(card->data_pos);
@@ -753,7 +753,7 @@ bool ApprenticeExportWindow::exportSet() {
cardlist.removeSet(set->apprentice_code);
// add cards from set
FOR_EACH(card, set->cards) {
ApprCardRecordP rec = new_intrusive2<ApprCardRecord>(*card, set->apprentice_code);
ApprCardRecordP rec = intrusive(new ApprCardRecord(*card, set->apprentice_code));
cardlist.cards.push_back(rec);
}
cardlist.write();
+2 -2
View File
@@ -187,10 +187,10 @@ SymbolShapeP read_symbol_shape(const ImageData& data) {
}
// add to shape and place a mark
shape->points.push_back(new_intrusive2<ControlPoint>(
shape->points.push_back(intrusive(new ControlPoint(
double(x) / data.width,
double(y) / data.height
));
)));
if (x > old_x) data(old_x, y) |= MARKED; // mark when moving right -> only mark the top of the shape
last_move = (x + y) - (old_x + old_y);
old_x = x;
+1 -1
View File
@@ -30,7 +30,7 @@ class MSE1FileFormat : public FileFormat {
};
FileFormatP mse1_file_format() {
return new_intrusive<MSE1FileFormat>();
return intrusive(new MSE1FileFormat());
}
// ----------------------------------------------------------------------------- : Importing
+1 -1
View File
@@ -45,5 +45,5 @@ class MSE2FileFormat : public FileFormat {
};
FileFormatP mse2_file_format() {
return new_intrusive<MSE2FileFormat>();
return intrusive(new MSE2FileFormat());
}
+3 -3
View File
@@ -44,7 +44,7 @@ class MtgEditorFileFormat : public FileFormat {
};
FileFormatP mtg_editor_file_format() {
return new_intrusive<MtgEditorFileFormat>();
return intrusive(new MtgEditorFileFormat());
}
// ----------------------------------------------------------------------------- : Importing
@@ -69,7 +69,7 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
// read file
while (!f.Eof()) {
// read a line
if (!current_card) current_card = new_intrusive1<Card>(*set->game);
if (!current_card) current_card = intrusive(new Card(*set->game));
String line = file.ReadLine();
if (line == _("#SET###########")) { // set.title
target = &set->value<TextValue>(_("title")).value;
@@ -104,7 +104,7 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
set->cards.push_back(current_card);
}
first = false;
current_card = new_intrusive1<Card>(*set->game);
current_card = intrusive(new Card(*set->game));
target = &current_card->value<TextValue>(_("name")).value;
} else if (line == _("#DATE##########")) { // date
// remember date for generation of illustration filename