diff --git a/src/data/action/symbol.cpp b/src/data/action/symbol.cpp index 01ea5908..36795e83 100644 --- a/src/data/action/symbol.cpp +++ b/src/data/action/symbol.cpp @@ -355,8 +355,8 @@ void DuplicateSymbolPartsAction::getParts(set& parts) { // ----------------------------------------------------------------------------- : Reorder symbol parts -ReorderSymbolPartsAction::ReorderSymbolPartsAction(Symbol& symbol, size_t partId1, size_t partId2) - : symbol(symbol), partId1(partId1), partId2(partId2) +ReorderSymbolPartsAction::ReorderSymbolPartsAction(Symbol& symbol, size_t part_id1, size_t part_id2) + : symbol(symbol), part_id1(part_id1), part_id2(part_id2) {} String ReorderSymbolPartsAction::getName(bool to_undo) const { @@ -364,7 +364,7 @@ String ReorderSymbolPartsAction::getName(bool to_undo) const { } void ReorderSymbolPartsAction::perform(bool to_undo) { - assert(partId1 < symbol.parts.size()); - assert(partId2 < symbol.parts.size()); - swap(symbol.parts[partId1], symbol.parts[partId2]); + assert(part_id1 < symbol.parts.size()); + assert(part_id2 < symbol.parts.size()); + swap(symbol.parts[part_id1], symbol.parts[part_id2]); } diff --git a/src/data/action/symbol.hpp b/src/data/action/symbol.hpp index 0a2159ae..08795a3f 100644 --- a/src/data/action/symbol.hpp +++ b/src/data/action/symbol.hpp @@ -223,7 +223,7 @@ class DuplicateSymbolPartsAction : public SymbolPartListAction { /// Change the position of a part in a symbol, by swapping two parts. class ReorderSymbolPartsAction : public SymbolPartListAction { public: - ReorderSymbolPartsAction(Symbol& symbol, size_t partId1, size_t partId2); + ReorderSymbolPartsAction(Symbol& symbol, size_t part_id1, size_t part_id2); virtual String getName(bool to_undo) const; virtual void perform(bool to_undo); @@ -231,7 +231,7 @@ class ReorderSymbolPartsAction : public SymbolPartListAction { private: Symbol& symbol; ///< Symbol to swap the parts in public: - size_t partId1, partId2; ///< Indeces of parts to swap + size_t part_id1, part_id2; ///< Indeces of parts to swap }; diff --git a/src/data/card.cpp b/src/data/card.cpp index fa258cc7..a85a5963 100644 --- a/src/data/card.cpp +++ b/src/data/card.cpp @@ -35,5 +35,6 @@ String Card::identification() const { IMPLEMENT_REFLECTION(Card) { REFLECT(notes); + REFLECT_NAMELESS(data); } diff --git a/src/data/card.hpp b/src/data/card.hpp index 893ce3f1..b4671e61 100644 --- a/src/data/card.hpp +++ b/src/data/card.hpp @@ -31,20 +31,19 @@ class Card { /// Creates a card using the given game Card(const Game& game); - /// Get an identification of the card, an identification is something like a name, title, etc. - String identification() const; - /// The values on the fields of the card. - /** The indices should correspond to the cardFields in the Game */ + /** The indices should correspond to the card_fields in the Game */ IndexMap data; - /// Notes for this card String notes; - /// Alternative style to use for this card /** Optional; if not set use the card style from the set */ StyleSheetP stylesheet; + /// Get the identification of this card, an identification is something like a name, title, etc. + /** May return "" */ + String identification() const; + DECLARE_REFLECTION(); }; diff --git a/src/data/field.cpp b/src/data/field.cpp index 689d49c5..520dc108 100644 --- a/src/data/field.cpp +++ b/src/data/field.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -56,21 +57,29 @@ shared_ptr read_new(Reader& reader) { // there must be a type specified String type; reader.handle(_("type"), type); - if (type == _("text")) return new_shared(); - else if (type == _("choice")) return new_shared(); - else if (type == _("boolean")) return new_shared(); - else if (type == _("image")) return new_shared(); - else if (type == _("symbol")) return new_shared(); - else if (type == _("color")) return new_shared(); + if (type == _("text")) return new_shared(); + else if (type == _("choice")) return new_shared(); + else if (type == _("multiple choice")) return new_shared(); + else if (type == _("boolean")) return new_shared(); + else if (type == _("image")) return new_shared(); + else if (type == _("symbol")) return new_shared(); + else if (type == _("color")) return new_shared(); else { throw ParseError(_("Unsupported field type: '") + type + _("'")); } } - // ----------------------------------------------------------------------------- : Style +Style::Style(const FieldP& field) + : fieldP(field) + , z_index(0) + , left(0), width (1) + , top (0), height(1) + , visible(true) +{} + Style::~Style() {} IMPLEMENT_REFLECTION(Style) { @@ -82,9 +91,12 @@ IMPLEMENT_REFLECTION(Style) { REFLECT(visible); } -void initObject(const FieldP& field, StyleP& style) { +void init_object(const FieldP& field, StyleP& style) { style = field->newStyle(field); } +template <> StyleP read_new