mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
default smart pointer type switched to intrusive_ptr
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@337 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -383,7 +383,7 @@ class ApprCardDatabase : public ApprDatabase {
|
||||
/** Each card has two records, a data record at the top of the file
|
||||
* and a head record at the bottom
|
||||
*/
|
||||
class ApprCardRecord {
|
||||
class ApprCardRecord : public IntrusivePtrBase<ApprCardRecord> {
|
||||
public:
|
||||
String name, sets;
|
||||
String type, cc, pt, text, flavor;
|
||||
@@ -536,7 +536,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_shared<ApprCardRecord>();
|
||||
card = new_intrusive<ApprCardRecord>();
|
||||
card->readHead(data);
|
||||
head_pos = in.TellI();
|
||||
in.SeekI(card->data_pos);
|
||||
@@ -751,7 +751,7 @@ bool ApprenticeExportWindow::exportSet() {
|
||||
cardlist.removeSet(set->apprentice_code);
|
||||
// add cards from set
|
||||
FOR_EACH(card, set->cards) {
|
||||
ApprCardRecordP rec = new_shared2<ApprCardRecord>(*card, set->apprentice_code);
|
||||
ApprCardRecordP rec = new_intrusive2<ApprCardRecord>(*card, set->apprentice_code);
|
||||
cardlist.cards.push_back(rec);
|
||||
}
|
||||
cardlist.write();
|
||||
|
||||
@@ -20,7 +20,7 @@ DECLARE_POINTER_TYPE(FileFormat);
|
||||
// ----------------------------------------------------------------------------- : FileFormat
|
||||
|
||||
/// A filter for a specific file format
|
||||
class FileFormat {
|
||||
class FileFormat : public IntrusivePtrVirtualBase {
|
||||
public:
|
||||
virtual ~FileFormat() {}
|
||||
/// File extension used by this file format
|
||||
|
||||
@@ -24,10 +24,8 @@ Bitmap export_bitmap(const SetP& set, const CardP& card) {
|
||||
DataViewer viewer;
|
||||
viewer.setSet(set);
|
||||
viewer.setCard(card);
|
||||
// style to use
|
||||
StyleSheetP style = set->stylesheetFor(card);
|
||||
// size of cards
|
||||
if (settings.stylesheetSettingsFor(*style).card_normal_export()) {
|
||||
if (settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_normal_export()) {
|
||||
// TODO
|
||||
// viewer.rotation.angle = 0;
|
||||
// viewer.rotation.zoom = 1.0;
|
||||
|
||||
@@ -179,7 +179,7 @@ SymbolPartP read_symbol_part(const ImageData& data) {
|
||||
}
|
||||
|
||||
// add to part and place a mark
|
||||
part->points.push_back(new_shared2<ControlPoint>(
|
||||
part->points.push_back(new_intrusive2<ControlPoint>(
|
||||
double(x) / data.width,
|
||||
double(y) / data.height
|
||||
));
|
||||
|
||||
@@ -29,7 +29,7 @@ class MSE1FileFormat : public FileFormat {
|
||||
};
|
||||
|
||||
FileFormatP mse1_file_format() {
|
||||
return new_shared<MSE1FileFormat>();
|
||||
return new_intrusive<MSE1FileFormat>();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Importing
|
||||
|
||||
@@ -33,5 +33,5 @@ class MSE2FileFormat : public FileFormat {
|
||||
};
|
||||
|
||||
FileFormatP mse2_file_format() {
|
||||
return new_shared<MSE2FileFormat>();
|
||||
return new_intrusive<MSE2FileFormat>();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class MtgEditorFileFormat : public FileFormat {
|
||||
};
|
||||
|
||||
FileFormatP mtg_editor_file_format() {
|
||||
return new_shared<MtgEditorFileFormat>();
|
||||
return new_intrusive<MtgEditorFileFormat>();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Importing
|
||||
@@ -68,7 +68,7 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
|
||||
// read file
|
||||
while (!f.Eof()) {
|
||||
// read a line
|
||||
if (!current_card) current_card = new_shared1<Card>(*set->game);
|
||||
if (!current_card) current_card = new_intrusive1<Card>(*set->game);
|
||||
String line = file.ReadLine();
|
||||
if (line == _("#SET###########")) { // set.title
|
||||
target = &set->value<TextValue>(_("title")).value;
|
||||
@@ -103,7 +103,7 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
|
||||
set->cards.push_back(current_card);
|
||||
}
|
||||
first = false;
|
||||
current_card = new_shared1<Card>(*set->game);
|
||||
current_card = new_intrusive1<Card>(*set->game);
|
||||
target = ¤t_card->value<TextValue>(_("name")).value;
|
||||
} else if (line == _("#DATE##########")) { // date
|
||||
// remember date for generation of illustration filename
|
||||
|
||||
Reference in New Issue
Block a user