mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
settings get read&written
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@11 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -7,9 +7,21 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <data/game.hpp>
|
||||
#include <util/io/package_manager.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Game
|
||||
|
||||
GameP Game::byName(const String& name) {
|
||||
return packages.open<Game>(name + _(".mse-game"));
|
||||
}
|
||||
|
||||
bool Game::isMagic() const {
|
||||
return name() == _("magic");
|
||||
}
|
||||
|
||||
String Game::typeName() const { return _("game"); }
|
||||
|
||||
IMPLEMENT_REFLECTION(Game) {
|
||||
REFLECT_N("full name", fullName);
|
||||
REFLECT_N("icon", iconFilename);
|
||||
}
|
||||
+10
-3
@@ -12,9 +12,8 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <util/io/package.hpp>
|
||||
|
||||
#ifndef HEADER_DATA_CARD
|
||||
DECLARE_POINTER_TYPE(Field);
|
||||
#endif
|
||||
DECLARE_POINTER_TYPE(Game);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Game
|
||||
|
||||
@@ -25,8 +24,16 @@ class Game : public Packaged {
|
||||
vector<FieldP> setFields;
|
||||
vector<FieldP> cardFields;
|
||||
|
||||
// Is this Magic the Gathering?
|
||||
/// Loads the game with a particular name, for example "magic"
|
||||
static GameP byName(const String& name);
|
||||
|
||||
/// Is this Magic the Gathering?
|
||||
bool isMagic() const;
|
||||
|
||||
protected:
|
||||
String typeName() const;
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
@@ -11,12 +11,21 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : Set
|
||||
|
||||
Set::Set(const GameP& game)
|
||||
: game(game)
|
||||
{}
|
||||
|
||||
Set::Set() {}
|
||||
|
||||
String Set::typeName() const { return _("set"); }
|
||||
|
||||
IMPLEMENT_REFLECTION(Set) {
|
||||
WITH_DYNAMIC_ARG(game_for_new_cards, game.get()) {
|
||||
REFLECT_N("card", cards);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : SetView
|
||||
|
||||
SetView::SetView() {}
|
||||
|
||||
@@ -23,6 +23,9 @@ DECLARE_POINTER_TYPE(Game);
|
||||
/// A set of cards
|
||||
class Set : public Packaged {
|
||||
public:
|
||||
/// Create a set using the given game
|
||||
Set(const GameP& game);
|
||||
|
||||
/// The game this set uses
|
||||
GameP game;
|
||||
/// The cards in the set
|
||||
@@ -30,6 +33,12 @@ class Set : public Packaged {
|
||||
/// Actions performed on this set and the cards in it
|
||||
ActionStack actions;
|
||||
|
||||
protected:
|
||||
String typeName() const;
|
||||
|
||||
// default constructor accessible to Reader
|
||||
Set();
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user